Vim settings for displaying row numbers, syntax highlighting, and automatic indentation

Source: Internet
Author: User
In ubuntu, the vim configuration file is stored in the/etc/Vim directory. The configuration file name is vimrc.
In fedora, the vim configuration file is stored in the/etc directory. The configuration file name is vimrc. In Red Hat Linux, the vim configuration file is stored in the/etc directory. The configuration file name is vimrc.
  1. Set nocompatible "removes VI consistency mode to avoid bugs and limitations in earlier versions
  2. Set Nu! "Display row number
  3. Set guifont = Luxi/MONO/9 "Set Font, font name, and font size
  4. Filetype on "check file type
  5. Set history = 1000 "records the number of historical rows
  6. Set background = Dark "background black
  7. Syntax on "syntax High Brightness Display
  8. Set autoindent "Vim uses automatic alignment, that is, apply the alignment format of the current row to the next line (Auto indent)
  9. Set cindent "(cindent is especially designed for automatic indentation of C language syntax)
  10. Set smartindent "intelligently selects Alignment Based on the alignment format above, which is useful for programming similar to the C Language
  11. Set tabstop = 4 "set the tab key to 4 spaces,
  12. Set shiftwidth = 4 "set to use four spaces when lines are staggered
  13. Set Ai! "Set automatic indent
  14. Set showmatch "sets the matching mode, similar to that when you enter a left brace, it will match the corresponding right brace.
  15. Set guioptions-= T "Remove toolbar from Vim's Gui version
  16. Set VB t_vb = "When Vim is edited, an alarm is triggered if the command is incorrect. This setting removes the alarm.
  17. Set ruler "shows the status line at the cursor position in the lower right corner during editing
  18. Set nohls "by default, search for matching is a high-Brightness Display, which closes the highlighted display
  19. Set incsearch "queries a word in a program and automatically matches the position of the word. For example, if you query a desk word, when you enter/d, the word starting with D is automatically found, when you enter/de, the first word starting with DS is automatically found, and so on. When you find the word to match, do not forget to press Enter.
  20. Set backspace = 2 "set backspace key available
  21. After a file is modified, it is automatically backed up. The backup file name is added with "~" to the original file name. Suffix
  • If has ("VMS ")
  • Set nobackup
  • Else
  • Set backup
  • Endif

If the setting is complete and the function does not work, check whether the vim-enhanced package is installed in the system. The query command is:

$ Rpm-Q vim-enhanced
NOTE: If Vim does not take any action after the preceding settings are configured, upgrade Vim to the latest version. Generally, you only need to enter the following command on the terminal: sudo apt-Get install Vim

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.