diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-07-26 07:54:07 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-07-26 07:54:07 +0200 |
| commit | d98459ae4b1b46e381a62f38f177da22b1406f68 (patch) | |
| tree | de2f2b19a4e7df8531c01af3cb62ef8a5706fe26 /config/vim/vimrc | |
| parent | bc95e3c59bb869bb18bee41a362df44cbba5dd75 (diff) | |
| download | dotfiles-d98459ae4b1b46e381a62f38f177da22b1406f68.tar.gz dotfiles-d98459ae4b1b46e381a62f38f177da22b1406f68.tar.bz2 dotfiles-d98459ae4b1b46e381a62f38f177da22b1406f68.zip | |
Added vim autocompletion with Tab and Shift-Tab instead of C-n/C-p
Diffstat (limited to 'config/vim/vimrc')
| -rw-r--r-- | config/vim/vimrc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config/vim/vimrc b/config/vim/vimrc index 7d2441b..9f5c8fb 100644 --- a/config/vim/vimrc +++ b/config/vim/vimrc @@ -335,3 +335,19 @@ nnoremap <leader>ss :setlocal spell!<CR> hi link juliaFunctionCall Identifier hi link juliaParDelim Delimiter + +nnoremap gf :vsp <cfile><CR> + +" from: https://vim.fandom.com/wiki/Autocomplete_with_TAB_when_typing_words + +function! TabOrComplete(direction) + if col('.') > 1 && strpart(getline('.'), col('.') - 2, 3) =~# '^\w' + return a:direction ==# 'next' ? "\<C-n>" : "\<C-p>" + else + return "\<TAB>" + endif +endfunction + +inoremap <TAB> <C-r>=TabOrComplete('next')<CR> +" st maps Shift-Tab to <ESC>[Z (and it's discouraged to change it) +inoremap <ESC>[Z <C-r>=TabOrComplete('prev')<CR> |
