my vimrc

#!/bin/bash

cd /home/tyson/hxfan
if [ -e tags ]
then
    rm -f tags
fi

if [ -e cscope.files ]
then
    rm -f cscope.files
fi

if [ -e cscope.out ]
then
    rm -f cscope.out
fi

ctags -R .
find . -name '*.h' -o -name '*.c' -o -name '*.cpp' > cscope.files
cscope -b


" ==========================================================================
" BASIC SETTINGS
" --------------

" show the line number on the left side
set number
" set the length when press tab.
set tabstop=4
" set the length when format text.
set shiftwidth=2
" expand tab key with 4 space.
set expandtab
" paste ok
set paste
" do not compatible with Vi.
set nocompatible
" show the line number and percentage of current position
set ruler
" set the default path for find command.
" the current folder and recursive folders.
set path=.,**,
" set the diff option
set diffopt=vertical,filler,context:5

" 设置按c语言格式对齐
set cindent    
" 设置自动换行时缩进4个空格
set shiftwidth=4        

" set autochdir
set tags=/home/tyson/hxfan/tags;
let Tlist_Show_One_File = 1
let Tlist_Exist_OnlyWindow = 1
let Tlist_Use_Right_Window = 1
let Tlist_Sort_Type = "order"
let Tlist_WinWidth = 40
let Tlist_GainFocus_On_ToggleOpen = 1
nmap  tm    :TlistToggle<CR>


" set the encoding for windows text format.
let &termencoding=&encoding
set fileencodings=ucs-bom,utf-8,cp936,gbk,gb18030,chinese,big5,euc-jp,euc-kr,latin1

" set nobackup
set writebackup
set backupext=.bak

filetype plugin on
"so $VIMRUNTIME/syntax/sh.vim
"so $VIMRUNTIME/syntax/cpp.vim
syntax enable
syntax on
colorscheme desert

set wildignore+=*.o,*.a,*.so,*.obj,*.exe,*.lib,*.ncb,*.opt,*.plg,.svn,.git

" show status
set laststatus=2

" ==========================================================================
" FUNCTIONS
" --------------

highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue
function! CurDir()
    let curdir = getcwd()
    return curdir
endfunction
set statusline=[%n]\ %f\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\

command -bang -nargs=? QFix call QFixToggle(<bang>0)
function! QFixToggle(forced)
  if exists("g:qfix_win") && a:forced == 0
    cclose
    unlet g:qfix_win
  else
    copen 10
    let g:qfix_win = bufnr("$")
  endif
endfunction


" ==========================================================================
" MAP SETTINGS
" --------------

" move among splitted windows
noremap <silent> <C-h> <C-w>h
noremap <silent> <C-j> <C-w>j
noremap <silent> <C-k> <C-w>k
noremap <silent> <C-l> <C-w>l

" nnoremap <silent> <F1>  :so $VIMRUNTIME/syntax/cpp.vim<CR>
nnoremap          <C-N> :tabnew
nnoremap          <C-C> :tabclose<CR>
nnoremap          <C-D> gt

" grep
command!GTF             :execute 'vimgrep '.expand('<cword>').' '.expand('%') | :copen
nnoremap          <S-F> :GTF<CR>
nnoremap <silent> <F2>  :QFix<CR>
nnoremap <silent> <S-L> :Matrix<CR>
nmap              wm    :NERDTreeToggle<CR>


if has("cscope")
    set cscopequickfix=s-,c-,d-,i-,t-,e-
    "set csto=0
    "set cst
    "set csverb
endif
":cs add ./cscope.out
":cs add /vobs/gsn/product/code/business_specific/gts/cscope.out
":cs add /vobs/gsn/product/code/sgsn-gt/mts/cscope.out

nmap wg :cs find g <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap wc :cs find c <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap wt :cs find t <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap wf :cs find f <C-R>=expand("<cfile>")<CR><CR>:copen<CR>

nmap <F3> :call Do_CsTag()<CR>











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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值