Difference between revisions of "Vim"

From wiki
Jump to navigation Jump to search
Tag: visualeditor
Line 6: Line 6:
  syntax enable
  syntax enable
  set ruler
  set ruler
<pre>
delete blank lines
:g/^$/d
:g will execute a command on lines which match a regex. The regex is 'blank line' and the command is :d (delete)
fix indent in file
gg=G
=, the indent command can take motions. So, gg to get the start of the file, = to indent, G to the end of the file, gg=G.
</pre>

Revision as of 22:52, 3 March 2014

basic .vimrc

set backspace=indent,eol,start
set ai
set si
set hlsearch
syntax enable
set ruler


delete blank lines
:g/^$/d
:g will execute a command on lines which match a regex. The regex is 'blank line' and the command is :d (delete)


fix indent in file
gg=G
=, the indent command can take motions. So, gg to get the start of the file, = to indent, G to the end of the file, gg=G.