Xinu

Vim基础常用配置
Vim基础常用配置set number " 开启行号显示 set encoding=utf-8 &quo...
扫描右侧二维码阅读全文
19
2019/04

Vim基础常用配置

Vim基础常用配置

set number " 开启行号显示
set encoding=utf-8 " default unicode 
set tabstop=2 " 按下tab时 vim显示的空格数
set expandtab " 空格代替Tab
syntax on " 语法高亮
set showcmd " 命令模式下,在底部显示,当前键入的指令
" set mouse=a " 支持鼠标
set t_Co=256 " 启用256色
filetype indent on
set autoindent " 自动缩进
set softtabstop=4 " 一个tab=4 空格
set textwidth=120 " 单行显示字符串
set wrap " 自动折行
set linebreak " 不在单词内部折行
set showmatch " 自动高亮括号
set ignorecase " 搜索忽略大小写
set spell spelllang=en_us
set noerrorbells " 出错时不发生响声
func SetPyTitle()
        call setline(1, "\#!/usr/bin/python")
        call setline(2, "\# -*- coding=utf8 -*-")
        call setline(3, "\"\"\"")
        call setline(4, "\# @Author : Xinu ")
        call setline(5, "\# @Email : x-ssh@outlook.com")
        call setline(6, "\# @Created Time : ".strftime("%Y-%m-%d %H:%M:%S"))
        call setline(7, "\# @Description : ")
        call setline(8, "\"\"\"")
        normal G
        normal o
        normal o
endfunc 
autocmd bufnewfile *.py call SetPyTitle()
func SetPhpTitle()
        call setline(1, "<?php")
        call setline(2, "/**")
        call setline(3, "* @Author: Xinu x-ssh@outlook.com https://xbug.top")
        call setline(4, "* @Created Time : " .strftime("%Y-%m-%d %H:%M:%S"))
        call setline(5, "* @Description : ")
        call setline(6, "*/")
        normal G
        normal o
        normal o
endfunc 
autocmd bufnewfile *.php call SetPhpTitle()

创建.py文件和.php会自动生成头部信息

Last modification:April 19th, 2019 at 01:33 pm

Leave a Comment