Vim script-vertical line' | 'and backslash '\'

Source: Internet
Author: User

Vim script-vertical line '|' and backslash '\' directory: [-] Meaning an example of vertical line is used to link Multiple commands as one command, it is like the semicolon in shell. Note that it is not a pipe. A backslash is used to link multiple rows of scripts to a row of scripts for execution. It is similar to the previous shell scripts and is used to ignore line breaks. Generally, it is placed at the beginning of the next line. In one example, I want to add a shortcut key to my vim to control the personalized display of the TAB (the first character of the TAB shows the vertical line, and the rest is still a space ), in addition, this key acts as a Toggle. The main code is as follows: 1 "F4 use a vertical line to display tab 2 set listchars = tab: \ | \, 3map <silent> <F4>: if & list <Bar> 4 \ set nolist <Bar> 5 \ echo "do not show tab" <Bar> 6 \ else <Bar> 7 \ set list <Bar> 8 \ echo "display tab" <Bar> 9 \ endif <CR> the <Bar> in the above Code is the ing of the vertical bars in the map command, it indicates that multiple commands are linked to one line, while other commands can be written below with a comfortable line feed style under the action of the backslash. By the way, here is something worth attention: Look at the code above. <Bar> cannot be directly written as '|', because this is the command to be mapped, that is, it is responsible for the map command, it is interpreted by map, while the backslash '\' can be directly written, because it is originally interpreted by vim scripts.

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.