Questions tagged [pattern]
The pattern tag has no usage guidance.
13
questions
0
votes
0
answers
12
views
Vim Autocommand pattern to match rspec.rb files?
I am trying to trigger rspec each time I save a file, but none of the patterns I gave trigger the command. What did I do wrong?
I am using the vim-rspec and dispatch.vim. The rspec commands run fine, ...
1
vote
2
answers
150
views
Is there a Vim plugin for testing VimScript patterns?
I'm new to VimScript and trying to learn how to construct patterns.
Is there a Vim plugin like RegExr.com for testing patterns?
1
vote
0
answers
36
views
Interaction between zero-width matchers and backreferences
Take a file with the following text as a workbench.
hello world hello world
With the cursor at the beginning of the line, here's how \1 interacts with \(…\), \@=, and \@!
#
regex
matched text
text ...
1
vote
1
answer
89
views
Negate pattern in autocmd
I have some lua auto command that triggers whenever I open a file that has */some_pattern/* in the path.
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
pattern = vim.fn.expand('~') .. '*/...
0
votes
1
answer
49
views
What is the shortest search pattern that matches nowhere?
This is mostly a curiosity-driven question.
I can't think of anything shorter than x\@=y, which tries to match x and y at the same position. A slightly longer, but probably more self-explaining ...
2
votes
1
answer
63
views
How to match latin letters + their accented versions?
\a is equivalent to [A-Za-z] so it matches only non-accented letters.
I know of [=name-of-equivalence-class=], so I can clearly use something like \(\a\|[[=a=][=e=][=i=][=o=][=u=]]\), but I was ...
0
votes
1
answer
87
views
Specifying filetype in ModeChanged event autocmd
I'm using stylua as the code formatter for lua files.
I do not usually get used to its formatting style but sometimes I do need a little help with it, so I decided to make it the formatprg during the ...
1
vote
1
answer
41
views
How to escape commas in au patterns and comma separated lists?
How do you specify a comma literal in the kinds of comma separated lists that are ubiquitous in vim configuration?
The first example I can think of off the top of my head is in autocmds:
au! BufRead,...
3
votes
2
answers
98
views
What is the pattern matched against for events CmdwinLeave and CmdwinEnter?
More in general I'm always in doubt about what's the meaning of the {aupat} argument of autocmd for a given {event}.
From :help :autocmd I read (my emphasis)
Add {cmd} to the list of commands that ...
1
vote
1
answer
93
views
What pattern should I use for word-like movement?
Given a line of text like the following
let FindTargetsByRegexp = { re -> {lnums -> s:_FindTargetsByRegexp(re, lnums) }}
I want the expression
\(\n\|[^A-Za-z]\)\zs\S
to stop on the same word ...
1
vote
1
answer
70
views
Can you get a count on a search where the count is > 1000 matches?
I have a file listing all the books I have read since 2013. I told someone I read x books a week and they didn't believe me so I started doing it :)
The data looks like this. The last column is the ...
4
votes
1
answer
71
views
"wildignore" and "\{n,m}" type patterns
The :help entry for "wildignore" directs me to the following list of file patterns under *autocmd-patterns*:
The pattern is interpreted like mostly used in file names:
* matches any ...
3
votes
1
answer
180
views
Prevent jumping when pattern matching
Is there a way to prevent cursor to search forward when using the * or /?
I just want to highlight the word I am on & others, but not move to forward nor backward.