SELECT LINE mode in vim

While editing in vim, I was trying to get the line count in a selection (gC-g with the lines selected)

I missed the first g by mistake(so in visual line mode press C-g), and vim went from -- VISUAL LINE -- to -- SELECT LINE --

Ive had a look around google, and in vim docs but cant see anything about this mode ? What is it for ?


Solution 1:

Visual mode has three different ways of highlighting:

  1. plain
    • Entered by pressing v in Normal mode
    • Left and right movement highlights characterwise while up and down wrap to the beginning or end of the line respectively
    • Indicated by -- VISUAL --
  2. block
    • Entered by pressing Ctrlv or Ctrlq in Normal mode or Visual mode
    • Highlighting is always maintained in a rectangular area with a certain number of rows and columns
    • Indicated by -- VISUAL BLOCK --
  3. linewise
    • Entered by pressing Shiftv in Normal mode or Visual mode
    • Highlighting is always performed on a line by line basis with each line highlighted in its entirety
    • Indicated by -- VISUAL LINE --

You were in Visual linewise mode. So when you switched to Select mode, it appended to word LINE to the mode to remind you that anything you do in select mode will affect the entire line of the highlighted area. In select mode, the commands entered on the keyboard behave more like if you selected text using a mouse in Windows Notepad and then started typing. Meaning you can no longer use Normal mode motions and operators.

This chart shows how to switch between the different modes but doesn't explicitly cover the linewise/characterwise difference (that's covered elsewhere):

                TO mode
                Normal  Visual  Select  Insert    Replace   Cmd-line  Ex 
FROM mode
Normal                  v V ^V    *4     *1        R gR     : / ? !   Q
Visual           *2               ^G     c C        --        :       --
Select           *5     ^O ^G            *6         --        --      --
Insert           <Esc>    --      --              <Insert>    --      --
Replace          <Esc>    --      --    <Insert>              --      --
Command-line     *3       --      --     :start     --                --
Ex               :vi      --      --     --         --        --

-- not possible

Solution 2:

One way to find information on "select" would be to type

:help select

and Ctrl-D. That will give you a list of help topics that include the string "select". The one you want is "Select-mode".

:help Select-mode

will bring you to the section that discusses Select mode and the differences between it and Visual mode.

Another good reference is the section in the User Manual (as opposed to the Reference Manual cited above) on Select mode,

:help 09.4

The User Manual table of contents is at

:help toc

From there, you can either browse it, or as I did, just search for the string of interest.