|
|
@@ -27,7 +27,7 @@ set splitright " New splits appear right of current window
|
|
|
set ttyfast " Smooth movement
|
|
|
set ttymouse=xterm2
|
|
|
set mouse=a
|
|
|
-set scrolloff=10 " keep distance from top and bottom for current line
|
|
|
+set scrolloff=7 " keep distance from top and bottom for current line
|
|
|
set cursorline " ensure that there is a cursor line
|
|
|
|
|
|
" Persistent undo
|
|
|
@@ -53,9 +53,6 @@ if has("autocmd")
|
|
|
" Any actions on startup
|
|
|
autocmd VimEnter * call StartUp()
|
|
|
|
|
|
- autocmd WinEnter * setlocal cursorline
|
|
|
- autocmd WinLeave * setlocal nocursorline
|
|
|
-
|
|
|
" Show trailing white space
|
|
|
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
|
|
|
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
|
|
@@ -63,14 +60,15 @@ if has("autocmd")
|
|
|
" Source the vimrc file after saving it
|
|
|
autocmd BufWritePost .vimrc source $MYVIMRC
|
|
|
|
|
|
- " Local remaps for Quickfix buffer
|
|
|
+ " Things for Quickfix buffers
|
|
|
+
|
|
|
+ " Local remaps for all Quickfix buffers
|
|
|
autocmd FileType qf nnoremap <silent> <buffer> q :ccl<CR>:lcl<CR>
|
|
|
autocmd FileType qf nnoremap <silent> <buffer> o <CR>
|
|
|
- " TODO this doesn't always return to the window in more complex layouts
|
|
|
- autocmd FileType qf nnoremap <silent> <buffer> go <CR><C-W><C-W>
|
|
|
|
|
|
- " Global remaps when QuickFix buffer is opened
|
|
|
+ " Global remaps for all QuickFix buffers
|
|
|
autocmd BufWinEnter quickfix
|
|
|
+ \ setlocal nocursorline |
|
|
|
\ let g:qfix_win = bufnr("$") |
|
|
|
\ call MapQfPrevNext()
|
|
|
autocmd BufWinLeave *
|
|
|
@@ -80,10 +78,17 @@ if has("autocmd")
|
|
|
\ endif
|
|
|
|
|
|
" Open QuickFix window after any grep invocation (Glog and Ggrep)
|
|
|
- autocmd QuickFixCmdPost *grep* cwindow | call MapQfPrevNext()
|
|
|
+ autocmd QuickFixCmdPost *grep* cwindow |
|
|
|
+ \ setlocal nocursorline |
|
|
|
+ \ let g:qfix_win = bufnr("$") |
|
|
|
+ \ call MapQfPrevNext()
|
|
|
|
|
|
" if the last window is NERDTree, then close Vim
|
|
|
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
|
|
|
+ "
|
|
|
+ " Show cursorline only on active window. No need for this now
|
|
|
+ "autocmd WinEnter * setlocal cursorline
|
|
|
+ "autocmd WinLeave * setlocal nocursorline
|
|
|
else
|
|
|
set autoindent on
|
|
|
endif
|
|
|
@@ -159,6 +164,14 @@ set incsearch " vim will search as you type!
|
|
|
set ignorecase " ignore case for searches
|
|
|
set smartcase " well, unless a user puts in uppercase search characters
|
|
|
set magic " enables wildcard searching
|
|
|
+" use ack for grepping if available
|
|
|
+if executable('ack-grep')
|
|
|
+ set grepprg=ack-grep\ --with-filename\ --nocolor\ --nogroup
|
|
|
+elseif executable('ack')
|
|
|
+ set grepprg=ack\ --with-filename\ --nocolor\ --nogroup
|
|
|
+endif
|
|
|
+set shellpipe=&> " don't display ack/grep terminal output. NOTE: not reliable
|
|
|
+ " https://github.com/mileszs/ack.vim/issues/18
|
|
|
|
|
|
|
|
|
""""""""
|
|
|
@@ -224,6 +237,9 @@ nmap <silent> <leader>u :GundoToggle<CR>
|
|
|
nmap <silent> <leader>b :Gblame<CR>
|
|
|
nmap <silent> <leader>g :Glog<CR><CR>
|
|
|
|
|
|
+" Ack with Ctrl-F
|
|
|
+nmap <C-F> :Grep<space>
|
|
|
+
|
|
|
" Code heirarchy with Tagbar
|
|
|
nmap <silent> <leader>t :TagbarToggle<CR>
|
|
|
|
|
|
@@ -278,7 +294,7 @@ let g:tagbar_autoclose = 1 " close sidebar after we go to selection
|
|
|
|
|
|
|
|
|
""""""""" EasyGrep
|
|
|
-let g:EasyGrepJumpToMatch = 0
|
|
|
+let g:EasyGrepCommand = 1 " don't use the built in vimgrep, which is slow
|
|
|
let g:EasyGrepHighlightQfMatches = 1
|
|
|
|
|
|
|