3

For example, to close this "box" (the $ signs added to show the end of lines),

########$
#$
# lofa$
#$
########$

I would have to manually edit each line to add the appropriate amount spaces, and then finish with a #.


I know there is a simple command to enable to navigate everywhere in normal mode, and I spend ca. 10-15 minutes to track it down when I need it every other month, but this time I can't find it for the life of me...

1
  • 2
    Do you have still something open in your question? How can we help you further. Otherwise maybe could you accept a solution using the v button next to the arrow voting buttons. It allow the question to rest :-) Jul 14, 2023 at 5:39

3 Answers 3

5

The option you are looking for is :help 'virtualedit'.

Once you have set it to a value that works for you, why don't you persist it into your vimrc so that you don't have to look it up again?

FWIW, I have it set to "block":

set virtualedit=block

but you should try the other values before using this one blindly.

4

I would do:

set virtualedit=block

With this option set the block selection is allowed to select past of the end of the line.

You could then:

  • $Ctrl-v4j select the last column
  • A switch to 'append' mode
  • # add #
  • Esc leave 'append' mode
2

I would just use CTRL-v blockwise-visual:

  • gg go to start of file
  • <C-v> start visual selection in block mode
  • G go to the end of file, while selection block of the first letters (#)
  • y yank the text block (copy to register)
  • gg go to start of file
  • $ go to the end of line
  • p paste the block to form nice rectangle
#########$
#       #$
# lofa  #$
#       #$
#########$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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