Questions tagged [delimiter-matching]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
3answers
72 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 ...
2
votes
2answers
67 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 ...
0
votes
0answers
63 views

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

By heavily templated I just mean it's easy to have something like this, which is just a trivial example I just made up: #include <type_traits> class a {}; bool operator<(a,a) { return true; };...
-1
votes
1answer
25 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 ....
2
votes
1answer
94 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 ...
1
vote
1answer
104 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?
1
vote
2answers
2k 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 ...
0
votes
1answer
171 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 ...
3
votes
1answer
128 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 ...
5
votes
3answers
313 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: ...
0
votes
1answer
123 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&...
3
votes
1answer
204 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 ([{ (this is not ...
0
votes
2answers
515 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 ...
8
votes
1answer
251 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> ...
1
vote
0answers
353 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 ...
4
votes
1answer
1k 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 ...
3
votes
3answers
383 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) ->...
0
votes
1answer
810 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 ...
2
votes
1answer
202 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 ...
0
votes
0answers
297 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 ...
10
votes
1answer
2k views

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

Currently my Vim highlights matching parentheses, brackets, quotes, etc. with Cyan background and white foreground -- the cursor can be moved between these with %. Thanks to my matchit.vim, I can also ...
4
votes
1answer
153 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 ...
2
votes
1answer
774 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 ...
11
votes
7answers
6k 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 ...
6
votes
3answers
2k 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 ...
1
vote
0answers
56 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={'`': "'", '"': '"', '{': '}', '''':...
2
votes
1answer
58 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 '...
0
votes
1answer
294 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 ...
1
vote
1answer
241 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\} {\...
7
votes
3answers
480 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, ...
3
votes
2answers
328 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 ...
14
votes
2answers
260 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 ...
66
votes
4answers
19k 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?
8
votes
2answers
395 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 ...
9
votes
1answer
166 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 ...