Android source code development is almost inseparable from Linux. Of course, Ubuntu is the first release of the Linux system, and VI is the built-in editing tool. I believe anyone who has used it knows its strength. However, the vi provided by the system has limited functions and is not convenient to use. Therefore, we need to optimize the configuration. 1. Install enhanced version vi: sudoapt-getinstallvim2, make a soft link: sudoln-sf/usr/bin/vim/usr/bin/vi
Android source code development is almost inseparable from Linux. Of course, Ubuntu is the first release of the Linux system, and VI is the built-in editing tool. I believe anyone who has used it knows its strength. However, the vi provided by the system has limited functions and is not convenient to use. Therefore, we need to optimize the configuration.
1. install enhanced vi: sudo apt-get install vim
2. Make a soft link: sudo ln-sf/usr/bin/vim/usr/bin/vi can be omitted, because this is just a matter of personal habits. However, input vi, it's a little faster than input vim.
3. Create a New vi configuration file: sudo vi/etc/vim/vimrc. local. Add the following content in it and save it.
Set nocompatible "removes the annoying vim consistency mode to avoid bugs and limitations in earlier versions.
Set number "displays the row number.
Set rcursor "displays the row and column information of the current cursor
Syntax on "syntax highlighted. (This is definitely required .)
Set background = dark "the background color is dark. (I think it's good to protect your eyes .)
Set history = 50 "set the command history to 50.
Set hls "Searching for matching is displayed in High Brightness
Set lbr "is not interrupted in words.
Set fo + = mB "enable the disconnected line module for Asian language support
Set backspace = indent, eol, start
Set tabstop = 4 "set the tab key to 4 spaces.
Set shiftwidth = 4 "set to use four spaces when lines are staggered
Set whichwrap = B, s, <,>, [,]
Filetype on "check file type
Set autoindent "uses automatic start, that is, to apply the format of the current row to the next row.
Set smartindent "intelligently selects the start mode based on the preceding start format.
Set showmatch "sets the matching mode and displays matching conditions of parentheses.
Set cin "Enable Automatic indentation of the C/C ++ style.
Set cino =: 4g4t4 (sus "option for setting automatic indentation of C/C ++ Style
Set vb t_vb = "When vim is edited, if a command error occurs, a sound will be triggered and this setting is removed.
When set incsearch is searched, the search starts when the text to be retrieved is not completely entered.
Filetype plugin indent on "enable Vim's three types of intelligence: Automatic Identification of file types,
Autocmd FileType text setlocal textwidth = 78
Autocmd BufReadPost *
\ If line ("° \" ")> 0 & line (" ° \ "") <= line ("$") |
\ Exe "normal G' \" "|
\ Endif
Highlight Search term = reverse ctermbg = 4 ctermfg = 7
Highlight Normal ctermbg = black ctermfg = white
Highlight Comment ctermfg = Cyan
Set completeopt = longest, menu
Set tags = ../tags
Set tags = tags
"Use the Space key to switch and collapse
Set foldenable
Set foldmethod = manual
Nnoremap @ = (Foldclosed (line ('.') <0 )? 'Zc': 'Z ')
"If has (" vms ")
"" Set nobackup
"Else
"" Set backup
4. Add friendly support for Chinese characters. modify a hidden file in the user directory.
Vi ~ /. Add the following two lines to vimrc:
Let & termencoding = & encoding
Set fileencodings = UTF-8, gbk, ucs-bom, cp936
After completing the above steps, you can use your vi to write a c code. It is very beautiful.
Recommended reading:
Vim Learning Guide http://www.linuxidc.com/Linux/2013-08/89096.htm
Quick learn Vi editor http://www.linuxidc.com/Linux/2013-08/88586.htm
Powerful Vim editor http://www.linuxidc.com/Linux/2013-07/87544.htm
Build a Vim Development Environment http://www.linuxidc.com/Linux/2013-07/87363.htm on CentOS 6.2
Vim 7.4a release, new and faster http://www.linuxidc.com/Linux/2013-07/87035.htm for regular expression Engines
CentOS 5.4 installation highlighted Vim editing tool http://www.linuxidc.com/Linux/2013-06/86508.htm
Vim tips: C language http://www.linuxidc.com/Linux/2012-12/77124.htm settings
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2