Systools Index

5. Vim

<leader> with default configuration is key \, so when you see <leader>-W means pressing \W

5.1. Vim RC

Read "A good vimrc" for more information.

/usr/share/vim/vimrc
System wide Vim initializations.
~/.vimrc
Your personal Vim initializations.

Copy vimrc skeleton example, so that each user have a base to start personalizing it;

        $ sudo cp ~/sysdoc/conf/etc/skel/.vimrc /etc/skel/
        $ sudo mkdir /etc/skel/.vim
        $ sudo mkdir /etc/skel/.vim/swap
        $ sudo mkdir /etc/skel/.vim/views
        $ sudo mkdir /etc/skel/.vim/undodir
        $ sudo mkdir /etc/skel/.vim/backup
        $ wget -O wombat256mod.vim  http://www.vim.org/scripts/download_script.php?src_id=4055
        $ mv wombat256mod.vim /usr/share/vim/colors/
        

5.2. Color schemes

Default vimrc skeleton is configured to use wombat256mod, which is installed by adduser skeleton.

5.3. Split and tab

Horizontal split;

        :sp
        

Vertical split;

        :sp
        

Move between window splits;

        ctrl+w (k,j,l,h)
        

5.4. Editing files

Modes

To enter visual block mode press ctrl-v. To insert block first select area then press I, insert text normally, when you pres ESC the text will be inserted on previously selected area.

Come from background;

        $ fg
        

Moving in vim

Moving page up and page down;

[Control][b]
Move back one full screen
[Control][f]
Move forward one full screen
[Control][d]
Move forward 1/2 screen
[Control][u]
Move back (up) 1/2 screen

How to use vim

In vim you can apply predefined number of times to a operator, selection or object. For example to delete the next two words press: d + 2 + w. List of important operators objects, selections;


        
        operator + count + object
        

Operator;

d
Delete
c
Change (d + i)
y
Copy
v
Visual Select

Objects;

w
Word
s
Sentences
p
Paragraphs
t
Tags

Selections are like objects, for example d + i + w will delete "inner" word, c + a + w do the same plus the space;

a
All
i
in
t
Until
f
Find forward
F
Find backward

Selection of useful combinations;

vat
Select whole tag block.
cit
Change inside tag.
yat
Copy whole tag.

5.5. Spell check

Press z= over the bad written word and select desired one.

5.6. Plugins

Systools Index

This is part of the c9-doc Manual. Copyright (C) 2016 c9 team. See the file Gnu Free Documentation License for copying conditions.