Categories
status

Vim folding tips zf create a manual fold…

Vim folding tips.
zf: create a manual fold
zd: remove a manual fold
zM: overview
zR: detail
zo: open fold
zc: close fold

:mkview save fold
:loadview load fold

http://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun

Categories
status

Redo the last substitute or command by in…

Redo the last substitute or command by : in Vim

@:

For more repeats, it can be done by

@@
Categories
status

To change two vertically split windows to horizontally…

To change two vertically split windows to horizontally split

Ctrl-W t Ctrl-W K
Horizontally to vertically:

Ctrl-W t Ctrl-W H
Explanations:

Ctrl-W t makes the first (topleft) window current
Ctrl-W K moves the current window to full-width at the very top
Ctrl-W H moves the current window to full-height at far left

http://stackoverflow.com/questions/1269603/to-switch-from-vertical-split-to-horizontal-split-fast-in-vim

Categories
status

Convert all tabs to spaces and vice versa…

Convert all tabs to spaces and vice versa.

You can use the :retab command to convert all existing tabs to spaces. You can do both in one command:

:set et|retab

You can also convert spaces to tabs:

:set noet|retab!

http://vim.wikia.com/wiki/Super_retab

Categories
status

Vim plugin surround Normal mode ds delete a…

Vim plugin surround

Normal mode
———–
ds – delete a surrounding
cs – change a surrounding
ys – add a surrounding
yS – add a surrounding and place the surrounded text on a new line + indent it
yss – add a surrounding to the whole line
ySs – add a surrounding to the whole line, place it on a new line + indent it
ySS – same as ySs

Visual mode
———–
s – in visual mode, add a surrounding
S – in visual mode, add a surrounding but place text on new line + indent it

http://www.catonmat.net/blog/vim-plugins-surround-vim/

Categories
status

Surround a VIM plugin that surrounds a word…

Surround, a VIM plugin that surrounds a word or a line.

http://www.catonmat.net/blog/vim-plugins-surround-vim/

Categories
status

VIM search tip In addition to or there…

VIM search tip.

In addition to / or ? there are more search options.

  • or # search the exact word under the cursor.

(g* or g# search the words including the word under the cursor.)

Categories
status

Exchange current window with the next on Ctrl…

Exchange current window with the next on.
Ctrl-w x

Categories
status

Some Vim commands related to buffers Show buffer…

Some Vim commands related to buffers

Show buffer list

:ls

Change to another buffer – any of these commands

:bn
:bp
:b 
Ctrl-6

Close current buffer

:bd
Categories
status

Rotate open windows in Vim Ctrl w r

Rotate open windows in Vim

Ctrl-w r