I have some code that looks similar to this:


I want to edit the lines that say "Text" by using Visual Block mode.

I can type ctrl-v on the first "T" and then }, but that brings me down to the first blank line.

Is there a way to jump to the "T" on the bottom line that says "Text"? Essentially I want to jump down until there is whitespace below.

  • I think the answers here will solve your issue. If not, could you please clarify your question further? – Rich Feb 28 at 15:19
  • 4
    this plugin does exactly what is requested github.com/vim-utils/vim-vertical-move – Mass Feb 28 at 16:23
  • @Mass Thank you, that plugin is what I needed. – Vermillion Feb 28 at 16:47
  • @Mass, this plugin is really helpful. Sometimes, I go into visual mode, select some text in that line, go into visual block mode, go down with jump... Baam! Now I need to goto the other end with o and reselect the text. Annoying! – klaus Feb 28 at 20:39
  • @Mass Could you make that an answer, maybe explaining a bit what the plugin does and how to use it so that future readers can find it easily? :) – statox Mar 1 at 8:32

With relativenumber

Turn on relativenumber with the following:

:set relativenumber

Now, your test case is

1  [
0      (Text),
1      (Text),
2      (Text), 
3  ],

Here, the numbers on the left side are not part of the text, it's simple line numbers. See :h rnu

Now, perform the following actions:

  • Move the cursor to first T
  • Enable visual-block mode with Ctrl-V
  • Press 2j to go 2 line down vertically to the desired T.

With searching

Your text case looks like the following


Now, perform the following actions:

  • Take the cursor to the first T
  • Enter visual-block mode with Ctrl-V
  • Search forward for T with /T<CR>
  • Go to the next T with <Ctrl-G>

But I'm guessing what you really want is select the whole column within the indentation. So a more general approach would be the following:

  • Take the cursor to the first T
  • Enter visual-block mode with Ctrl-V
  • Jump to the last line with }
  • Search backward for T with ?T<Enter>


In case of using relativenumber, the important part is what vim considers jumps, see :h jump-motions. When you pressed } as you stated in your question, the cursor moved to the first (virtual) column. It may seem like it happened because there is simple no other characters in that line so the cursor had no way to maintain it's column number. But this is the case with all other jump-motions. Vim doesn't consider j or k as jump-motions. So, if you use j or k to move around in visual-block mode, your (virtual) column position will be maintained.

In case of searching, you're necessarily directed the cursor where to go manually. So, it's a more rigorous process and only to come into play if you're hardfast not to use relativenumber.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.