Vim Personalization Settings

Source: Internet
Author: User

    1. The configuration file is/ETC/VIMRC, and the following modifications can be added directly below the configuration file.

    2. Automatically add comments, vim write. sh and. py files when you press F4 in command mode, you can add annotations automatically

Map <f4> ms:call addauthor () <cr> ' Sfunction addauthor ()      let n=1    while n < 11         let line = getline (n)         if line=~ ' [#]*\ s*\*\s*\s*last\s*modified\s*:\s*\s*.*$ '         call updatetitle ()         return    endif    let  n = n + 1    endwhile    if & filetype ==  ' sh '         call addtitleforshell ()      elseif &filetype ==  ' python '          call addtitleforpython ()     else         call addtitleforc()     endifendfunction ""  add comment for *function addtitleforc ()     call append (0, "# **********************************************************" )     call append (1, "")     call append (2, "# *  create time   :  ". Strftime ("%y-%m-%d %h:%m "))     call  Append (3, "# * filename      : ". Expand ("%:t"))      call append (4, "")     call append (5, "# ******************************* ") endfunction" " add comment for Pythonfunction  Addtitleforpython ()     call append (0, "#!/usr/bin/env python")      call append (1, "#coding: Utf-8")     call append (2, "")      call append (3, "# *")     call append (4," #  * author        : pengyongshi ")     call  append (5, "# * email         : [email  Protected]     call append (6, "# * create time   :   ". Strftime ("%y-%m-%d %h:%m "))     call append (7," # * last  modified :  ". Strftime ("%y-%m-%d %h:%m "))     call append (8," # *  Filename      :  ". Expand ("%:t ")     call  Append (9, "# * description   : ")     call append (10, "#  ********************************************************** ")     echohl  warningmsg | echo  "SuCcessful in adding the copyright. "  | echohl noneendfunction ""  add conment for shellfunction  Addtitleforshell ()     call append (0, "#!/bin/bash")     call  Append (1, "# **********************************************************")     call  append (2, "# * author        : pengyongshi")      call append (3, "# * email          : [email protected]     call append (4, "# * create  time   :  ". Strftime ("%y-%m-%d %h:%m "))     call append (5," #  * Last modified :  ". Strftime ("%y-%m-%d %h:%m "))     call  append (6, "# * filename      : ". Expand ("%:t")) &Nbsp;   call append (7, "# * description   : ")      call append (8, "# **********************************************************") endfunction

3. Set Tab key to 4 grid

Set tabstop=4

4. Auto Indent

Set Autoindentset cindent

5. Unified Indentation 4, default is 8 grid

Set Softtabstop=4set shiftwidth=4


This article is from the "Stranded," blog, please be sure to keep this source http://yasar.blog.51cto.com/9120455/1875112

Vim Personalization Settings

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.