"BASIC SETTINGS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nu
set showmatch " 高亮显示匹配的括号
set matchtime=6 " 匹配括号高亮的时间(单位是十分之一秒)
set scrolloff=11 " 光标移动到buffer的顶部和底部时保持10行距离
set novisualbell " 不要闪烁
set hlsearch " 高亮搜索
set nowrapscan " 查找到文件头或文件尾时停止
set clipboard=unnamedplus " 共享剪切板
set showcmd " 输入的命令显示出来
set iskeyword+=_,$,@,%,#,- " 带有如下符号的单词不要被换行分割
set noexpandtab " 不用空格代替Tab (makefile是会经常用Tab的)
set tabstop=5 " Tab 键的宽度
set shiftwidth=5 " 行交错宽度
set mouse=a " 鼠标可用
set autoindent " 继承前一行的缩进方式,特别适用于多行注释
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set fdm=marker "set default foldmethod
set fdm=indent "set default foldmethod
"set fdm=marker
"set foldmethod=manual
"set foldmethod=syntax
"set foldlevel=99
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"THE FILE OF LULU
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Copycat: lulu
" Version: 4.2.3
" Install: 在linux和windows下无需改动配置文件的内容,对应配置文件夹是vim_4
" 在linux下在 ~/ 目录下,配置文件名改成 .vimrc,路径为 ~/.vimrc
" 配置文件夹名改成 .vim,路径为 ~/.vim
" 在windows下在 $(vim)/ 目录下,配置文件名改成 _vimrc,路径为 Vim/_vimrc
" 配置文件夹名改成 vimfiles,路径为 Vim/vimfiles
" NoBugs: windows下 taglist使用有问题已修复
" Time: 2013.8.3
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 文本格式和排版
"
set formatoptions=tcrqn " 自动格式化
set autoindent " 继承前一行的缩进方式,特别适用于多行注释
set smartindent " 为C程序提供自动缩进
set cindent " 使用C样式的缩进
set smarttab " 在行和段开始处使用制表符
"set tabstop=4 " 制表符为4
"set softtabstop=4 " 统一缩进为4
"set shiftwidth=4
"set noexpandtab " 不要用空格代替制表符
"set nowrap " 不要换行
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 搜索和匹配
"
set showmatch " 高亮显示匹配的括号
set matchtime=5 " 匹配括号高亮的时间(单位是十分之一秒)
set scrolloff=10 " 光标移动到buffer的顶部和底部时保持10行距离
set novisualbell " 不要闪烁
set hlsearch " 高亮搜索
set nowrapscan " 查找到文件头或文件尾时停止
"set incsearch " 边输入边查找
"set laststatus=2 " 总是显示状态行
"set ignorecase " 在搜索的时候忽略大小写
"set statusline=%F%m%r%h%w\[POS=%l,%v][%p%%]\%{strftime(\”%d/%m/%y\ -\ %H:%M\”)}
" 我的状态行显示的内容(包括文件类型和解码)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 文件设置
"
set shortmess=atI " 启动的时候不显示那个援助索马里儿童的提示`
set report=0 " 通过使用: commands命令,告诉我们文件的哪一行被改变过
set noerrorbells " 不让vim发出讨厌的滴滴声
set fillchars=vert:\ ,stl:\ " 在被分割的窗口间显示空白,便于阅读 ,stlnc:加了这个wm分割兰有
set mouse=a " 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
set selection=exclusive
"set selectmode=mouse,key
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 一般设置
"
set viminfo+=! " 保存全局变量
set history=300 " history文件中需要记录的行数
set nocompatible " 不要使用vi的键盘模式,而是vim自己的
"set foldmethod=syntax
"set foldlevel=100 " 启动vim时不要自动折叠代码
"set nu
set fileencodings=utf-8,gbk
set ruler
set showmatch " 高亮显示匹配的括号
filetype on " 侦测文件类型
"set nobackup " 不要备份文件(根据自己需要取舍)
"set backup
syntax enable
syntax on " 语法高亮
set magic " 设置正表达式
set backspace=indent,eol,start " 这指明在插入模式下在哪里允许 <BS> 删除光标前面的字符。
" 逗号分隔的三个值分别指:行首的空白字符,换行符和插入模式开始处之前的字符。
set showcmd " 在 Vim 窗口右下角,标尺的右边显示未完成的命令
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" taglist
"
let Tlist_Use_Right_Window = 0 " 在左侧显示窗口
let Tlist_Compart_Format = 1 " 压缩方式
let Tlist_Exist_OnlyWindow = 1 " 如果只有一个buffer,kill窗口也kill掉buffer
let Tlist_File_Fold_Auto_Close = 0 " 不要关闭其他文件的tags
let Tlist_Enable_Fold_Column = 0 " 不要显示折叠树 (鼠标可以点开)
nmap <silent> <leader>tl :Tlist<cr>
if has("win32")
let Tlist_Ctags_Cmd = ' ctags' "windows下必须空3个字符,否则解析成gs
else
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" GUI
"
if has("gui_running") " 如果是图形界面
set guioptions=m " 关闭菜单栏
set guioptions=t " 关闭工具栏
" set guioptions=L " 启动左边的滚动条
" set guioptions+=r " 启动右边的滚动条
" set guioptions+=b " 启动下边的滚动条
set clipboard+=unnamed " 共享剪贴板
if has("win32")
colorscheme torte " torte配色方案
set guifont=Consolas:h11 " 字体和大小
endif
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"SET Comment START
autocmd BufNewFile *.php,*.js,*.cpp exec ":call SetComment()" |normal 10Go
func SetComment()
if expand("%:e") == 'php'
call setline(1, "<?php")
elseif expand("%:e") == 'js'
call setline(1, '//JavaScript file')
elseif expand("%:e") == 'cpp'
call setline(1, '//C++ file')
endif
call append(1, '#***********************************************')
call append(2, '#')
call append(3, '# Filename: '.expand("%"))
call append(4, '#')
call append(5, '# Author: Mr.SS - yahaha@gmail.com')
call append(6, '# Description: ---')
call append(7, '# Create: '.strftime("%Y-%m-%d %H:%M:%S"))
call append(8, '# Last Modified: '.strftime("%Y-%m-%d %H:%M:%S"))
call append(9, '#***********************************************')
" call append(10, '')
endfunc
map <F2> :call SetComment()<CR>:10<CR>o
"SET Comment END
"SET Last Modified Time START
func DataInsert()
call cursor(9,1)
if search ('Last Modified') != 0
let line = line('.')
call setline(line, '# Last Modified: '.strftime("%Y-%m-%d %H:%M:%S"))
endif
endfunc
autocmd FileWritePre,BufWritePre *.php,*.js,*.cpp ks|call DataInsert() |'s
"SET Last Modified Time END
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""