Difference between revisions of "Editor: vim"

From Dreamwidth Notes
Jump to: navigation, search
(Created page with 'vim is a console-based cross-platform editor, mostly used by Lunix and other Unix users. It can be a very powerful, but also difficult to learn tool. vim has two modes, an inser…')
 
(added some Vim configuration)
Line 8: Line 8:
  
 
Saving is done by entering ":w" and then hitting enter, quitting by ":q" and if you want to save and quit, the two are just concatenated to ":wq"
 
Saving is done by entering ":w" and then hitting enter, quitting by ":q" and if you want to save and quit, the two are just concatenated to ":wq"
 +
 +
==Setting up Vim for coding==
 +
 +
Add the following to your .vimrc file:
 +
 +
set tabstop=4
 +
set shiftwidth=4
 +
set softtabstop=4
 +
set smarttab
 +
set smartindent
 +
set expandtab
 +
set autoindent
 +
 +
If you want Vim to do more while you are coding:
 +
 +
syntax on
 +
filetype on
 +
filetype plugin on
 +
filetype indent on
 +
 +
  
 
[[Category: Editors]]
 
[[Category: Editors]]

Revision as of 22:35, 26 February 2010

vim is a console-based cross-platform editor, mostly used by Lunix and other Unix users. It can be a very powerful, but also difficult to learn tool.

vim has two modes, an insertion mode that you can access by using the [Ins] key, and the command mode it starts with, which you can get back to with [Esc]

Useful commands

In command mode, the text can be searched by entering a slash and then typing the text one is looking for. If you want to see the next hit of the search, type "n".

Saving is done by entering ":w" and then hitting enter, quitting by ":q" and if you want to save and quit, the two are just concatenated to ":wq"

Setting up Vim for coding

Add the following to your .vimrc file:

set tabstop=4 set shiftwidth=4 set softtabstop=4 set smarttab set smartindent set expandtab set autoindent

If you want Vim to do more while you are coding:

syntax on filetype on filetype plugin on filetype indent on