Vim Basic Settings

Source: Internet
Author: User

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

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.