Questions tagged [delimiter-matching]
The delimiter-matching tag has no usage guidance.
40
questions
0
votes
2
answers
74
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 ...
0
votes
0
answers
17
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 ...
3
votes
2
answers
42
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
...
1
vote
1
answer
41
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 ...
1
vote
2
answers
35
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 ...
1
vote
3
answers
96
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
2
answers
138
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 ...
1
vote
0
answers
160
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::...
-1
votes
1
answer
28
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
....
3
votes
1
answer
183
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
1
answer
232
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
2
answers
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
1
answer
264
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
1
answer
175
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
3
answers
330
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
1
answer
132
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&...
4
votes
1
answer
265
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 ([{ (...
0
votes
2
answers
598
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 ...
9
votes
1
answer
285
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> ...
2
votes
0
answers
481
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 ...
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 ...
3
votes
3
answers
449
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
1
answer
830
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
1
answer
219
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 ...
1
vote
0
answers
323
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
1
answer
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
1
answer
157
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
1
answer
877
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 ...
13
votes
7
answers
8k
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 ...
7
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 ...
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={'`': "'", '"': '"', '{': '}', '''':...
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 '...
0
votes
1
answer
386
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
1
answer
305
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
3
answers
637
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
2
answers
375
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
2
answers
264
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 ...
69
votes
4
answers
23k
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
2
answers
503
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
1
answer
189
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 ...