LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 888|回复: 3

我的VIMRC文件

[复制链接]
发表于 2010-6-8 20:08:33 | 显示全部楼层 |阅读模式
set nocompatible
" source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set nu
set wrap!
if has("gui_running")
    set lines=999
    set columns=999
endif
set sw=4
set expandtab
set smarttab

set backspace=eol,start,indent

" Platform
function! MySys()
  return "windows"
endfunction

"Set mapleader
let mapleader = ","
let g:mapleader = ","

set tags=./tags,tags,./**/tags,d:\GTK2\tags,d:\GTK1\tags

syntax enable

filetype plugin indent on

colorscheme Borland
 楼主| 发表于 2010-6-8 20:09:58 | 显示全部楼层
map <F2> :tabnew<CR>

"Tab configuration
map <leader>tn :tabnew
" map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove

""""""""""""""""""""""""""""""
" taglist setting
""""""""""""""""""""""""""""""
if MySys() == "windows"
  let Tlist_Ctags_Cmd = 'ctags'
elseif MySys() == "linux"
  let Tlist_Ctags_Cmd = '/usr/bin/ctags'
endif

let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Use_Right_Window = 1
nmap <silent> <leader>tl :Tlist<cr>

""""""""""""""""""""""""""""""
" winmanager setting
""""""""""""""""""""""""""""""
let g:winManagerWindowLayout = "BufExplorer,FileExplorer|TagList"
let g:winManagerWidth = 30
let g:defaultExplorer = 0
nmap <C-W><C-F> :FirstExplorerWindow<cr>
nmap <C-W><C-B> :BottomExplorerWindow<cr>
map <F8> :WMToggle<CR>

"Enable filetype plugin
filetype plugin on
filetype indent on

"Set to auto read when a file is changed from the outside
set autoread

"Have the mouse enabled all the time:
set mouse=a

"Fast saving
nmap <silent> <leader>ww :w<cr>
nmap <silent> <leader>wf :w!<cr>

"Fast quiting
nmap <silent> <leader>qw :wq<cr>
nmap <silent> <leader>qf :q!<cr>
nmap <silent> <leader>qq :q<cr>
nmap <silent> <leader>qa :qa<cr>

"Fast remove highlight search
nmap <silent> <leader><cr> :noh<cr>
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-8 20:10:57 | 显示全部楼层
"Fast redraw
nmap <silent> <leader>rr :redraw!<cr>

"Fast edit vimrc
if MySys() == 'linux'
    "Fast reloading of the .vimrc
    map <silent> <leader>ss :source ~/.vimrc<cr>
    "Fast editing of .vimrc
    map <silent> <leader>ee :call SwitchToBuf("~/.vimrc")<cr>
    "When .vimrc is edited, reload it
    autocmd! bufwritepost .vimrc source ~/.vimrc
elseif MySys() == 'windows'
    " Set helplang
    set helplang=cn
    "Fast reloading of the _vimrc
    map <silent> <leader>ss :source ~/_vimrc<cr>
    "Fast editing of _vimrc
    map <silent> <leader>ee :call SwitchToBuf("~/_vimrc")<cr>
    "When _vimrc is edited, reload it
    autocmd! bufwritepost _vimrc source ~/_vimrc
endif

""""""""""""""""""""""""""""""
" lookupfile setting
""""""""""""""""""""""""""""""
let gookupFile_MinPatLength = 2
let gookupFile_PreserveLastPattern = 0
let gookupFile_PreservePatternHistory = 0
let gookupFile_AlwaysAcceptFirst = 1
let gookupFile_AllowNewFiles = 0
if filereadable("./filenametags")
    let gookupFile_TagExpr = '"./filenametags"'
endif
nmap <silent> <leader>lk <lug>LookupFile<cr>
nmap <silent> <leader>ll UBufs<cr>
nmap <silent> <leader>lw UWalk<cr>

" lookup file with ignore case
function! LookupFile_IgnoreCaseFunc(pattern)
    let _tags = &tags
    try
        let &tags = eval(gookupFile_TagExpr)
        let newpattern = '\c' . a:pattern
        let tags = taglist(newpattern)
    catch
        echohl ErrorMsg | echo "Exception: " . v:exception | echohl NONE
        return ""
    finally
        let &tags = _tags
    endtry

    " Show the matches for what is typed so far.
    let files = map(tags, 'v:val["filename"]')
    return files
endfunction
let gookupFile_LookupFunc = 'LookupFile_IgnoreCaseFunc'
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-8 20:11:38 | 显示全部楼层
map <C-Tab> :tabnew<CR>
map <C-Left> :tabp<CR>
map <C-Right> :tabnext<CR>

imap <C-Tab> <Esc>:tabnew<CR>i
imap <C-Left> <Esc>:tabp<CR>i
imap <C-Right> <Esc>:tabnext<CR>i

map <silent> <F5> ookupFile<cr>
map <silent> <F7> UTags<CR>

"imap <silent> <F5> <Esc>ookupFile<cr>
imap <silent> <F7> <Esc>UTags<CR>

let OmniCpp_GlobalScopeSearch = 1

source $VIMRUNTIME/games/tetris.vim

command! GotoLine call GotoLine()

" quick go to line
function! GotoLine()
    let lineno = inputdialog("Go to Line:",line("."))
    if lineno != ""
        let lineno = str2nr(lineno)
        execute "normal " lineno."G"
    endif
endfunction

autocmd! bufwritepost _vimrc source $VIMRUNTIME/../_vimrc

map  <C-G> :GotoLine<CR>
imap <C-G> <Esc>:GotoLine<CR>
vmap <C-G> <Esc>:GotoLine<CR>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表