、设置家目录下的.vimrc内容为一下:
set ignorecase
set cursorline
set autoindent
set sw=4 # shiftwidth=4
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1,"#!/bin/bash")
call setline(2,"#")
call setline(3,"#********************************************************************")
call setline(4,"#Author: zhangshang")
call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(8,"#URL: http://blog.vservices.top/myblog")
call setline(9,"#Description: The test script")
call setline(10,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(11,"#********************************************************************")
call setline(12,"")
endif
endfunc
autocmd BufNewFile * normal G
每次在生成空的新脚本时,就会自动添加标题头,很方便吧。
set ignorecase :在vim中搜索忽略大小写
set cursorline :开启下划线
set autoindent : 开启自动缩进模式
set sw=4 :设置默认缩进的大小为4列
还有更多的vim参数设置,在需要用到的设置的时候可以参考一下
这个哥们写的还挺好,直接把链接粘过来了
文档更新时间: 2018-12-13 18:35 作者:张尚