Vim Inside Display TAB key

Source: Internet
Author: User

Vim Inside Display TAB key

1, the document has the TAB key time, you are invisible. To show it:

C code: Set list: Set list

Now the TAB key is displayed as ^i, and $ is displayed at the end of each line so that you can find whitespace that may be ignored by you
Where the characters are.

2. One drawback of doing this in Method 1 is that it looks ugly when you have a lot of tabs. If you use a color-
Terminal, or using GUI mode, Vim can highlight spaces and tabs. Use the ' listchars ' option:

C code: Set listchars=tab:>-,trail:-: Set listchars=tab:>-,trail:-

The tab is now displayed as ">---" and the extra white space character at the end of the line is displayed as "-".

:-)

1. Set the tab position

C code: Set tabstop=4: Set tabstop=4

2. Automatically turn it into a space when you enter tab

C code: Set Expandtab: Set Expandtab

If you need to enter a real tab at this point, enter Ctrl + V, tab, CTRL+Q under Windows, tab

3. Convert the existing tab to a space

C code: Retab: Retab

4. Set the viewport width of tab in edit mode

C code: Set Softtabstop: Set Softtabstop

This does not change the TabStop, but lets the Editor tab appear to be the specified width, the input tab will be inserted when the tab and space mix, such as tabstop=4, softtabstop=10, then Insert tab will move the cursor 10 characters, May be two tab plus two spaces, which is also valid for BACKSPACE.

5. Solve the problem of Shiftwidth and TabStop

C code: Set Smarttab: Set Smarttab

Insert a blank width of shiftwidth at the beginning of the line and press TabStop and softtabstop in other places

6. Display tab as visible character

C code: Set list listchars=tab:>-: Set list listchars=tab:>-

tab will be displayed as >--form

7. Expand tab only when editing a specific type of file

Add the following code to ~/.VIMRC

C codeautocmd FileType * Set Tabstop=4|set shiftwidth=4|set noexpandtab autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtabAutocmd FileType * Set Tabstop=4|set shiftwidth=4|set noexpandtab autocmd FileType python set Tabstop=4|set shiftwidth=4|s ET Expandtab

Vim Inside Display TAB key

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.