Saturday, June 27, 2009

Friday, June 05, 2009

C++ vs. tags

One - at times very - annoying problem I had was that jumping to tag not very C++ friendly. Namely it doesn't consider ':' (colon) to be part of word under cursor. It finally bothered me to the point of reading documentation which promptly sent me to :help star where from I was sent to :help 'iskeyword'. In less than a minute I had a fix:

au BufReadPost *.cpp set isk+=:

'isk' is shorthand for 'iskeyword' and tells VIM what symbols should be considered to be part of (key)words. 'isk' is a list (as usually comma separated) of characters/character ranges and as with any other comma-separated lists, operators '+=' and '-=' do they job as they should.

That obviously has an impact on any VIM command which works with words - '*', '#', 'w', etc. Beware.