Chinaunix首页 | 论坛 | 博客
  • 博客访问: 140905
  • 博文数量: 56
  • 博客积分: 245
  • 博客等级: 二等列兵
  • 技术积分: 520
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-08 14:43
个人简介

慢慢来

文章分类

全部博文(56)

文章存档

2017年(5)

2016年(2)

2015年(6)

2014年(28)

2013年(5)

2012年(10)

我的朋友

分类: 其他平台

2014-12-19 14:25:22

[myang@mnsdev13:~]$ cat .vimrc
set nu
set hlsearch
set nocompatible        " Vim settings, not Vi settings.  must be first


let Tlist_Ctags_Cmd='/usr/local/bin/ctags'
" set options {{{
let loaded_matchparen = 1 " prevent paren matching plugin from loading
set backspace=indent,eol,start " backspacing over everything in insert mode
set bufhidden=hide      " don't unload buffer when it no longer has an open win
set hidden              " don't unload curr buffer when switching to another buf
set laststatus=2        " last window has status line always
set noautoindent        " always set autoindenting off
set expandtab           " tabs are actually spaces instead of \t
set history=300         " number of lines of command line history
set winheight=10        " min window height for the current window
set winminheight=0      " min window height when not the current window
set ruler               " show the cursor position all the time
set showcmd             " display incomplete commands
set incsearch           " do incremental searching
set noeb                " lose the freaking error bell
set vb t_vb=            " lose the freaking error bell
set guioptions-=T       " lose the toolbar
set guioptions-=m       " lose the menu
set guioptions-=r       " lose the scrollbar
set gfn=andale\ mono\ 8
set gcr=a:blinkoff0
set mousehide                 " Hide the mouse when typing text
set tabstop=4
set shiftwidth=4
set paste
set sm                  " match { and }
set nowrap              " no wrapping of long lines
set display+=lastline   " a nicer way to show long wrapped lines
set noea                " do not equalize windows


if &term =~ "xterm"
  if has("terminfo")
    set t_Co=8
    set t_Sf=1%dm
    set t_Sb=1%dm
  else
    set t_Co=8
    set t_Sf=m
    set t_Sb=m
  endif
endif
" }}}
" misc {{{
let mapleader = ";"
map Q gq                    " don't use Ex mode, use Q for formatting
syntax on
" }}}


" autocommands {{{
" Only do this part when compiled with support for autocommands.
if has("autocmd")


   " Enable file type detection.
   " Use the default filetype settings, so that mail gets 'tw' set to 72,
   " 'cindent' is on in C files, etc.
   " Also load indent files, to automatically do language-dependent indenting.
   filetype plugin indent on


   " For all text files set 'textwidth' to 78 characters.
   autocmd FileType text setlocal textwidth=78


   " When editing a file, always jump to the last known cursor position.
   " Don't do it when the position is invalid or when inside an event handler
   " (happens when dropping a file on gvim).
   autocmd BufReadPost *
      \ if line("'\"") > 0 && line("'\"") <= line("$") |
      \   exe "normal g`\"" |
      \ endif


   " Remove trailing blanks when writing buffer
   autocmd BufWritePre * call s:RemoveTrailingBlanks()


   " Use syntax folding w/these languages.
   " autocmd Syntax java,c,cpp,xml call s:SetSyntaxFolding()
   " autocmd BufEnter \[Tag List\] setlocal foldmethod=manual




   autocmd BufReadPost * exe "normal \_"




endif " has("autocmd")
" }}}


" mappings {{{


" Make p in Visual mode replace the selected text with the "" register.
vnoremap p :let current_reg = @"gvs=current_reg


"map  tl :Tlist      " tag list plugin
"imap
"map          h
"map  :w         :w!




" buffers {{{
map p :bp         " move to a previous buffer
map n :bn         " move to the next   buffer
map m :bm         " next modified      buffer
map f :bfirst     " move to first      buffer
map s :blast      " move to last       buffer
map d :bdelete    " delete             buffer
" }}}
" windows {{{
" map j :wincmd j " move down  a window
" map k :wincmd k " move up    a window
" map h :wincmd h " move left  a window
" map l :wincmd l " move right a window
" map c :cw       " move cursor to the compiler error window
map j j_    " move down  a window
map k k_    " move up    a window
map h h_    " move left  a window
map l l_    " move right a window
map x :q          " close      a window
" map p p_    " move cursor to the previous window
map P P_    " move cursor to the preview window
map t t_    " move cursor to the top window
map b b_    " move cursor to the bottom window


" fu! ToggleMaxWins ()
"    if exists ('g:windowMax')
"       au! maxCurrWin
"       exe "normal \="
"       unlet g:windowMax
"    else
"       augroup maxCurrWin
"       " au BufReadPost * exe "normal" \_\\"
"       "
"       " only max it vertically
"       au! BufReadPost * exe "normal \_"
"       augroup END
"       do maxCurrWin BufEnter
"       let g:windowMax=1
"    endif
" endfun
" map max :call ToggleMaxWins ()
" }}}
" xmms {{{
" map e :sp ~/Documents/playlist " edit xmms playlist
map a :call VIMRCaddToPlaylist() " add to xmms playlist


fu! VIMRCaddToPlaylist()
   normal "zyy
   let l:cwd = expand("%:p:h")
   let l:foo = substitute( @z, "\n", "", "g" )
"   let cmd = "! xmms -e '".l:cwd."/".l:foo."'"
   exe '! xmms -e "'.l:cwd.'/'.l:foo.'"'
endfun
" }}}
" trailing blanks {{{
" Mark with restoring screen position (by Benji Fisher)
fu s:Mark(...)
    if a:0 == 0
        let l:mark = line(".") . "G" . virtcol(".") . "|"
        normal! H
        let l:mark = "normal!" . line(".") . "Gzt" . l:mark
        execute l:mark
        return l:mark
    elseif a:0 == 1
        return "normal!" . a:1 . "G1|"
    else
        return "normal!" . a:1 . "G" . a:2 . "|"
    endif
endfun


" Remove trailing blanks but preserve sigdash lines
" Also preserve the trailing spaces in the current line
" Uses the Mark function above
fu s:RemoveTrailingBlanks()
    let l:m = s:Mark()
    " Double backslashes required because the expression is evaluated
    " before it's executed
    silent! execute "1,.-1s/\\(^-- $\\)\\|\\(\\s\\+$\\)/\\1/"
    execute l:m
    silent! execute ".+1,$s/\\(^-- $\\)\\|\\(\\s\\+$\\)/\\1/"
    execute l:m
endfun
" }}}
" autocomments {{{


" This autocomments the curly brackets when you type } #
imap } :call CurlyBracket()a
map } :call CurlyBracket()


fu CurlyBracket()
    let l:line_num = line(".")
    let l:is_match = searchpair('{', '', '}', 'bW')
    if (l:is_match > 0)
        let l:comment_string = substitute(getline("."), '^\s*\(.\{-}\)\s*{', '\1', "")
        sil exe ":" . l:line_num
        sil exe "normal a # " . l:comment_string
    endif
endfun


" }}}
" hex edit {{{


" vim -b : edit binary using xxd-format!
" augroup Binary
"   au!
"   au BufReadPre  *.db let &bin=1
"   au BufReadPost *.db if &bin | %!xxd
"   au BufReadPost *.db set ft=xxd | endif
"   au BufWritePre *.db if &bin | %!xxd -r
"   au BufWritePre *.db endif
"   au BufWritePost *.db if &bin | %!xxd
"   au BufWritePost *.db set nomod | endif
" augroup END


" }}}
" db_ext {{{
"    default_db_ext_type
"        - Default relational database to connect to
"    default_db_ext_user
"        - Default user id
"    default_db_ext_passwd
"        - Default password
"    default_db_ext_dbname
"        - Default database to connect to
"    default_db_ext_host
"        - Default host the server is running on
"    default_db_ext_port
"        - Default port to connect to
"    default_db_ext_use_result_buffer
"        - Whether to use the result buffer, or echo the results of the cmd
"    default_db_ext_use_sep_result_buffer
"        - Whether to use separate result buffers for each file
"    default_db_ext_buffer_lines
"        - How many lines the Result window should be
"    default_db_ext_parse_statements
"        - Which statements are parsed for input parameters (See section 6)
"    default_db_ext_variable_def
"        - List of variables and rules on how to search and prompt for variable
"          names within a statement that starts with any of the words listed in
"          db_ext_parse_statements.


let g:default_db_ext_type                  = 'ASE'
let g:default_db_ext_user                  = $DBU
let g:default_db_ext_passwd                = $DBP
let g:default_db_ext_dbname                = 'dse_feed'
let g:default_db_ext_srvname               = 'FISDB5'
"let g:default_db_ext_srvname               = 'HDSEDB1'
let g:default_db_ext_prompt_for_parameters = ''
let g:default_db_ext_parse_statements      = ''
let g:default_db_ext_ASE_cmd_terminator    = '\ngo'
let g:default_db_ext_buffer_lines          = 20


" }}}


" }}}


" vim:expandtab:shiftwidth=3:tabstop=3:foldmethod=marker:
set ruler
set scrolloff=3


set tags=/home/users/myang,/home/users/myang/dev
set autochdir


let Tlist_Show_One_File=1            " To display the tags for only the current file
"let Tlist_Use_Right_Window=1         " Put the taglist window in the right side
let Tlist_Exit_OnlyWindow=1          " To exit Vim when only the taglist window is present
let Tlist_Auto_Open=0                " autoopen the taglist window when vim is started
let NERDTreeWinPos=0                 " Put the NERD window in the let side
map :NERDTreeToggle
map :TlistToggle


阅读(496) | 评论(0) | 转发(0) |
0

上一篇:vim install

下一篇:Distinct VS. Group by

给主人留下些什么吧!~~