0

To open a buffer in a vertical split, you can use the word "vert". For example :

:vert term  #it opens a terminal in a vertical split
:vert sb1   #it opens the buffer 1 in a vertical split

Why i can't make the vert command shorter ?

On internet, i saw that people just write :

:vterm
:vsb1

For me it doesn't work...

1 Answer 1

2

The full :vert is :vertical and the full :term is :terminal. In order to save typing, Vim lets you type as few characters as possible as long as there is no ambiguity so, for :vertical, you could type:

:vertical
:vertica
:vertic
:verti
:vert

but you can't go further because there are three commands that start with ver:

:vertical
:version
:verbose

and Vim can't really be expected to guess which one you want. Therefore, :vert is the shortest you can get.

The mechanism is described in chapter 20 of the user manual: :help 20.2.

Now… those people on the internet are probably using or trying to use abbreviations, which are introduced in chapter 24 of the user manual: :help 24.7 and thoroughly documented under :help abbreviations.

4
  • ":sb1" here vim understands 's' as split..But ":s/foo/bar" here vim understands 's' as substitute....It drives me crazy. Would you please explain that ? Dec 9, 2022 at 15:19
  • 1
    :sb is short for :sbuffer.
    – romainl
    Dec 9, 2022 at 15:21
  • OK you won again :| Thanks Dec 9, 2022 at 15:22
  • @floupinette Part of the reason is that :substitute has been around since ed, so for backwards compatibility the shorthand :s needs to be :substitute. But as pointed out, :sb is the shorthand for :sbuffer (though I would guess that :sb1b would be interpreted the same as :s/1/; that is, delete the first 1 in the line or error)
    – D. Ben Knoble
    Dec 10, 2022 at 17:34

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.