Tagged Questions
1
vote
1answer
37 views
Replaced matched text in Vim with pattern
Here's a minimal example of what I'm trying to do. Start with:
"this")
"that")
[hundreds of lines like this]
End with:
"this",&this;)
"that",&that;)
[hundreds of lines like this]
I have gotten this ...
2
votes
3answers
191 views
How to reverse-match a string in the Vim programming language?
I want to find the last index of any character in the [abc] set in the abcabc string but the search should start from the end of the string:
" Returns the 0th index but I want the 5th.
let ...
4
votes
1answer
99 views
vim: how do I set :match and :2match search results to different colors?
For example, I want something along the lines of:
:match search /<div/ guib=Green
:match search /<\/div>/ guibf=Blue
only that doesn't work.
4
votes
1answer
420 views
How can I search for and highlight multiple strings in VIM?
In VIM, how can I search for multiple strings and have a different color highlight for each match?
5
votes
1answer
287 views
Conditional search and replace on a line in vim?
Let' say I want to comment and uncomment a line.
I know I can
:s!^!//!
and then
:s!^//!!
Now what if I want this as an one-liner?
Basically, if a line starts with // then remove it, else add ...
2
votes
1answer
83 views
How to limit a search to the current line
VIM newbie here.
I'm trying to write a mapping that will let me move around 'common' insertion points in a line when in insert mode. For ex. I have the delimitMate plugin - so typing a opening ...
5
votes
4answers
1k views
Vim :s replace first N < g occurrences on a line
In vim, I sometimes have occasion to replace the first few occurrences of a match on a line, but not every one like g would. e.g.:
a a a a a
to
b b b a a
I know I could use ...
7
votes
1answer
183 views
Case-preserving search and replace in vim?
In vim, I know I can search with or without case sensitivity. But if I want to search for a string in either upper or lower case, and replace it with a replacement of the same case, is that possible ...
1
vote
3answers
226 views
vim/emacs plugin to view recursive grep search search results?
Suppose I have a file formatted like this:
file1:123
file2:4444
some/other/file:2233
This represents the search results from a grep (i.e. file:line-number).
I'd like to have a vim plugin which ...
6
votes
4answers
454 views
vim search around line breaks
When I am editing a LaTeX document in vim, often times I want to search for a phrase. Because I have LaTeX setup to wrap lines, sometimes half of the phrase will be on one line while the other half ...