Suppose I select a block of text using visual block mode and I want to perform some operation on the lines surrounding it. For example, I want to surround it with a box of # characters. Note that this is only an example; it's not the end goal.

Is it possible to access the row, column coordinates of the four corners of the last visual-block selection in Vimscript?

  • 2
    You can get the left-top and bottom-right corners using getpos() and the marks ('< and '>). I guess left-bottom and top-right corners can then be calculated. – Christian Brabandt May 23 '19 at 5:57

Your Answer

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

Browse other questions tagged or ask your own question.