From 598ae5f91451ce3947d85e49c3ae6fb1526b51dd Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 9 Nov 2018 23:05:15 +0800 Subject: vim: Clean up and minor tweaks * Clean up some unnecessary bits. * Tweak style a bit to be more consistent. * Change tab width to be 8. * Do not change the map of '0'. --- _vimrc | 73 +++++++++++++++--------------------------------------------------- 1 file changed, 16 insertions(+), 57 deletions(-) diff --git a/_vimrc b/_vimrc index e17b825..11c06ba 100644 --- a/_vimrc +++ b/_vimrc @@ -1,32 +1,9 @@ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Maintainer: -" Amir Salihefendic — @amix3k -" -" Awesome_version: -" Get this config, nice color schemes and lots of plugins! -" -" Install the awesome version from: -" -" https://github.com/amix/vimrc -" -" Sections: -" -> General -" -> VIM user interface -" -> Colors and Fonts -" -> Files and backups -" -> Text, tab and indent related -" -> Visual mode related -" -> Moving around, tabs and buffers -" -> Status line -" -> Editing mappings -" -> vimgrep searching and cope displaying -" -> Spell checking -" -> Misc -" -> Helper functions -" +" Credit: +" Amir Salihefendic — @amix3k +" https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => General """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -56,30 +33,20 @@ command W w !sudo tee % > /dev/null " => VIM user interface """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Set 7 lines to the cursor - when moving vertically using j/k -set so=7 - -" Avoid garbled characters in Chinese language windows OS -let $LANG='en' -set langmenu=en -source $VIMRUNTIME/delmenu.vim -source $VIMRUNTIME/menu.vim +set scrolloff=7 " Turn on the Wild menu set wildmenu " Ignore compiled files set wildignore=*.o,*~,*.pyc -if has("win16") || has("win32") - set wildignore+=.git\*,.hg\*,.svn\* -else - set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store -endif +set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store "Always show current position set ruler " Height of the command bar -set cmdheight=2 +set cmdheight=1 " A buffer becomes hidden when it is abandoned set hid @@ -122,7 +89,6 @@ if has("gui_macvim") autocmd GUIEnter * set vb t_vb= endif - " Add a bit extra margin to the left set foldcolumn=1 @@ -172,23 +138,19 @@ set noswapfile """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Text, tab and indent related """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Use spaces instead of tabs set expandtab - -" Be smart when using tabs ;) set smarttab -" 1 tab == 4 spaces set shiftwidth=4 -set tabstop=4 +set tabstop=8 " Linebreak on 500 characters set lbr set tw=500 -set ai "Auto indent -set si "Smart indent -set wrap "Wrap lines +set autoindent +set smartindent +set wrap """""""""""""""""""""""""""""" @@ -247,8 +209,8 @@ map cd :cd %:p:h:pwd " Specify the behavior when switching between buffers try - set switchbuf=useopen,usetab,newtab - set stal=2 + set switchbuf=useopen,usetab,newtab + set stal=2 catch endtry @@ -269,9 +231,6 @@ set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Editing mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Remap VIM 0 to first non-blank character -map 0 ^ - " Move a line of text using ALT+[jk] or Command+[jk] on mac nmap mz:m+`z nmap mz:m-2`z @@ -279,10 +238,10 @@ vmap :m'>+`mzgv`yo`z vmap :m'<-2`>my` - nmap - vmap - vmap + nmap + nmap + vmap + vmap endif " Delete trailing white space on save, useful for some filetypes ;) -- cgit v1.2.2