Skip to main content
15 votes

Add keywords to a highlight group

The highlight group Todo just defines how a "todo" should be highlighted. What is actually highlighted by Todo is defined by the syntax. For the C language, the expression is: syn keyword cTodo ...
Ralf's user avatar
  • 9,287
8 votes

Why is % part of a word?

When you're using a w (or e, or b) command to move on a word that contains both characters listed in 'iskeyword' and characters not listed in 'iskeyword', then the w command will alternate between the ...
filbranden's user avatar
  • 29k
8 votes
Accepted

Unable to set iskeyword for colon ( : ) character

You are looking for set iskeyword-=: That is, making : explicitly not a keyword character. If : is in iskeyword it will be included in ciw.
Mass's user avatar
  • 14.2k
4 votes
Accepted

Character class to match "iskeyword" characters

From :h /character-classes you are looking for \k: magic nomagic matches ~ /\k \k \k keyword character (see 'iskeyword' option) /\K \K \K like "\k", but excluding digits ...
statox's user avatar
  • 50.1k
4 votes
Accepted

custom mapping to make dge consistent with dw, de, and db?

One easy way to fix ge is to make a backwards search: onoremap ge :call search('\>', 'b')<CR> You can use a more complex regex if you want. Or, you could also move to the right position ...
Zorzi's user avatar
  • 1,111
4 votes

Is it possible to make "???" a keyword that can be highlighted?

syntax keywords are supposed to be - well - keywords. Initially, this meant, it must match the definition of the 'iskeyword' option, which usually does not include the quotation mark. Some years later,...
Christian Brabandt's user avatar
4 votes
Accepted

Add keywords to a highlight group

Add the following to your .vimrc: fun! SetMyTodos() syn match myTodos /\%(HABA:\)\|\%(NOTE:\)/ hi link myTodos Todo endfu autocmd bufenter * :call SetMyTodos() autocmd filetype * :call ...
Maxim Kim's user avatar
  • 13.6k
3 votes

Why is % part of a word?

For the purposes of w/b "word" movement, vi/vim classifies characters into not two but three classes: "word" (alphanumeric plus iskeyword), "white space", and "...
Martin Kealey's user avatar
3 votes
Accepted

Sourcing (a very tiny) vimrc changes iskeyword

The effect you're seeing is due to the set nocompatible command resetting many other options, 'iskeyword' included. From :help 'nocompatible': This is a special kind of option, because when it's set ...
filbranden's user avatar
  • 29k
2 votes
Accepted

How to treat underscores as whitespace when skipping to the next word?

Plugins vim-wordmotion or camelcasemotion I do not know how vim can be configured to do this out of the box. There is a related wikipage: https://vim.fandom.com/wiki/Moving_through_camel_case_words ...
Hotschke's user avatar
  • 4,790
2 votes

Syntax of keys on keyboard in documentation

:help key-notation shows a complete list of all special keys.
Naumann's user avatar
  • 2,759
2 votes
Accepted

Syntax of keys on keyboard in documentation

From :help <s- <S-...> shift-key *shift* *<S-* <C-...> control-key *control* *ctrl* *<C-* Thus, S- refers to the holding the shift key while pressing ...
Mass's user avatar
  • 14.2k
2 votes

Is there a conflict between `syntax enable` and custom keywords?

The only explanation I have, is that there is another syntax enable (or syntax on) somewhere. Background: If syntax enable is executed and syntax was enabled before, all syntax items are cleared. See ...
Ralf's user avatar
  • 9,287
2 votes

Is there a simple way to remove a single keyword from a syntax group (or otherwise override it in a match)?

Here's a solution using a different technique to the two you suggested: syntax match lambda /\_.\<fn\>/ containedin=ALL syntax match lam /f/ containedin=lambda contained conceal cchar=λ syntax ...
Rich's user avatar
  • 32.2k
2 votes
Accepted

Why does iskeyword contain colon for TeX files? And where is it set?

You can check what plugin or script is changing the value by using the following command: :verbose set isk?
Christian Brabandt's user avatar
2 votes
Accepted

Use Word for `*`/`#`

* is roughly equivalent to searching for the string: '\<' . escape(expand('<cword>'), '/.*~[^$\') . '\>' (the escape is slightly different for #). So, one option is to create a custom ...
Mass's user avatar
  • 14.2k
1 vote

How to have w,e,b-based motions handle underscores without using iskeyword?

Right before submitting this question I dove into a rabbit hole and emerged with a solution mentioned in this post: https://vi.stackexchange.com/a/677/31358 The provided answer was to install this ...
jwav's user avatar
  • 121
1 vote

Is there a simple way to remove a single keyword from a syntax group (or otherwise override it in a match)?

Here's a completely different, arguably even more hacky, but much simpler solution: syntax keyword lam fn conceal cchar=λ containedin=ALL nextgroup=bda execute "syntax match bda ' ' conceal cchar=\...
Rich's user avatar
  • 32.2k
1 vote
Accepted

\<C-v> character in vim

The problem are the single-quotes you are using. Single quotes enclose "literal-strings", in these strings, the backslash is not a escape character, but just a backslash. You could use double-quotes ...
Ralf's user avatar
  • 9,287
1 vote

folding in matlab

This answer is not complete, but might help: The coolword in start="coolword" apparently cannot be a keyword to ommit this use the matchgroup ability, to mark the start word as a certain group. The ...
Thorbjørn E. K. Christensen's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible