Implement C # code folding in Vim

Source: Internet
Author: User

Vim provides four folding modes: indent, Tag, syntax, and expression. Folding by indentation is not suitable for python, but for C #, if you do not set some settings, the folding effect is still unsatisfactory, so I modified the syntax file of the C # file and improved the effect. I just need to add the following code to the corresponding syntax file of C #.

 

Syntax region Block start = "^ \ s * # \ s * \ (region \) \ | {" end = "^ \ s * # \ s * \ (endregion \) \ |} "transparent fold

Syn sync fromstart

Set foldmethod = syntax

 

The C # syntax file is under syntax under the installation directory, and the file name is cs. vim

 

Another text editor, SciTE, provides the code folding function, which is better than Vim, but is much worse than Vim in other aspects. The PythonWin code editor seems to use the same program as SciTE.

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.