Wikia

Vim Tips Wiki

Watchlist Recent changes

Ctrl-N completion for XML/XSLT attributes

Redirected from VimTip1469

Tip 1469 Printable Monobook Previous Next

created January 12, 2007 · complexity basic · author Erik Falor · version n/a


I found myself switching back into lisp mode just to get Ctrl-N to complete really long attribute names containing hyphens. However, that has the undesirable side-effect of goofing up my indentation. I decided to dig in a little deeper and fix Ctrl-N such that it wouldn't take a hyphen to be a word boundary. As an added bonus, it'll include XSL namespace prefixes in its list of words.

Add this to your vimrc:

if has("autocmd")
  autocmd FileType {xml,xslt} setlocal iskeyword=@,-,\:,48-57,_,128-167,224-235
endif "has("autocmd")

Notes

  • This does not rely on extensions; instead it works on any file which the filetype detection identifies correctly.
  • It only changes the 'iskeyword' value for that buffer, not globally.

ReferencesEdit

CommentsEdit

Shouldn't those word character settings rather be put into the appropriate filetype plugin?


Pages on Vim Tips Wiki

Add a Page
1,601pages on
this wiki

Latest Photos

Add a Photo
66photos on this wiki
See more >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki