Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 ?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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
share|improve this answer

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.

share|improve this answer

Learning how to use Vim's documentation is key:

:help v_ctrl-g
share|improve this answer
    
+1 The documentation is great... if you know how to search. I couldn't find it using :helpgrep or plain help and I would never have tried v_ctrl-g so thanks romainl for yet another trick. –  Lieven Keersmaekers Jan 29 '14 at 17:45
    
Agreed, I did search but thats a good string to search for –  exussum Jan 29 '14 at 19:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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