diff options
Diffstat (limited to '.vim/vimrc')
-rw-r--r-- | .vim/vimrc | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -15,6 +15,8 @@ let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#whitespace#enabled = 1 let g:airline_powerline_fonts = 1 +let g:completor_clang_binary = '/usr/bin/clang' + "All things cursor set guicursor+=a:blinkon0 "disable blinking if &term =~ "xterm\\|rxvt" @@ -97,6 +99,12 @@ inoremap {} {}<left> inoremap {<CR> {<CR>}<ESC>O inoremap {;<CR> {<CR>};<ESC>O +" completor + +inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" +inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" +inoremap <expr> <Tab> Tab_Or_Complete() + " =========== " COMMANDS " =========== @@ -138,6 +146,27 @@ function Run_in_terminal(prog) startinsert endfunction +" Use TAB to complete when typing words, else inserts TABs as usual. Uses +" dictionary, source files, and completor to find matching words to complete. + +" Note: usual completion is on <C-n> but more trouble to press all the time. +" Never type the same word twice and maybe learn a new spellings! +" Use the Linux dictionary when spelling is in doubt. +function! Tab_Or_Complete() abort + " If completor is already open the `tab` cycles through suggested completions. + if pumvisible() + return "\<C-N>" + " If completor is not open and we are in the middle of typing a word then + " `tab` opens completor menu. + elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^[[:keyword:][:ident:]]' + return "\<C-R>=completor#do('complete')\<CR>" + else + " If we aren't typing a word and we press `tab` simply do the normal `tab` + " action. + return "\<Tab>" + endif +endfunction + " helper function to toggle hex mode function ToggleHex() " hex mode should be considered a read-only operation |