Questions tagged [delimiter-matching]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
63 views

\zs not working in syntax file?

Udated 2023-09-11: Changed example to asterisk as it is simpler and the question now refers to \zs instead of \ze as \zs seems to be the issue. I am trying to adapt the VIM Markdown syntax file so ...
StaticNoiseLog's user avatar
2 votes
0 answers
80 views

Move cursor to matching goto/jump/label

Goto/label statement pairs are available in C++, Visual Basic, JavaScript, Fortran, and other languages, too. The unique word or number allows goto to find the associated label. How can I help vim ...
Micah Lindstrom's user avatar
0 votes
2 answers
93 views

Searching with "/" with line limits: Is it possible to specify relative line numbers?

Vim has the very good feature to limit the range for searching to start at from-line up to end searching at end-line, e.g.: /\%>1114l\%<1116lPATTERN I would like to set the cursor to line 1115 ...
Anton Wessel's user avatar
0 votes
0 answers
27 views

% match won't jump over -> in PHP

I've noticed that when editing a PHP file (.php) and positioning the cursor after an unmatched opening < bracket and before -> and a different opening bracket e.g. (, the % motion jumps to the ...
egst's user avatar
  • 101
3 votes
2 answers
76 views

is there something like `%` but for matching double quotes

I'm working on some HTML files that are formatted weirdly. Each individual class is on a separate line which makes the file (imo) difficult to read. Something like: <div class=" classA ...
Enermis's user avatar
  • 161
1 vote
1 answer
47 views

add quotes to each string and change the delimiter for a comma

I have this string: private | public-read | public-read-write | authenticated-read | aws-exec-read | bucket-owner-read | bucket-owner-full-control I would like to find a mnemonic or easy pattern that ...
nbari's user avatar
  • 131
1 vote
2 answers
40 views

Jumping to open paren with % doesn't work when open paren followed by $ and cursor is in method call experssion

Neovim .6.1 Got this line: add_post_meta($this->cmr_id, 'intro_paragraph', 'Hello'); With: add_post_meta($this->cmr_id, 'intro_paragraph', 'Hello'); ^ cursor ...
StevieD's user avatar
  • 1,417
1 vote
3 answers
98 views

Remove look ahead behaviour on match brackets (%)

If your cursor is on top of a "{", pressing % will send it to its matching "}". I like that behaviour. However, if your cursor is behind a "{", pressing % will "look ...
Luiz Martins's user avatar
2 votes
2 answers
161 views

Divide a line with curly braces that contains curly braces

The input line contains pairs of curly brace and in each pair of curly braces there might also be curly braces in the contents. Multiple layers of curly braces may also happen. Here's some example ...
Ken.H's user avatar
  • 25
1 vote
0 answers
189 views

Jumping to matching angle brackets in heavily templated C++ code

By heavily templated I mean it's easy to have something like this, which is a trivial example I made up: #include <type_traits> class a {}; bool operator<(a,a) { return true; }; bool b = std::...
Enlico's user avatar
  • 2,172
-1 votes
1 answer
31 views

How to use vi to batch match characters and paste after the matched characters

I want to use vi to quickly edit text. there is the format on lines m to n of the file. .lut_da_25, .abc_we23, ... .yy_ewe, I want to edit the above lines to the following ....
Self-Motivated Wu's user avatar
3 votes
1 answer
196 views

Rules for 2-tier recursive syntaxes

I have matched parentheses, but highlighting failed as it transcends up the recursion stack. I just need to know if there is a solution to tracking pairs of delimiters during Vim highlight syntax of ...
John Greene's user avatar
1 vote
1 answer
346 views

How to match each occurrence per line?

I have similar text on more lines: _AB_ _ABC_ _ OR _ _A_ _ABC_ I need to replace only the underscores that delimit some text. So I need: =AB= =ABC= _ OR _ =A= =ABC= How to match each pattern?
Pasquale Simonetti's user avatar
1 vote
2 answers
3k views

How to match braces or brackets?

Suppose I want to search for things like \todo{English sentence} Then the regex \\todo{\_.\{-}} works (I don't know why. I copied it from somewhere long time ago (embarrassed)). But suppose I ...
caffeinemachine's user avatar
0 votes
1 answer
288 views

Enable %-key jumping/highlighting for backticks (`) and single-quotes (') in M4 files

Background When working on .c and .h files, I have a couple options turned on, namely: filetype plugin on filetype indent on autocmd BufEnter *.c setlocal tabstop=8 shiftwidth=8 softtabstop=8 ...
Cloud's user avatar
  • 223
3 votes
1 answer
195 views

Changing the color of delimited text

I am editing text of the form first line second line \note{ first line second line } I have to leave intact the text that's delimited by curly brackets and edit the text that's not delimited. But ...
Leo Simon's user avatar
  • 715
5 votes
3 answers
344 views

Highlighting after a line limit

I'd like to highlight sections of a document which are too long (measured in lines) so they will all print on a physical page. Sections are separated with ===. I tried to do it with this code: ...
Zachary Vance's user avatar
0 votes
1 answer
138 views

How do you sort lines by longest substring to shortest substring?

Here are some sample strings, sorted by longest string to shortest sting: "Bi(NO<sub>3</sub>)<sub>3</sub>·5H<sub>2</sub>O","bismuth nitrate pentahydrate"); "Be(C&...
Anon's user avatar
  • 865
4 votes
1 answer
277 views

How can I stop [Neo]Vim from tracking parens in certain situations?

Whenever I have to do things like this: closeparens = ")]}" or /[)\]}]/ it messes up the parenthesis tracking of the whole file. I could mitigate this with comments: # complement to ([{ (...
phicr's user avatar
  • 693
0 votes
2 answers
618 views

DelimitMate Plugin: How can I specify my own delimiters? Also, can I jump the cursor to the end of the generated right-delims with an insert-mode map?

Two questions related to the DelimitMate plugin here: How can I modify the set of auto-generated left and right delimiters? For example, in LaTeX it would be convenient to have $ as left-right ...
Luke Davis's user avatar
  • 1,397
9 votes
1 answer
290 views

How to make matchpairs not match closing '>' in "<(>)" while still matching it in "<()>"?

I'm using set matchpairs+=<:> with my C++ code, and it works great. But there are some cases where it is not quite there, like this C++ code: #include <type_traits> template<int X> ...
Ruslan's user avatar
  • 475
2 votes
0 answers
490 views

DelimitMate plugin for vim not working

I am new to vim, so I installed the plugin DelimitMate to my vim. But it is not working in my vim -version 7.4.1689.My plugin manager in pathogen.I searched on everywhere to solve this problem but ...
Shivam's user avatar
  • 21
6 votes
1 answer
3k views

How to select the content within brackets including brackets and without including brackets?

I have some code structure e.g { { // Some content goes here } [ // Some content goes here ] } I want to select the content inside { } in some case and also content inside with ...
WitVault's user avatar
  • 1,679
3 votes
3 answers
458 views

How move cursore "past the first paired delimiter" (quote, parentheses, etc) - searchpair()?

What is the best way to bind key, to go "past the last delimiter. I want to bind, for example <leader>, to behave like this: "foo bar| baz" -> key press -> "foo bar baz",| (arg1, arg2, |arg3) ->...
sheikh_anton's user avatar
0 votes
1 answer
832 views

Substitute words enclosed between comma or open-parenthesis and comma or closed parenthesis

I have lines like the following ones (actually function prototypes) void () word ( word, another word, one_more word, ..., hello, ... ) one argument ( only ) I want to match each single argument and ...
Enlico's user avatar
  • 2,172
2 votes
1 answer
224 views

with matchit installed %match parenthesis and brackets only once in Fortran files

At the moment I'm writing, I removed the matchit plugin and the % works well, making the cursor jump from a (, [, or { to the corresponding closing character and vice versa. Now I installed matchit ...
Enlico's user avatar
  • 2,172
1 vote
0 answers
329 views

Matchit Plugin: issues when resetting regular expressions in "b:match_words" for detecting Matlab file keywords

I'm trying to implement a custom regexp string to be used by matchit.vim for identifying matching keywords that can be jumped between with %. I found a utility from FileExchange (in the ftplugin ...
Luke Davis's user avatar
  • 1,397
13 votes
1 answer
3k views

How can I highlight matching "%" names (e.g. if/end, for/end) defined by matchit.vim on selection?

Update 2020-07-17: Now I would recommend using the vim-matchup plugin. When matching pair highlighting is turned on, vim-matchup also highlights matching keywords like if/else/endif or while/continue/...
Luke Davis's user avatar
  • 1,397
4 votes
1 answer
159 views

Start of match \zs seems to break my pattern

I am playing around with vim syntax, matching expressions like name.subname regardless of their layout. Here is a match pattern I came upon which does exactly what I want: Now, I wish that subname ...
iago-lito's user avatar
  • 1,102
2 votes
1 answer
903 views

Make Vim highlight the match for the paren *before* the cursor

I've had a look at :h matchparen, and it doesn't seem to have an option for highlighting the match for the parenthesis immediately before the cursor. In short, this is what I want: Matchparen should ...
Brian McCutchon's user avatar
13 votes
7 answers
9k views

How to search for lines matching current line in vim

I usually search for words by :/string, but if I have to search entire current line, how to do that. event: 1 beacon: 0x02 //line 1 event: 19 beacon: 0x02 //line 2 event: 1 ...
manav m-n's user avatar
  • 155
8 votes
3 answers
3k views

matchpairs makes vim slow

I use set matchpairs+=<:> in my config (to help when editing HTML, for instance), but I just noticed it made vim very slow when editing emails. Is there a way to have this setting without ...
a3nm's user avatar
  • 425
2 votes
0 answers
61 views

Getting delimitMate to yield tex-quotes

Typing ` with delimitMate gives ``. But in tex files, it should produce `' . Can it be told to do so? PS. I found that this is easy with AutoPairs: let g:AutoPairs={'`': "'", '"': '"', '{': '}', '''':...
Toothrot's user avatar
  • 3,119
2 votes
1 answer
59 views

Distinguish between patterns that are inside open delimters and those that are not

I'm not sure of the right language here, but I need to modify all occurrences of a pattern (specifically &) that occur inside a pair of delimiters while leaving unmodified the pattern if it is '...
Leo Simon's user avatar
  • 715
0 votes
1 answer
421 views

Match a pattern within matching delimiters

I'm trying to match a pattern only when it occurs between matching delimiters For example, in the lines below, I'd like to match the a in the first line, but not the a in the second, which is not ...
Leo Simon's user avatar
  • 715
1 vote
1 answer
336 views

Globally replace text contained in curly braces

Unfortunately, I have to convert code created by mathtype into real latex code. My converted creates hideous expressions like \textstyleMTConvertedEquation{{\textbackslash}[\{X\_k\} {\...
Leo Simon's user avatar
  • 715
7 votes
3 answers
679 views

Make % jump between identical delimiters

I use Vim to edit LaTeX files frequently. I want to use % to jump between matching $ which can be used to delimit where mathematical expressions are written. I have tried using matchit and, ...
fuzzybear3965's user avatar
3 votes
2 answers
394 views

How do I search for line containing an unclosed parenthesis?

How to search for line containing unclosed parenthesis. /([^)]*$ works only for non-nested parenthesis. If the closing parenthesis is present in the next lines, it should still be a match. for ...
Mathieu Westphal's user avatar
14 votes
2 answers
265 views

Automatically add a closing " or ' when inserting one, but only if the cursor isn't inside a string already

I've defined mappings in my vimrc to automatically enter close parentheses and braces when I enter opening ones with inoremap ( ()<esc>i. I'd like to do the same for " and ', but only when the ...
rlms's user avatar
  • 305
68 votes
4 answers
24k views

How to jump between matching HTML/XML tags?

How to jump between matching tags (such as <div>, <span>, etc.) when editing HTML/XHTML/XML documents similarly as % is used to jump between matching parentheses?
kenorb's user avatar
  • 18.2k
8 votes
2 answers
520 views

Automatically delete closing pair without causing unbalanced pairs

I am writing a VimL function that, in insert mode, allows a <BS> through the opening part of a pair ([, {, etc.) to delete the closing part of the pair if it is the next character after the ...
user avatar
9 votes
1 answer
204 views

Can I force parentheses matching to show up across multiple windows?

I have a source file containing a long list of deeply nested heterogenous structures. Since the structures are long, I would like to: Use the :split command to split the screen into two. Scroll down ...
John Sonderson's user avatar