From 5c9423496ae8e329b84d611543035023d660f4a4 Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Sun, 3 May 2015 22:26:50 +0800 Subject: [PATCH] clean up vimrc --- README.md | 3 ++ _vimrc | 101 +++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 84 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index b83ebbb..707407b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ This is my vim dot file. +vundle相关配置在vundle_vimrc中,用vundle管理插件,插件列表`:PluginList`查看 +python相关配置在python_vimrc中 + 在vim目录下 git init diff --git a/_vimrc b/_vimrc index 7eef230..9e9b83f 100644 --- a/_vimrc +++ b/_vimrc @@ -8,15 +8,34 @@ source $VIM/python_vimrc source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => General +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Sets how many lines of history VIM has to remember +set history=700 + +" set to auto read when a file is changed outside +set autoread + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => VIM user interface +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" set 7 lines to the cursor - when moving vertically using j/k +set scrolloff=8 + " 如下命令使鼠标用起来象微软 Windows behave mswin -" using monokai color -" there should be molokai.vim file under ~/vimfile/colors/ -" https://github.com/tomasr/molokai -colorscheme molokai +" always show current position +set ruler +" height of the command bar +set cmdheight=2 +" in many terminal emulators the mouse works just fine, thus enable it +if has('mouse') + set mouse=a +endif -" Ignore case when searching +" Ignore case when searching 忽略大小写 set ignorecase " When searching try to be smart about cases @@ -28,6 +47,22 @@ set hlsearch " Makes search act like search in modern browsers set incsearch +" for regular expressions turn magic on +set magic + +set showcmd + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Colors and Fonts +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"语法高亮 +syntax on + +" using monokai color +" there should be molokai.vim file under ~/vimfile/colors/ +" https://github.com/tomasr/molokai +colorscheme molokai + "vim内部编码 set encoding=utf-8 "按照utf-8 without bom,utf-8,顺序识别打开文件 @@ -51,7 +86,21 @@ set nobomb "不自动设置字节序标记 set guifont=Courier\ New\:h12 set guifontwide=NSimsun\:h12 -set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限 + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Files, backups and undo +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Turn backup off, since most stuff is in SVN, git et.c anyway... +set nobackup +set nowb +set noswapfile + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Text, tab and indent related +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限 +set nocompatible "设置自动缩进 set autoindent "C语言自动缩进 @@ -61,16 +110,30 @@ set tabstop=4 "显示行号 set nu -"语法高亮 -syntax on +" set smart indent +set si +" wrap lines +set wrap -set ruler +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Moving around, tabs, windows and buffers +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Treat long lines as break lines (useful when moving around in them) +map j gj +map k gk + + + +"""""""""""""""""""""""""""""" +" => Status line +"""""""""""""""""""""""""""""" "状态栏显示内容 "define 3 custom highlight groups hi User1 ctermbg=green ctermfg=red guibg=green guifg=red hi User2 ctermbg=gray ctermfg=blue guibg=gray guifg=blue hi User3 ctermbg=blue ctermfg=green guibg=blue guifg=green - + +" always show the status line set laststatus=2 set statusline= "full filename modified flag read only flag help file flag Preview @@ -84,16 +147,6 @@ set statusline+=%l/%L "line no/all line" set statusline+=\ %P -set showcmd - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Files, backups and undo -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Turn backup off, since most stuff is in SVN, git et.c anyway... -set nobackup -set nowb -set noswapfile - " Plugin settings @@ -113,6 +166,14 @@ let g:indent_guides_enable_on_vim_startup = 1 let g:jedi#completions_command = "" let g:jedi#popup_on_dot = 0 +" Delete trailing white space on save, useful for Python and CoffeeScript ;) +func! DeleteTrailingWS() + exe "normal mz" + %s/\s\+$//ge + exe "normal `z" +endfunc +autocmd BufWrite *.py :call DeleteTrailingWS() +autocmd BufWrite *.coffee :call DeleteTrailingWS() set diffexpr=MyDiff() function MyDiff()