Skip to main content
Planned maintenance impacting Stack Overflow and all Stack Exchange sites is scheduled for Monday, September 16, 2024, 5:00 PM-10:00 PM EDT (Monday, September 16, 21:00 UTC- Tuesday, September 17, 2:00 UTC). The email/password authentication method will be unavailable for logging in and registering. Read more here
4 votes
Accepted

Is there a Vim plugin for testing VimScript patterns?

There is a very simple way, for which you do not need any plugin. Open a file with some content, turn on :set incsearch and/or :set hlsearch and try it out interactively with Vim. That's how you learn ...
Christian Brabandt's user avatar
4 votes

Prevent jumping when pattern matching

This will do for the * search, I'm not sure how to do that for /. nnoremap <silent> * :let @/= '\<' . expand('<cword>') . '\>' <bar> set hls <cr> @/ is the search ...
Biggybi's user avatar
  • 2,780
4 votes
Accepted

What is the shortest search pattern that matches nowhere?

You've gotten a better answer in the comments, but for curiosity's sake, note that unless you add atoms specifically to avoid this, patterns will generally only match in a single line. So there are a ...
Rich's user avatar
  • 32.4k
2 votes
Accepted

Can you get a count on a search where the count is > 1000 matches?

You can use the :s[ubstitute] command's n flag. As described under :h count-items: To count how often any pattern occurs in the current buffer use the substitute command and add the 'n' flag to avoid ...
B Layer's user avatar
  • 20k
2 votes

"wildignore" and "\{n,m}" type patterns

There are two issues here. First, 'wildignore' takes a list of separate patterns, split by comma, so you actually need to escape the comma with a backslash for it to work inside the \\\{n,m\} pattern ...
filbranden's user avatar
  • 29.6k
2 votes
Accepted

What is the pattern matched against for events CmdwinLeave and CmdwinEnter?

Those things are easy to test with :help <amatch>: autocmd! CmdWinLeave * echomsg expand('<amatch>') Where you use a wildcard to catch every possible case and echo <amatch> in the ...
romainl's user avatar
  • 41.8k
2 votes
Accepted

How to escape commas in au patterns and comma separated lists?

For comma in file pattern you have to escape with \,. au BufEnter *\,*.txt echo 'this file has a comma in its name' More information with :help file-pattern: The pattern is interpreted like mostly ...
Vivian De Smedt's user avatar
1 vote

Usage of pattern for ilist command

While :help :ilist can be used to print lines matching a given pattern, it is not really designed for that. Combining :help :global and one of :help :list, :help :print, :help :number, :help :#, and :...
romainl's user avatar
  • 41.8k
1 vote

Is there a Vim plugin for testing VimScript patterns?

The trace provide you a preview of the substitution and privide a good help to learn regular expression patterns. If you are using Neovim you could also be interested by hypersonic
Vivian De Smedt's user avatar
1 vote
Accepted

How to match latin letters + their accented versions?

I've discovered the \k character class, which matches anything that is in 'iskeyword', which can in turn be set iskeyword=@, where the meaning of @ is explained at isfname: If the character is '@', ...
Enlico's user avatar
  • 2,256
1 vote

What is the pattern matched against for events CmdwinLeave and CmdwinEnter?

The documentation makes this clear I believe: :h CmdwinLeave mentions this: <afile> is set to a single character, indicating the type of command-line. |cmdwin-char| (same for :h CmdwinEnter) ...
Christian Brabandt's user avatar
1 vote
Accepted

What pattern should I use for word-like movement?

First, we must understand how exactly vim implements the w command. To start with, vim assigns every character a "class," where numerically: blank = 0, punctuation = 1, word = 2, emoji = 3, ...
Mass's user avatar
  • 14.2k

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