我的vim个性配置
来源:互联网 发布:开源的java cms系统 编辑:程序博客网 时间:2024/04/27 17:05
"2015年 10月 15日 星期四 15:04:20 EDT
set shiftwidth=8
set tabstop=8
set autoindent
"2015.2.1 creat Makefile Template
autocmd BufNewFile Makefile 0r /home/dd/Template/Makefile
"2015.2.1 光标移动到buffer的顶部和底部式保持3行距离
set scrolloff=3
"2015.2.1 creat file templates
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.cc,*.[ch],*.sh,*.java exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Function: ")
call append(line(".")+2, "\# Author: SongDong")
call append(line(".")+3, "\# mail: songdongjob@163.com")
call append(line(".")+4, "\# Created Time: ".strftime("%c"))
call append(line(".")+5, "\#########################################################################")
call append(line(".")+6, "\#!/bin/bash")
call append(line(".")+7, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), "> File Name: ".expand("%"))
call append(line(".")+1, "> Function: ")
call append(line(".")+2, "> Author: SongDong")
call append(line(".")+3, "> Mail: songdongjob@163.com")
call append(line(".")+4, "> Created Time: ".strftime("%c"))
call append(line(".")+5, "> Version: v1.0")
call append(line(".")+6, " ************************************************************************/")
call append(line(".")+7, "")
endif
if &filetype == 'cpp' || 'cc'
call append(line(".")+8, "#include <iostream>")
call append(line(".")+9, "using namespace std;")
call append(line(".")+10, " ")
call append(line(".")+11, "int main(int argc, char *argv[])")
call append(line(".")+12, "{")
call append(line(".")+13, " return 0;")
call append(line(".")+14, "}")
endif
if &filetype == 'c'
call append(line(".")+8, "#include <stdio.h>")
call append(line(".")+9, "")
call append(line(".")+10, "int main(int argc, char *argv[])")
call append(line(".")+11, "{")
call append(line(".")+12, " return 0;")
call append(line(".")+13, "}")
endif
" if &filetype == 'java'
" call append(line(".")+6,"public class ".expand("%"))
" call append(line(".")+7,"")
" endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"凸显当前行
set cursorline
set shiftwidth=8
set tabstop=8
set autoindent
"2015.2.1 creat Makefile Template
autocmd BufNewFile Makefile 0r /home/dd/Template/Makefile
"2015.2.1 光标移动到buffer的顶部和底部式保持3行距离
set scrolloff=3
"2015.2.1 creat file templates
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.cc,*.[ch],*.sh,*.java exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Function: ")
call append(line(".")+2, "\# Author: SongDong")
call append(line(".")+3, "\# mail: songdongjob@163.com")
call append(line(".")+4, "\# Created Time: ".strftime("%c"))
call append(line(".")+5, "\#########################################################################")
call append(line(".")+6, "\#!/bin/bash")
call append(line(".")+7, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), "> File Name: ".expand("%"))
call append(line(".")+1, "> Function: ")
call append(line(".")+2, "> Author: SongDong")
call append(line(".")+3, "> Mail: songdongjob@163.com")
call append(line(".")+4, "> Created Time: ".strftime("%c"))
call append(line(".")+5, "> Version: v1.0")
call append(line(".")+6, " ************************************************************************/")
call append(line(".")+7, "")
endif
if &filetype == 'cpp' || 'cc'
call append(line(".")+8, "#include <iostream>")
call append(line(".")+9, "using namespace std;")
call append(line(".")+10, " ")
call append(line(".")+11, "int main(int argc, char *argv[])")
call append(line(".")+12, "{")
call append(line(".")+13, " return 0;")
call append(line(".")+14, "}")
endif
if &filetype == 'c'
call append(line(".")+8, "#include <stdio.h>")
call append(line(".")+9, "")
call append(line(".")+10, "int main(int argc, char *argv[])")
call append(line(".")+11, "{")
call append(line(".")+12, " return 0;")
call append(line(".")+13, "}")
endif
" if &filetype == 'java'
" call append(line(".")+6,"public class ".expand("%"))
" call append(line(".")+7,"")
" endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"凸显当前行
set cursorline
"set magic
vim中Ctrl+s 锁死屏幕,Ctrl+q解锁,
0 0
- 我的vim个性配置
- VIM的安装和个性配置
- 我的Vim配置
- 我的vim配置
- 我的vim配置
- 我的VIM配置
- 我的Vim配置
- 我的vim配置
- 我的 vim 配置
- 我的vim配置
- 我的vim配置
- 我的vim配置
- 我的vim配置
- 我的vim配置
- 我的vim配置
- 我的vim配置
- 我的VIM配置
- 我的vim配置
- SpringMVC学习系列(3) 之 URL请求到Action的映射规则
- no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
- 【Android】关于Android Studio 开启断言assert
- 递归算法的学习
- iOS9适配中出现的问题整理
- 我的vim个性配置
- 关于安装php时 --with-mysql命令参数问题
- Android 虚拟按键 Recent键屏蔽(隐藏)
- JSP中include用法中出现的500错误
- near、far、huge三个指针的区别
- Java自带线程池
- Dos常用命令细解
- 两个静态页面之间进行存取值
- SMI-S规范介绍