New answers tagged

1 vote

How to clear the uppercase registers?

My understanding is that the lowercase register and the lowercase one are actually the same. When you yank using the lowercase version you replace the content of the register. When you yank using the ...
3 votes
Accepted

How can I copy the whole number under the cursor?

/\d\+ searches for one or more digits, as many as possible. N repeats the search in the opposite direction because / moved the cursor to the next match. ygn yanks the current match of the previous ...
  • 36k
2 votes

How can I copy the whole number under the cursor?

If you consider installing plug-ins for this purpose, look into: https://github.com/MisanthropicBit/vim-numbers Or: https://github.com/tkhren/vim-textobj-numeral Both of them add a in text object ...
  • 27.3k
0 votes
Accepted

`Cmd+V`/`Ctrl+V` pasting has an extra new line

If you use the line mode selection (V) the yank (y) operation will yank the carriage return at the end of the line. If you don't want the carriage return at end of the last line you have to use the ...
2 votes

Copy a word and paste the same word at multiple places in Vim

As of current vim (since 2022-05-06) you can use P in visual mode to paste over a selection without overriding unnamed register (:h v_P): With |p| the previously selected text is put in the unnamed ...
  • 12k

Top 50 recent answers are included