From 0d7c827359dd35d0069532a829b6728b3ca84ad4 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Mon, 22 Mar 2021 18:11:28 +0100 Subject: vim updates --- .vim/vimrc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to '.vim/vimrc') diff --git a/.vim/vimrc b/.vim/vimrc index d98bb5f..bda5c62 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -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 {} {} inoremap { {}O inoremap {; {};O +" completor + +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" +inoremap 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 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 "\" + " 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 "\=completor#do('complete')\" + else + " If we aren't typing a word and we press `tab` simply do the normal `tab` + " action. + return "\" + endif +endfunction + " helper function to toggle hex mode function ToggleHex() " hex mode should be considered a read-only operation -- cgit v1.2.3