Add automatic word completion
This commit is contained in:
parent
aed482ad02
commit
b48d7c1849
2 changed files with 17 additions and 1 deletions
17
vim/plugin/complete.vim
Normal file
17
vim/plugin/complete.vim
Normal file
|
@ -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 <SID>autocomplete(<q-args> == "on")
|
||||
command ToggleComplete call <SID>autocomplete(!exists("g:autocomplete"))
|
||||
map <leader>c :ToggleComplete<CR>
|
|
@ -730,7 +730,6 @@ au BufNewFile,BufRead *.vim,*vimrc :call <sid>init_vim_file()
|
|||
function! s:init_vim_file()
|
||||
setl number
|
||||
nnoremap <buffer> <F5> :w<CR>:so %<CR>
|
||||
nnoremap <buffer> <leader>c A<space>"<space>
|
||||
nnoremap <buffer> <leader>if ofunction! <C-o>m'()<enter>endfunction<C-o>`'<C-o>l
|
||||
|
||||
command! -buffer Functions lex MatchingLines("^\\s*fun\\(ction\\)\\?\\>!.*$")
|
||||
|
|
Loading…
Reference in a new issue