From b48d7c1849de47934caee09b39093758c1994cde Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Thu, 27 Aug 2020 13:18:59 +0200 Subject: [PATCH] Add automatic word completion --- vim/plugin/complete.vim | 17 +++++++++++++++++ vim/plugin/shame.vim | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 vim/plugin/complete.vim diff --git a/vim/plugin/complete.vim b/vim/plugin/complete.vim new file mode 100644 index 0000000..1aeae49 --- /dev/null +++ b/vim/plugin/complete.vim @@ -0,0 +1,17 @@ +function s:autocomplete(enabled) + if a:enabled + for letter in ("abcdefghijklmnopqrstuvwxyz"->split(".\\zs")) + exec "inoremap ".letter." ".letter."" + endfor + let g:autcomplete=1 + else + for letter in ("abcdefghijklmnopqrstuvwxyz"->split(".\\zs")) + exec "iunmap ".letter + endfor + unlet g:autocomplete + end +endfun + +command -nargs=1 Complete call autocomplete( == "on") +command ToggleComplete call autocomplete(!exists("g:autocomplete")) +map c :ToggleComplete diff --git a/vim/plugin/shame.vim b/vim/plugin/shame.vim index 8c204cc..029c5f6 100644 --- a/vim/plugin/shame.vim +++ b/vim/plugin/shame.vim @@ -730,7 +730,6 @@ au BufNewFile,BufRead *.vim,*vimrc :call init_vim_file() function! s:init_vim_file() setl number nnoremap :w:so % - nnoremap c A" nnoremap if ofunction! m'()endfunction`'l command! -buffer Functions lex MatchingLines("^\\s*fun\\(ction\\)\\?\\>!.*$")