A little bit of everything

Advanced vi / vim notes

Turn Color Off

:syntax off (Can add to .vimrc)


Selecting Text Visually

'v' Start visual Mode
Do text operation, ie YPDC Etc.



Windowing

Vim supports multiple windows.
Windowing
':sp[lit] ' or ':sf[ind] ' or 'ctrl-w ctrl-s' or
'ctrl-w s'
Used to split the window horizontally. Note that the command line way
of splitting has an extra option which makes it more
powerful. You can search for the file according the 'wildmode' option set.

':vs[plit] ' or 'ctrl-w ctrl-v' or 'ctrl-w v'
Used to split the window veritically. Command line options are more
powerful since they allow you to specify a file name.

':clo[se][!]' or 'ctrl-w ctrl-c' or 'ctrl-w c'
Closes the current window. The ! is used to forcebly close/hide a
buffer. In the case its get closed, the changes are lost

':q[uit][!]' or 'ctrl-w ctrl-q' or 'ctrl-w q'
Quits current window. If its the last window and ! is used, the
changes to the buffer are lost.

':on[ly]' or 'ctrl-w ctrl-o' or 'ctrl-w o'
Displays only the current window. Hides the rest if the hidden option
is set.



Editing Remote Files


You can use scp, ftp, rcp, http to edit remote files. So when you write back
to a file it gets saved to the remote location

"vim
scp://user@hostname/path/file"

This leads to a lot of other good stuff :).

"vimdiff file1
scp://user@hostname/path/file2"
(Compare files on remote systems)


Markers:

Named markers may be set on any line
ma Sets marker a
'a Go to marker a
:marks List all the current marks



Search and replace

:s/pattern/string/g


blog comments powered by Disqus