Questions tagged [replace]

Overwriting text with the r or R commands. For search-and-replace operations, use the [substitute] tag.

11 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
36 views

Substitute regex group in prompt when replace with confirmation

I am using vim to replace with simple regex: %s/Foo\(.\)/Bar\1Biz/gc I wanna to confirm each occurence and Vim asks: replace with Bar\1Biz (y/n/a/q/l/^E/^Y)? Is it possible to substitute group (\1) ...
Deffe's user avatar
  • 21
1 vote
0 answers
18 views

How to swap every two words in the whole text?

I have such codes: int flag1 = GetWidget(widget); flag1.append(widget); delete widget; I'm willing to swap every flag1 and widget in the whole text, i.e.: int widget = GetWidget(flag1); widget.append(...
Mactarvish's user avatar
1 vote
0 answers
55 views

:noesckeys in vim.basic giving anomalous behavior in ubuntu 20.04

As reported in this post, I've upgraded to ubuntu 20.04, and am seeing anomalous behavior in vim.basic In addition to the one reported there, I'm now having problems with the noesckeys setting. My ...
Leo Simon's user avatar
  • 715
1 vote
0 answers
34 views

Change a word with a N repating characters where N = word length

I have some code that I want to 'censor'. For example, I have secret token in a source code 1f85ez and I want to replace it with xxxxxx Now I do it with viwrx command. Is there way to make such a ...
Sergеу Isupov's user avatar
1 vote
0 answers
44 views

change ofWord to of Word, and ignore offer, office, off etc

I OCRed a document but has this problem: some spaces between "of" and the word after are gone and I need to add a space between "of" and "word". Is there any way to do it? And also to avoid adding ...
Zheng's user avatar
  • 133
1 vote
0 answers
39 views

substitute a join for a character that ends a line

when pasting from a pdf document, words in the original document are being split up, and replaced by a - and a line break. For example: alternative specifications. In con- clusion, these findings ...
Leo Simon's user avatar
  • 715
1 vote
0 answers
1k views

Enter insert to insert mode from function

I want to create function that search for selection and then automatically replace selection with given text. Something like *Ncgn but with custom movement (not exactly word only). My current ...
Hauleth's user avatar
  • 217
0 votes
3 answers
231 views

How to replace hex encoded string with chars?

I have UTF-8 encoded HTML with id(s) and href(s) encoded as hex values like %D0%B0%D0%B1 or .D0.B0.D0.B1. Can I convert such strings into readable form using Vim?
hobo-mts's user avatar
  • 123
0 votes
3 answers
50 views

Strange result for grouping replace in a line

The file contains only one line: four_blank_space + "TE:" + one blank space + "trailers" + one blank space I write a grouping replace: :1s/\(\s\+\)\(.\+\):\s\+\(.\{-}\)\(\s\{0,}\)...
showkey's user avatar
  • 1,120
0 votes
0 answers
215 views

Adding new line characters after a specific amount of bytes

I'd like to add new line characters after every specific number of bytes in binary mode. I tried this script but the repetition count depends on the number of characters not bytes. Like when there is ...
kirin's user avatar
  • 101
-1 votes
1 answer
260 views

Replace in a loop

I have a buffer that contains this sentence : I go to a rendez-vous this evening. and I have this function : function MyFunction() let myList = ["rendez-vous"] let myFile = readfile(bufname(1)) ...
Arsene Asedrith's user avatar