Vi: Configuration Example
Published: Apr 8, 2017 Tags: vi Category: Engineering
Among various text editors, I like Vi a lot. It help me a lot if I work on various operating systems and different environment since Vi is installed by default on most operating systems. There is GUI Vi tool available on Windows called Gvim, which can be downloaded from here: http://www.vim.org/download.php
The configuration file is named as _vimrc which is located around ProgramFiles(x86)\Vim. Just open and edit the _vimrc file, but you need to restart Gvim to see the changes.
The following settings will be very helpful but not set-on by default.
- If the GUI is not English, you can add following content in _vimrc
1set langmenu=en_US
2let $LANG = 'en_US'
3source $VIMRUNTIME/delmenu.vim
4source $VIMRUNTIME/menu.vim
- Set to auto read when a file is changed from the outside
1set autoread
- Ignore case when searching
1set ignorecase
- Set the dark scheme
1colorscheme desert
2set background=dark
- Set utf8 as standard encoding
1set encoding=utf8
- Turn backup off
1set nobackup
2set nowb
3set noswapfile
- Set the tab stop
1set tabstop=4
- Set the auto indent
1set ai "Auto indent
2set si "Smart indent
3set wrap "Wrap lines
- Display line numbers on the left
1set number
- Set the font
1set guifont=courier_new:h12
- Maximize the window on startup
1if has("gui_running")
2 " GUI is running or is about to start.
3 " Maximize gvim window (for an alternative on Windows, see simalt below).
4 set lines=999 columns=999
5else
6 " This is console Vim.
7 if exists("+lines")
8 set lines=50
9 endif
10 if exists("+columns")
11 set columns=100
12 endif
13endif
- Set the spell check on
1set spell
Easy approach is to get the example _vimrc file from: https://github.com/wubw/DevScripts/blob/master/_vimrc
Written by Binwei@Oslo