瀏覽代碼

reorganized vimrc, added subdir file searching

Josh Bicking 7 年之前
父節點
當前提交
6d5602ef6b
共有 1 個文件被更改,包括 76 次插入75 次删除
  1. 76 75
      vimrc

+ 76 - 75
vimrc

@@ -1,67 +1,39 @@
 " start plugins
 execute pathogen#infect()
 
-" set black color scheme
-colorscheme torte
-" enable syntax processing
-syntax enable
-
-" number of visual spaces per TAB
-set tabstop=4
-
-" number of spaces in tab when editing
-set softtabstop=4
-
-" number of space when using > or <
-set shiftwidth=4
+" space is Leader
+map <space> <leader>
 
-" tabs are spaces
-set expandtab
+""" Visual
 
-" show line numbers
-set number
+colorscheme torte " set black color scheme
 
-" show relative line numbers
-set rnu
+syntax enable " enable syntax processing
 
-" show command in bottom bar
-set showcmd
+set nocursorline " don't highlight current line
 
-" don't highlight current line
-set nocursorline
+set nohlsearch " disable search highlight
 
-" disable search highlight
-set nohlsearch
+set showmatch " highlight matching brackets
 
-" load filetype-specific indent files
-filetype indent on
+set lazyredraw " redraw only when necessary (faster macros)
 
-" visual autocomplete for command menu
-set wildmenu
+""" Tabs
 
-" don't autocomplete on first tab press
-set wildmode=longest,full
+set tabstop=4 " number of visual spaces per TAB
 
-" redraw only when necessary (faster macros)
-set lazyredraw
+set softtabstop=4 " number of spaces in tab when editing
 
-" highlight matching brackets
-set showmatch
+set shiftwidth=4 " number of space when using > or <
 
-" search as characters are entered
-set incsearch
+set expandtab " tabs are spaces
 
-" fold based on indent
-set foldmethod=indent
 
-" foldlevel when window is loaded
-set foldlevelstart=1
+""" Numbering
 
-" fold based on indent level
-set foldmethod=indent
+set number " show line numbers
 
-" disable the mouse
-set mouse=
+set rnu " show relative line numbers
 
 " toggle relative line nums when focus is gained/lost
 :au FocusLost * :set norelativenumber
@@ -76,17 +48,33 @@ function! NumberToggle()
     endif
 endfunc
 
-nnoremap <C-n> :call NumberToggle()<CR>
+nnoremap <Leader>n :call NumberToggle()<CR>
 
-" set shell to zsh on linux (if it exists)
-if !(has("win32") || has("win16") || has("win32unix"))
-    if filereadable("/bin/zsh") && $SHELL=="/bin/zsh"
-        silent! set shell=/bin/zsh
-    endif
-endif
 
-" swap files are rotated every 10 keystrokes
-set updatecount=10
+""" Command menu and Searching
+
+set wildmenu " visual autocomplete for command menu
+
+set wildmode=longest,full " don't autocomplete on first tab press
+
+set showcmd " show command in bottom bar
+
+set incsearch " search as characters are entered
+
+" search through subdirectories when looking for files
+set path+=**
+
+
+""" Folds
+
+set foldmethod=indent " fold based on indent
+
+set foldlevelstart=1 " foldlevel when window is loaded
+
+set foldmethod=indent " fold based on indent level
+
+
+""" Insert mode
 
 " backspace is used to remove previous characters, indents, and newlines
 set backspace=indent,eol,start
@@ -94,13 +82,34 @@ set backspace=indent,eol,start
 " Map Ctrl-Backspace to delete the previous word in insert mode.
 imap <C-BS> <C-W>
 
+
+""" Filetypes
+
+autocmd FileType make setlocal noexpandtab " set Makefiles with tabs not spaces
+
+filetype indent on " load filetype-specific indent files
+
+" ensure normal tabs and 8 space tabs in assembly files
+autocmd FileType asm set noexpandtab shiftwidth=8 softtabstop=0
+
+
+""" System/OS
+
+set mouse= " disable the mouse
+
+" set shell to zsh on linux (if it exists)
+if !(has("win32") || has("win16") || has("win32unix"))
+    if filereadable("/bin/zsh") && $SHELL=="/bin/zsh"
+        silent! set shell=/bin/zsh
+    endif
+endif
+
+set updatecount=10 " swap files are rotated every 10 keystrokes
+
 " make an undo file to allow undoing after closing a file
 set undofile
 set undodir=~/.vim/undodir
 
-" set Makefiles with tabs not spaces
-autocmd FileType make setlocal noexpandtab
-
 " compare current buffer to saved file
 function! s:DiffWithSaved()
   let filetype=&ft
@@ -111,6 +120,9 @@ function! s:DiffWithSaved()
 endfunction
 com! DiffSaved call s:DiffWithSaved()
 
+" map the comp buff function above
+noremap <Leader>d :DiffSaved<CR>
+
 " write w/ privileges when Vim isn't started as root
 cmap w!! %!sudo tee > /dev/null %
 
@@ -126,6 +138,9 @@ function! BlackBG()
   highlight Normal ctermbg=black
 endfunction
 
+
+""" Key shortcuts
+
 " remove trailing whitespace and return to start position
 " remove highlight if in nvim
 if has('nvim')
@@ -134,25 +149,11 @@ else
     noremap <Leader>w :%s/\s\+$//<CR>``
 endif
 
-" ensure normal tabs and 8 space tabs in assembly files
-autocmd FileType asm set noexpandtab shiftwidth=8 softtabstop=0
-
-" space is Leader
-map <space> <leader>
-
 " <Leader>l formats a line
 noremap <Leader>l Vgq
 
-" map the comp buff function above
-noremap <Leader>d :DiffSaved<CR>
 
-" map the write and make function
-noremap <Leader>c :WriteMake<CR>
-
-" remove trailing whitespace and return to start position
-noremap <Leader>w :%s/\s\+$//<CR>``
-
-" plugins
+""" Plugins
 
 " show recently opened files
 noremap <Leader>m :MRU<CR>
@@ -185,14 +186,14 @@ highlight YcmWarningSign ctermfg=Yellow
 highlight YcmErrorSection ctermfg=Red
 highlight YcmErrorsign ctermfg=Red
 
-" vim-airline
-" place the airline bar above the command line
+" place the vim-airline bar above the command line
 set laststatus=2
 
 " ignore trailing whitespace in markdown
 autocmd FileType markdown AirlineToggleWhitespace
 
-" neovim
+
+""" Neovim
 
 if has('nvim')
     " Esc returns to normal mode in terminal mode