1.基本语法
语法高亮
:syntax on/off
显示行号
set number/nonumber 自动缩进
set autoindent
set cindent
2.自动加入文件头
在etc/vimic
源码:
## vim 头部自动生成
function AddTitle()
call setline(1,"#!/usr/bin/env bash")
call append(1,"# -*- coding: utf-8 -*-")
call append(2,"#Filename: " . expand("%"))
call append(3,"#Author: Liuchao")
call append(4,"#Email: 137642091@qq.com")
call append(5,"#Date: " . strftime("%Y-%m-%d"))
call append(6,"#Desc: ")
call append(7,"")
call append(8,"source /devOps/shell/common/functions")
call append(9," ")
endf ## 提示按'F4',会调用AddTitle函数
map <F4> : call AddTitle() <cr>
3.修改为不提示自动创建(也可以提示自动创建)
源码:
autocmd BufNewFile *.php,*.sh exec ":call AddTitle()" function AddTitle()
call setline(1,"#!/usr/bin/env bash")
call append(1,"# -*- coding: utf-8 -*-")
call append(2,"#Filename: " . expand("%"))
call append(3,"#Author: Liuchao")
call append(4,"#Email: 137642091@qq.com")
call append(5,"#Date: " . strftime("%Y-%m-%d"))
call append(6,"#Desc: ")
call append(7,"")
call append(8,"source /devOps/shell/common/functions")
call append(9," ")
endf
3.shell的高亮显示