![]() Because of the way I structure my code nowadays, I hardly need more than that. I’m not using any plugin to generate JavaScript or CSS tags so my code completion is mostly based on all words contained on all the open buffers. " Enable omnicomplete for supported filetypesĪutocmd FileType css,scss setlocal omnifunc=csscomplete#CompleteCSSĪutocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTagsĪutocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJSĪutocmd FileType python setlocal omnifunc=pythoncomplete#CompleteĪutocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " yes, we need to duplicate it on VimEnter for some weird reasonĪutocmd VimEnter * nnoremap * :silent call KeywordsAll() * :silent call KeywordsBasic()Īutocmd VimEnter * nnoremap # :silent call KeywordsAll() # :silent call KeywordsBasic()Īnd here are my other autocomplete settings: " delimiters (_,-,$,%.) are treated as word separators outside insert modeĪutocmd InsertEnter,BufLeave * :call KeywordsAll()Īutocmd InsertLeave,BufEnter * :call KeywordsBasic() " make sure `complete` works as expected for CSS class names whithout Nnoremap # :silent call KeywordsAll() # :silent call KeywordsBasic() Nnoremap * :silent call KeywordsAll() * :silent call KeywordsBasic() Setl improve the 'search word under cursor' behavior That way I can still use cw, ve, db to edit each fragment, autocomplete will work properly for words like foo-bar_baz, and you can still use W, B and E if you want to quickly jump around. My quick and dirty solution to the problem was to keep iskeyword with the minimal value as possible and only change it during InsertEnter. You can change the auto complete behavior with set iskeyword which also changes the behavior of standard motion commands like w, e, b (it changes the word delimiters) – which a find a PITA since I got used to these motions. I’ve been using the excellent SuperTab Vim Plugin for a couple years, it works reasonably well (autocompletes based on words from all buffers, file names, tags, context, etc…) but it doesn’t work really well for text that is split by dashes - CSS contains lots of these… - so I started to get frustrated with it. Just a quick tip about Vim autocompletion.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |