my neovim init.vim

set number
set relativenumber
set shiftwidth=4
set tabstop=4
set softtabstop=4
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set autoindent
set cursorline
set wildmenu
set showmatch
set showcmd
set list
set laststatus=2
set ruler
set magic
set mouse=a
set hlsearch
exec "nohlsearch"
set incsearch
set ignorecase

syntax on

call plug#begin('~/.config/nvim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'connorholyday/vim-snazzy'
Plug 'neomake/neomake'
Plug 'scrooloose/nerdtree'
"语法检查
Plug 'neomake/neomake'
" 自动补全
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
" 括号匹配
Plug 'jiangmiao/auto-pairs'
Plug 'majutsushi/tagbar',{'on' : 'TagbarOpenAutoClose'}
Plug 'w0rp/ale'
Plug 'Valloric/YouCompleteMe'
Plug 'scrooloose/nerdtree',{'on' : 'NERDTreeToggle'}
Plug 'Xuyuanp/nerdtree-git-plugin'
call plug#end()

color snazzy
let g:SnazzyTransparent = 1
let &t_ut = ''

"当新建.hpp .cpp .mk .sh等文件时自动调用SetTitle 函数  
autocmd BufNewFile *.[ch],*.hpp,*.cpp,Makefile,*.mk,*.sh exec ":call SetTitle()"   

" 加入注释   
func SetComment()  
call setline(1,"/*****************************************************************")   
call append(line("."),   "*   Copyright (C) ".strftime("%Y")." FBI WARNING. All rights reserved.")  
call append(line(".")+1, "*   ")   
call append(line(".")+2, "*   文件名称:".expand("%:t"))   
call append(line(".")+3, "*   创 建 者:Sole")  
call append(line(".")+4, "*   创建日期:".strftime("%Y年%m月%d日"))   
call append(line(".")+5, "*   描    述:")   
call append(line(".")+6, "*")  
call append(line(".")+7, "*****************************************************************/")   
call append(line(".")+8, "")  
call append(line(".")+9, "")  
endfunc  

" 加入shell,Makefile注释  
func SetComment_sh()  
call setline(3, "#================================================================")   
call setline(4, "#   Copyright (C) ".strftime("%Y")." FBI WARNING. All rights reserved.")  
call setline(5, "#   ")   
call setline(6, "#   文件名称:".expand("%:t"))   
call setline(7, "#   创 建 者:Sole")  
call setline(8, "#   创建日期:".strftime("%Y年%m月%d日"))   
call setline(9, "#   描    述:")   
call setline(10, "#")  
call setline(11, "#================================================================")  
call setline(12, "")  
call setline(13, "")  
endfunc   

" 定义函数SetTitle,自动插入文件头   
func SetTitle()  

if &filetype == 'make'   
call setline(1,"")   
call setline(2,"")  
call SetComment_sh()  

elseif &filetype == 'sh'   
call setline(1,"#!/system/bin/sh")   
call setline(2,"")  
call SetComment_sh()  

else  
call SetComment()  
if expand("%:e") == 'hpp'   
call append(line(".")+10, "#define _".toupper(expand("%:t:r"))."_H")   
call append(line(".")+11, "#ifdef __cplusplus")   
call append(line(".")+12, "extern \"C\"")   
call append(line(".")+13, "{")   
call append(line(".")+14, "#endif")   
call append(line(".")+15, "")   
call append(line(".")+16, "#ifdef __cplusplus")   
call append(line(".")+17, "}")   
call append(line(".")+18, "#endif")   
call append(line(".")+19, "#endif //".toupper(expand("%:t:r"))."_H")   

elseif expand("%:e") == 'h'   
call append(line(".")+10, "#pragma once")   

elseif &filetype == 'c'   
call append(line(".")+10,"#include <stdio.h>")
call append(line(".")+11,"")
call append(line(".")+12,"int main(int argc,char *argv[])")
call append(line(".")+13,"{")
call append(line(".")+14,"\treturn 0;")
call append(line(".")+15,"}")

elseif &filetype == 'cpp'   
call append(line(".")+10, "#include \"".expand("%:t:r").".h\"")   

endif  

endif  
endfunc  

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值