Skip to content

Instantly share code, notes, and snippets.

@mgamba
Last active April 18, 2017 02:48
Show Gist options
  • Save mgamba/3288c5d23862c5a923cf to your computer and use it in GitHub Desktop.
Save mgamba/3288c5d23862c5a923cf to your computer and use it in GitHub Desktop.
"vim tab mapping for default autocomplete
:function AutoComplete()
: if len(matchstr(getline('.')[col('.')-2], "[^ \t\n]*$")) > 0
: return "\<C-N>"
: else
: return "\<TAB>"
: endif
:endfunction
inoremap <silent> <TAB> <C-R>=AutoComplete()<CR>
"add git grep to vim
function! GitGrep(search_token)
:cgete system('git grep -n ' . a:search_token)
:copen
endfunction
command! -nargs=1 GitGrep call GitGrep("<args>")
:nnoremap <S-f> :GitGrep
:nnoremap <S-Right> :cnext<CR>
:nnoremap <S-Left> :cprev<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment