Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
3 answers
342 views

How to print yanked data in replace mode?

I want to paste data from clipboard. But instead of insert the data, I want to overwrite (like using R).
Andy A.'s user avatar
  • 233
3 votes
1 answer
49 views

Need a functionality behaving like Replace on text but for Pasting Blocks

One of my vim usages is to do sketches of topologies in networking I've found the script Draw it really really useful for that So I can draw things like this by pasting these boxes +------+ |ROUTER| ...
freddie_ventura's user avatar
1 vote
1 answer
153 views

How to switch the order in which objects appear

I have a custom command in a TeX file which takes two inputs A and B, let's call it \operation{A}{B}. I want to find all of the instances of \operation where the first entry A starts with the string ...
Zim's user avatar
  • 197
3 votes
1 answer
3k views

Date change question: Find and replace with wildcards?

I have a file with a bunch of dates of the form a/b/c, where a,b, and c are numbers of varying character length. However, I'd like to change every instance to read c/a/b. I'm wondering if there is a ...
Zim's user avatar
  • 197
0 votes
1 answer
71 views

Can I select and paste with a single operation?

Here's my use case. I have the following text: This is a [hyperlink](http://someurl.com). Now I want to replace the http://someurl.com text with a new URL in the default register (something I've ...
Dave Kerr's user avatar
  • 115
1 vote
3 answers
213 views

Copy a line, comment it and replace a word in copied line

Libraries evolve all the time and I often face the situation where after an update some function name have changed and they return errors in the updated version of the library. It's easy to replace ...
calocedrus's user avatar
6 votes
1 answer
329 views

Why copying from named register cannot be repeated using dot operator?

I am copying a word with: viwy (visual, inner, word, yank) Now I would like to replace some other word: viwp. This works only once, because each word is replaced by the last removed word. Ok, so I ...
charlie_pl's user avatar
2 votes
1 answer
214 views

How can I define an operator that takes a register as an argument?

I'm trying to write a "Paste-over" operator. It will work like a combination of p and R, so it will paste the contents of a register over the text currently in the buffer. I have this so far: ...
DJMcMayhem's user avatar
  • 17.9k
8 votes
2 answers
1k views

How do I paste the same line of code X times but change one word in the line each time?

I'm writing HTML lists, and I want to be able to automagically paste 10 list items where the item text is the only thing that changes. I could accomplish this using PHP and then just copying the ...
Azmodeus's user avatar
12 votes
6 answers
8k views

How to copy first four characters of every line to the end of that same line?

Given a series of lines that look similar to this: 2001 "Some Kind of Title," Author's Name, Publication Name, 1 Mar. 2002 "Some Kind of Title," Author's Name, Publication Name, 12 Oct. 2003 "Some ...
mix's user avatar
  • 223
9 votes
1 answer
5k views

How can I replace a word with a yanked word in Vi?

Lately I've found myself working more and more with remote servers over SSH. Most of those severs don't have Vim, but just Vi. Using it hasn't been too rough with just a few problems. One is this: ...
Robin's user avatar
  • 905
34 votes
5 answers
4k views

How to replace a word with a yanked word in normal mode?

When I have to replace a word with another word I yank before, I usually use a workflow which seems unnatural to me: Let's say I have this text: foo bar buzz And I want to yank foo and replace bar ...
statox's user avatar
  • 50.5k
10 votes
2 answers
1k views

Most efficient way to replace the entire buffer?

Currently, I have two similar methods to replace the entire buffer with some other text (say in clipboard). Method #1: delete all lines: :%d. paste text: "+P ( or similar: :put+). Method #2: ...
Naitree's user avatar
  • 383