I found this question, but mine is a bit different.
When I write code dealing with arrays or classes like $myArray['myElement']
or document.getElementById("myElement")
, I get annoyed because I have to use word completion a few times. Vim's completion is helpful like $myA<C-P>
completes $myArray
, but then I still have to type ['$myE<C-P>']
to finish the whole WORD. I tried changing iskeyword
to include '[].
, but that returned too many results to sort through when I only wanted to complete words. d<C-X><C-L>
is helpful sometimes, but also not what I'm looking for.
How can I configure Vim to keep the default word completion to complete d<C-P>
to document
, and also add something, maybe <C-X><C-W>
, to complete d<C-X><C-W>
to document.getElementById("myElement")
?
<C-X><C-W>
instead of overriding the existing completion keystrokes.inoremap <C-X><C-W> <C-O>:call <SID>CustomKeyword(join(map([char2nr('.'),char2nr('"'),char2nr("'")]+range(char2nr('0'),char2nr('~')), 'nr2char(v:val)'), ''))<CR><C-X><C-N>
, etc.