vim配置

syntax on  
"去掉有关vi一致性模式,避免以前版本的一些bug和局限  
 set nocompatible  
 set tags=./tags;
if has("gui_running")
    colorscheme wombat
else
    colorscheme wombat
endif
 set guifont=Monospace\ 11
"显示行号  
  set number  
"检测文件的类型  
  filetype on  
"记录历史的行数  
  set history=1000  
"vim使用自动对起,也就是把当前行的对起格式应用到下一行  
  set autoindent  
"依据上面的对起格式,智能的选择对起方式,对于类似C语言编  
  set smartindent  
"设置Windows风格的C/C++自动缩进,第一行设置tab键为4个空格,第二行设置当行之间交错时使用4个空格  
  set tabstop=4  
  set shiftwidth=4  
"设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号  
  set showmatch  
"去除vim的GUI版本中的toolbar  
  set guioptions-=T  
"在编辑过程中,在右下角显示光标位置的状态行  
  set ruler  
"默认情况下,寻找匹配是高亮度显示的,该设置关闭高亮显示  
  set nohls  
"使用此设置会快速找到答案,当你找要匹配的单词时,别忘记回车  
  set incsearch  
"如果没有下列行,加上吧  
  if &term=="xterm"  
  set t_Co=8  
  set t_Sb=^[[4%dm  
  set t_Sf=^[[3%dm  
  endif

function Mytitle()
call setline(1,"/**********************************************")
call append(line("."),"作者:author")
call append(line(".")+1,"时间:".strftime("%c"))
call append(line(".")+2,"文件名:".expand("%"))
call append(line(".")+3,"描述:")
call append(line(".")+4,"**********************************************/")
endf
map <home> <Esc>:call Mytitle()<CR><Esc>:$<Esc>o


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTags的设定
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 按照名称排序
let Tlist_Sort_Type = "name"

" 在右侧显示窗口
let Tlist_Use_Right_Window = 1

" 压缩方式
let Tlist_Compart_Format = 1

" 如果只有一个buffer,kill窗口也kill掉buffer
let Tlist_Exist_OnlyWindow = 1

" 不要关闭其他文件的tags
let Tlist_File_Fold_Auto_Close = 0

" 不要显示折叠树
let Tlist_Enable_Fold_Column = 0


" Check the syntax of a PHP file
function! CheckPHPSyntax()
    if &filetype != 'php'
        echohl WarningMsg | echo 'This is not a PHP file !' | echohl None
    return
    endif
    setlocal makeprg=php\ -l\ -n\ -d\ html_errors=off\ %
    setlocal errorformat=%m\ in\ %f\ on\ line\ %l
    echohl WarningMsg | echo 'Syntax checking output:' | echohl None
    if &modified == 1
        silent write
    endif
    silent make
    clist
endfunction
au filetype php map <F5> :call CheckPHPSyntax()<CR>
au filetype php imap <F5> <ESC>:call CheckPHPSyntax()<CR>

:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i

function! ClosePair(char)
    if getline('.')[col('.') - 1] == a:char
        return "\<Right>"
    else
        return a:char
    endif
endfunction

let NERDTreeWinSize = 28 "size of the NERD tree"
nmap <F2> <ESC>:NERDTreeToggle<RETURN>

nmap <F3> <ESC>:TlistToggle<RETURN>

map <F4> :!/usr/local/app/php/bin/php -l %<CR>

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值