Simple VIM Configuration

Source: Internet
Author: User
Tags set background

For a person who learns C + +, I use vs to write code, and the Linux environment is also very important. After learning some of the basics of Linux recently, we started using the Vim editor. However, it was very uncomfortable at the beginning of the interface, so I tried to decorate it as a vs style.

Under directory/etc/, there is a file named VIMRC, which is a public vim configuration file in the system and is valid for all users. In each user's home directory, you can create a private configuration file, named ". VIMRC". For example, under the/root directory, a. vimrc file is usually already present.

List some simple commands.

1. Display related (about the command, there are many, I just listed the more commonly used, we can self-baidu ~)

"Winpos 5 5" Setting window position

"Set lines=40 columns=155" setting window size

"Set Nu" displays line numbers

Set go= "Do not graph button

"Color asmanian2" setting background theme

Set Guifont=courier_new:h10:cansi "Setting font

"Syntax on" syntax highlighting

Autocmd insertleave * se nocul "highlight when moving forward with light

Autocmd insertenter * se cul "highlight when moving forward with light

"Set ruler" display ruler

Set showcmd "Input command displayed, see clearly

The height of the "set cmdheight=1" command line (under the status line), set to 1

"Set Whichwrap+=<,>,h,l" allows backspace and cursor keys to span line boundaries (not recommended)

The "set scrolloff=3" cursor moves to the top and bottom of buffer to maintain 3 lines of distance

Set statusline=%f%m%r%h%w\ [format=%{&ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\%{strftime (\ "%d/%m/%y\-\%H:%M\")} " What the status line displays

Set Laststatus=1 "Start Display status line (1), always show status line (2)

Set foldenable "Allow folding

Set foldmethod=manual "Manual folding

"Set Background=dark" background using black

Set nocompatible "Remove nasty about VI consistency mode, avoid some bugs and limitations of previous versions

The show Chinese help

If version >= 603

Set HELPLANG=CN

Set Encoding=utf-8

endif

The Set color scheme

"ColorScheme Murphy

The font

"If (Has (" gui_running "))

"Set guifont=bitstream\ vera\ sans\ mono\ 10

"EndIf

Set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936

Set Termencoding=utf-8

Set Encoding=utf-8

Set fileencodings=ucs-bom,utf-8,cp936

Set Fileencoding=utf-8

"Auto-complete

: Inoremap (() <esc>i

: Inoremap) <c-r>=closepair (') ') <CR>

: inoremap {{<cr>}<esc>o

: Inoremap} <c-r>=closepair ('} ') <CR>

: Inoremap [[]<esc>i

: Inoremap] <c-r>=closepair ('] ') <CR>

: Inoremap "" "<esc>i

: Inoremap ' <esc>i

function! Closepair (char)

If Getline ('. ') [Col ('. ')-1] = = A:char

Return "\<right>"

Else

Return A:char

endif

Endfunction

FileType plugin indent on

"Open File type detection, add this sentence can be used to complete the smart

Set Completeopt=longest,menu

The above content can be configured according to their preferences, I configured.

2. Installing the TagList Plugin

http://www.vim.org/scripts/script.php?script_id=273
Download Taglist_xx.zip, unzip the finished, will extract the contents of the doc to ~/.vim/doc, will Extract the contents of the plugin under the copy to ~/.vim/plugin

3. Add in ~/.VIMRC
Let tlist_show_one_file=1
Let Tlist_exit_onlywindow=1
Let Tlist_use_right_window=1

4. Install the browser and Windows? Manager--Plugin: Winmanager
Http://www.vim.org/scripts/script.php?script_id=95
Download Winmanager.zip, version 2.X or above.
unzip the Winmanager.zip, put the extracted doc content to ~/.vim/doc, will extract out copy of the content under the plugin to ~/.vim/plugin

5. Add in ~/.VIMRC
Let g:winmanagerwindowlayout= ' fileexplorer| TagList '
Nmap wm:wmtoggle<cr>

6. Then restart Vim, open ~/xx.c or ~/xx.cpp, enter "WM" in the command state, see the effect of the configuration.

In this way, my own vim is configured, before the configuration, do not even know the configuration file should be placed in which directory to go, after reading the data, finally can start to configure the ~ ~ Configuration process also pay attention to the format problems, some of the code is a space, if you forget to write will error!! Now look at the Vim interface is more comfortable, and then adjust as needed, easy to use.

Simple VIM Configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.