Questions tagged [visual-block]

Visual block mode enables users to copy and paste rectangular text. This mode is useful whenever a particular text is pasted to be pasted in every part of a rectangular text.

Filter by
Sorted by
Tagged with
6 votes
3 answers
3k views

Add a block of text to end of lines

Not sure if this one is possible, but say I have a file with two blocks of text, in this case English words and their French translations. eg: vivre aimer étudier to live to like to study Now I ...
port5432's user avatar
  • 175
16 votes
1 answer
1k views

Paste visual block selection on its own lines [duplicate]

I'm not really sure how to describe what I'd like to do. Basically I'd like to use visual block mode to select a region of text and then paste it "as a collection of lines" rather than as a rectangle. ...
Greg Nisbet's user avatar
  • 1,755
7 votes
1 answer
3k views

vmap and visual block: how do I write a function to operate once for the entire block?

I'm trying to write a simple function that wraps a visual selection of lines with Markdown ``` lines. Here's what I currently have: function! MarkCodeBlock() " Add Markdown code-block delimiters ...
Steve Hollasch's user avatar
12 votes
2 answers
1k views

How to paste visual block starting with another line

It took me very long time to realize that putting (pasting) something with p or P which visual-block selects with ctrl+v and yanked (copied) with y, preserves the manner before, so that, when the ...
Violapterin's user avatar
11 votes
3 answers
2k views

Visual Block Mode edit with sequential number [duplicate]

Suppose I'd like to create a list - "1" - "2" - "3" what Is the smartest way to create such? My attempt would be to i- "1"ESCyypp to get - "1" - "1" - "1" and then jump to the second line's 1 ...
Joel's user avatar
  • 213
10 votes
2 answers
9k views

Is there a command to enter Visual Block mode?

I've set up a bunch of key mappings that would cause many Vim users to cringe. Now I am unable to get into Visual Block mode using Ctrl-V (Ctrl-Q isn't mapped, but it doesn't work). Is there any ...
Dan's user avatar
  • 445
8 votes
3 answers
7k views

Visual Block Mode: How to insert text to multiple lines after line ending?

Below example, first line is shorter than the other lines. I want to insert \ to all lines at the highlighted place. If I press CtrlC, jjj(select all lines) , Shifti, \, only first line changed. How ...
Fisher's user avatar
  • 1,022
6 votes
3 answers
1k views

Insert a text selected via visual block

I'm facing a behavior that I find unatural when trying to paste a block of text selected with visual block mode (<C-v>): I can't insert it between two lines without messing with the already ...
statox's user avatar
  • 48.5k
5 votes
3 answers
192 views

Insert non-rectangular selection

I repeatedly have the following situation, and wonder how it can be handled better than I do it now. These lines must be merged /path;text /path;text /path;text with these: /subdir /longsubdir /...
atann's user avatar
  • 51
5 votes
4 answers
3k views

How do you change the last n characters for a range of lines?

Generally you can select a visual block for the first n characters of a range of lines, and just press c, insert characters, and press Esc to have it apply to all. However, this method is rarely ...
Anon's user avatar
  • 835
5 votes
1 answer
1k views

Visual block editing: map i

How to map i to start editing on visual block mode? I want the same behavior for <shift>-i and i.
adelarsq's user avatar
  • 584
1 vote
1 answer
2k views

How to paste a text block in visual block mode?

I want to paste text which spans across multiple lines and is rectangular. For example, a rectangular box representing a device topology diagram. +-------+ | | | | ...
SibiCoder's user avatar
  • 3,222
0 votes
1 answer
481 views

How can I make backspace work in visual block mode?

I hit Ctrl-v3jShift-ixEscape, and x is correctly inserted on the current line and in the 3 lines below it in the same column. Good. I hit Ctrl-v3jShift-iBackspaceEscape a character is deleted only on ...
Enlico's user avatar
  • 2,056
0 votes
1 answer
30 views

Understanding interaction between visual, autoindent, and paste option

Let's start form this faulty C++ source file #include <vector> int main() { std::vector<std::vector<int>> v{ 1,2}, 9,3}, 4,2} }; } which ...
Enlico's user avatar
  • 2,056