Who said Vim is not ide?

Source: Internet
Author: User

Vim provides a variety of configuration functions in a simple way. The main configuration system consists of a file and a folder. On an OS X/Linux/Unix machine installed with vim, go to the user's home directory and find the. vimrc file and. Vim folder. This is all the configurations of vim.

(1) vimrc Introduction

The. vimrc file in the user directory is the main configuration file of VIM for the current user. This file is not necessary. If it is not available, create it. The file is located in the current user's home directory. You can use ~ /. Vimrc is found. When Vim is started, every command in the file is automatically run.

Pass. in vimrc, We can customize the configurations for VIM, including usage, display style, writing functions, and running plug-ins ,. all commands in vimrc can be dynamically run in the vim running mode similar to: comm ARGs [= args1], which takes effect immediately.

The following is a. vimrc sample script, which contains some common configurations. The comments below are a brief description.

The comments of vimrc are represented by double quotation marks ("). The braces in the example only represent the functional area. They are part of the comments and have no other meanings.

. Vimrc has rich configurations and can define various macros, functions, ins and ing. I have seen more than 1000 rows of. vimrc configuration at the longest time. The example here is relatively simple and suitable for entry-level users.

 
 
  1. SYN on "syntax support
  2.  
  3. "Common conf {general configuration
  4. Set ai "auto indent
  5. Set BS = 2 "delete with the return key in insert mode
  6. Set showmatch "code matching
  7. Set laststatus = 2 "always displays status rows
  8. Set expandtab "is used in combination with the following three configurations to set the number of tabs and indentation spaces.
  9. Set shiftwidth = 4
  10. Set tabstop = 4
  11. Set cursorline "underline the row where the cursor is located
  12. Set number "display row number
  13. The Set autoread file has been modified outside vim and is automatically re-read.
  14.  
  15. Case Insensitive for set ignorecase Retrieval
  16. Set fileencodings = uft-8, GBK "open a file with UTF-8 or GBK
  17. Set HLS "highlight matching items during retrieval
  18. Set helplang = cn "helps set the system to Chinese
  19. Set foldmethod = Syntax "code folding
  20. "}}
  21.  
  22. "Conf for tabs: tab configuration. use ctrl H/L to switch labels.
  23. Let mapleader = ','
  24. Nnoremap <c-l> GT
  25. Nnoremap <c-h> GT
  26. Nnoremap <leader> T: tabe <CR>
  27.  
  28. "Conf for plugins {plug-in-related configuration
  29. "Status bar configuration
  30. "Powerline {
  31. Set guifont = powerlinesymbols \ for \ Powerline
  32. Set nocompatible
  33. Set t_co= 256
  34. Let G: powerline_symbols = 'fancy'
  35. "}
  36. "Pathogen is a plug-in used by VIM to manage plug-ins.
  37. "Pathogen {
  38. Call pathogen # infect ()
  39. "}
  40.  
  41. "}}
(2). Vim folder

. Vim is the main configuration folder of VIM. It is located in the main directory of the current user. You can use CD ~ /. Vim. This folder is generally used to place plug-ins and related help documents. Common directory structures include:

  • Doc // help document directory
  • Autoload // directory of the plug-in automatically loaded when Vim is started
  • Plugin // plug-in Directory, which is usually called out through commands When Vim is used

Of course, if you have installed enough plug-ins, there will be a wide variety of plug-ins in this directory, and folders such as syntax, snippets, and indent will pop up. Files contained by a plug-in are often distributed in Multiple folders, which is difficult to manage. We will introduce a plug-in for managing plug-ins later, so that the directory is clean, tidy, and easy to manage, the plug-in name isPathogen!

Enter the command: Help in VIM To Go To The Help page. The help page is in English by default. If you like to read Chinese, you can install the Help content in Chinese in the following ways:

Download the compressed Chinese help file package

Decompress the file and copy the file in the doc directory ~ /. Vim/doc

Confirm that set helplang = Cn is set in. vimrc.

Enter the command: Help to enter the Chinese help

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.