Vim Tips Wiki

Ctrl-N completion for XML/XSLT attributes

Redirected from VimTip1469

1,624pages on
this wiki
Add New Page
Talk0 Share
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")


  • 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.



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

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki