SELECT LINE mode in vim

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 ?

Best Answer

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
Related Question