博主的系统是Ubuntu16.04,对vim编辑器进行简单的配置
先进入/etc/vim/vimrc
在文件的末尾添加下面的内容
set number
set tabstop=4
syntax on
set cursorline
set ruler
syntax on
autocmd BufNewFile *.py,*.cpp,*.sh,*.java exec ":call SetTitle()"
func SetTitle()
call setline(1,'#******************************************************** *****')
call setline(2,'#')
call setline(3,'# Filename: '.expand("%"))
call setline(4,'# Version: V1.0')
call setline(5,'# Author: yxnie')
call setline(6,'# Email: yxnie@chinaums.com')
call setline(7,'# Create: '.strftime("%Y-%m-%d %H:%M:%S"))
call setline(8,'# Description:......')
call setline(9,'#******************************************************** *****')
if expand("%:e") == 'py'
call setline(10,"#_*_coding:utf8_*_")
call setline(11,'#')
call setline(12,'')
elseif expand("%:e") == 'sh'
call setline(10,'#!/bin/bash')
call setline(11,'#')
call setline(12,'')
elseif expand("%:e") == 'cpp'
call setline(11,'//C++ file')
call setline(12,'#include<stdio.h>')
call setline(13,'#')
call setline(14,'')
endif
endfunc
(括号自动补全)
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap < <><ESC>i
重启系统即可