Systools Index

Vim

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

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 wombat2mod.vim  http://www.vim.org/scripts/download_script.php?src_id=40
        $ mv wombat2mod.vim /usr/share/vim/colors/
        

2. Color schemes

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

3. Split and tab

Horizontal split;

        :sp
        

Vertical split;

        :vsp
        

Change horizontal to vertical

        ctrl+w H
        

Change vertical to horizontal

        ctrl+w J
        

Move between window splits;

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

4. Editing files

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.
vip$A,
Select a paragraph (vip), switch to visual block mode (CTRL V), append to all lines ($A) a comma (,), press esc to confirm.
vip<C-V>I,<Esc>
Select a paragraph (vip), switch to visual block mode (CTRL V), insert to all lines (I) a comma (,), press esc to confirm.

Spell check

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

6. Plugins

Systools Index

This is part of the Hive System Documentation. Copyright (C) 2018 Hive Team. See the file Gnu Free Documentation License for copying conditions.