Vim Insert template automatically after new file

Source: Internet
Author: User
Tags set background python script

I. Title: VIM Insert template automatically after new file

Ii. Summary

Both the Linux system administrator and the Linux development programmer often stop at the VI Editor programming development under the Linux environment. This article shares, the work of the practical programming tools skills, you can easily a key to the design of the desired template format.

Third, the demand

In the VI editor, the new encoding file is always blank, what method can be created, in advance to specify the corresponding template format it? How to save comments Ah, encoding format ah, update creation date Ah, and so on the note?

Iv. Realization OF

4.1 #vi ~/.VIMRC (no new-rw-r--r--)

4.2 Save it by depositing the following content

syntax onset nocompatible"Set numberfiletype onset history= +Set Background=Dark"Set Autoindent"Set SmartindentSet tabstop=4Set Shiftwidth=4Set Showmatchset guioptions-=tset rulerset nohlsset incsearch"Set Fileencodings=utf-8if&term=="xterm"Set T_co=8Set T_SB=^[[4%DM Set T_SF=^[[3%Dmendiffunctionaddfileinformation_php () let Infor="<?php\n"      \."***************************************************************************\n"      \."* \ n"      \."* Copyright (c) \ n"      \."* \ n"      \."**************************************************************************/\ n"      \."\ n"      \."\ n"      \."\ n"      \."/** \ n"      \."* @file:". Expand ("%")."\ n"      \."* @author your name ([email protected]) \ n"      \."* @date". Strftime ("%y-%m-%d%h:%m")."\ n"      \."* @version 1.0 \ n"      \."**/\ n"      \."\ n"      \."\ n"      \."\ n"      \."\ n"      \."\ n"      \."\ n"      \."?>"Silent put! =Inforendfunctionautocmd Bufnewfile*. PHP call addfileinformation_php ()functionaddfileinformation_sh () let Infor="#!/bin/bash\n"      \."\ n"      \."# ***************************************************************************\n"      \."# * \ n"      \."# * @file:". Expand ("%")."\ n"      \."# * @author: [email protected] \ n"      \."# * @date:". Strftime ("%y-%m-%d%h:%m")."\ n"      \."# * @version 1.0 \ n"      \."# * @description: Shell script \ n"      \."# * @Copyright (c) All right reserved \ n"      \."#* \ n"      \."#**************************************************************************/\ n"      \."\ n"      \."\ n"      \."\ n"      \."\ n"      \."Exit 0"Silent put! =Inforendfunctionautocmd Bufnewfile*.SHCall addfileinformation_sh ()functionaddfileinformation_py () let Infor="#!/usr/bin/env python\n"      \."#-*-Coding:utf-8-*-\n"      \."# ************************************************************************ \ n"      \."# * \ n"      \."# * @file:". Expand ("%")."\ n"      \."# * @author: [email protected] \ n"      \."# * @date:". Strftime ("%y-%m-%d%h:%m")."\ n"      \."# * @version 1.0 \ n"      \."# * @description: Python Script \ n"      \."# * @Copyright (c) All right reserved \ n"      \."# * \ n"      \."#************************************************************************* \ n"      \."\ n"      \."Import Os,sys"      \."\ n"      \."print u ' Chinese ' \ n"      \."\ n"      \."exit ()"Silent put! =Inforendfunctionautocmd Bufnewfile*.py Call Addfileinformation_py ()

V. Summary
Easy to fix, new PHP, Python, sh, etc. insert template format.

Good typesetting format, always can make readers pleasing, the definition of format, just a step away, gtd!

Vim Insert template automatically after new file

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.