Developed under Linux, Vim is the preferred tool. However, vim, which is installed by default on the system, usually does not match some of the regular settings. such as: color display, highlighting, automatic indentation, automatic memory, tab step and so on. This causes a lot of inconvenience to users, I will share my practical experience on these issues.
To get a good vim, we first need to install the full version of Vim.
sudo apt-get install Vim-full
After the installation, we can continue to go down.
The next setting is entirely for Vim's configuration file/ETC/VIM/VIMRC.
Open this file, you will find a lot of useful features, the default is blocked off, you have to do is to open these features
1. Vim in the syntax color display
"VIM5 and later versions support syntax highlighting. Uncommenting the next
"Line enables syntax highlighting by default."
Syntax on
2. VIM Automatic Indent
"Uncomment the following to have Vim load indentation rules according to the"
"Detected filetype. Per default Debian Vim only load filetype specific
"Plugins.
If has ("Autocmd")
FileType indent on
endif
3. Vim automatically remembers where the last file was opened
"Uncomment the following to have Vim jump to the last position when
"Reopening a file
If has ("Autocmd")
Au bufreadpost * If line ("'/") > 0 && Line ("'/") <= line ("$")
/| EXE "normal! G '/"" | endif
endif
When this setting is turned on, it is found that Vim's location memory function does not work. When I opened the file in sudo, I found that vim worked. Check the Internet, and finally find out what's going on. Originally, this function is dependent on the user directory (/home/<user>/) of the. viminfo file, this file default permissions are not writable. The permissions for the file are changed:
sudo chmod 666 ~/.viminfo
OK, now it's ready to work.
4. Other
Set tab step, add a "set ts=<n>" to VIMRC
Vim configuration file path in Scratchbox environment:/SCRATCHBOX/TOOLS/SHARE/VIM/VIMRC