The individual configuration of vim. VIMRC

Source: Internet
Author: User

Paste a self-used vim configuration file, the personal feeling that these configurations are not bloated, for the operation is basically enough.


Set Shortmess=ati


Syntax enable

Syntax on "SET syntax highlighting


Set Nu

Set ruler


Set autoindent "Setting Auto Indent


Set nocompatible

Set Magic

Set confirm


Set history=1000


Set Cursorline

Highlight Comment Ctermfg=lightblue Guifg=darkblue


Set Cindent

Set tabstop=4

Set softtabstop=4 "setting soft tab 4 spaces

Set shiftwidth=4 "Setting indent 4 spaces

Set Smarttab


Set Si

Set Wrap

Set Showmatch

Set Smartindent

Set CIN


Set Hlsearch

Au bufreadpost * If line ("' \ '") > 0|if line ("' \" ") <= Line (" $ ") |exe (" Norm ' \ "") |else|exe "Norm $" |endif|endif



"Here is the Add F4 hotkey to automatically add the file header comment information

Map <F4> ms:call addauthor () <cr> ' S


function 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 ()

endif


Endfunction



function Updatetitle ()

Normal m '

Execute '/* Last Modified\s*:/[email Protected]:.*[email protected]\=strftime (":%y-%m-%d%h:%m") @ '

Normal MK

Execute '/* filename\s*:/[email protected]:.*[email protected]\= ":". Expand ("%:t") @ '

Execute "Noh"

Normal ' k

Echohl warningmsg | echo "Successful in updating the copy right." |echohl None

Endfunction


"" Add Comment for C

function Addtitleforc ()

Call Append (0, "/**********************************************************")

Call Append (1, "* author:lee")

Call Append (2, "* Email: [Email protected]")

Call Append (3, "* Create time:". Strftime ("%y-%m-%d%h:%m"))

Call Append (4, "* Last Modified:". Strftime ("%y-%m-%d%h:%m"))

Call Append (5, "* Filename:". Expand ("%:t"))

Call Append (6, "* Description:")

Call Append (7, "* *******************************************************/")

Echohl warningmsg | echo "Successful in adding the copyright." | Echohl None

Endfunction


"" Add Comment for Python

function Addtitleforpython ()

Call Append (0, "#!/usr/bin/python")

Call Append (1, "#-*-coding:utf-8-*-")

Call Append (2, "")

Call Append (3, "# **********************************************************")

Call Append (4, "# * Author:lee")

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 None

Endfunction


"" Add conment for Shell

function Addtitleforshell ()

Call Append (0, "#!/bin/bash")

Call Append (1, "# **********************************************************")

Call Append (2, "# * Author:lee")

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"))

Call Append (7, "# * Description:")

Call Append (8, "# **********************************************************")

Endfunction



The individual configuration of vim. VIMRC

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.