set langmenu=en_US
let $LANG = 'en_US'
syntax on
set nocompatible
set ai
set textwidth=0 ""disable line auto broken
set hlsearch
set incsearch
set magic
"set scrolloff=3 ""to see more context above and below the cursor
set lz " do not redraw while running macros (much faster) (LazyRedraw)
"set shell=csh\ -f
if has("win32")
set backupdir=c:/tmp/vim
set guifont=Lucida_Console:h11:b:cANSI
let myfile = $VIMRUNTIME."/colors/my_murphy.vim"
else
set backupdir=~/tmp/vim
set guifont=MiscFixed\ 12
"set guifont=MiscFixed\ Bold\ 11
let myfile = $HOME."/.vim/colors/my_murphy.vim"
endif
if filereadable(myfile)
colorscheme my_murphy
else
colorscheme murphy
endif
so $VIMRUNTIME/mswin.vim
"set nu ""disable line_number for TERM as it is not intended when copying
set vb t_vb= ""disable any boring beep or flash. Need to set in .gvimrc to make it really work for GUI.
"set autochdir ""don't change working dir automatically for TERM
set nowrap
set backup ""I also need non-default backupdir
set viminfo='10,:20,%,n~/.viminfo ""same viminfo: 'files w marks, :cmd his num,
"set mouse=a
"set mouse=nvc
"set mousemodel=extend
"set nowrapscan
set more
set ve=block
set vb t_vb= " no beep or flash
set fillchars=stl:^,stlnc:-,vert:\|,fold:-,diff:- " better spacing btwn windows
set showmatch "" When a bracket is inserted, briefly jump to the matching one.
set matchtime=5
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif
set wildmode=list:full "" Completion mode: When more than one match, list all matches and complete first match.
set wildmenu "" command-line completion operates in an enhanced mode:
" syn keyword myTodo todo contained
" highlight def link myTodo Todo
"" highlight my favorites
match Todo /\c\
set ru "" Show the line and column number of the cursor position
if version >= 700
set cul "" Highlight the screen line of the cursor with CursorLine
endif
"set cuc "" Highlight the screen column of the cursor with CursorColumn
"" a: Autoselect, Visually highlighted text is available for pasting into other applications as well as into Vim itself
"" b: Bottom (horizontal) scrollbar is present
set guioptions+=abrh
set guioptions-=L "" L: Left-hand scrollbar is present when there is a vertically
set foldmethod=indent
set foldlevelstart=1
"let b:did_ftplugin = 1 ""This disables loading of default plugin completely
autocmd FileType python source ~/.vim/ftplugin/python.vim
"" {{{balloon control
if version >= 700
set ballooneval "" ballon control
fun! FoldSpellBalloon()
let foldStart = foldclosed(v:beval_lnum )
let foldEnd = foldclosedend(v:beval_lnum)
let lines = []
let maxlinenum=60
" Detect if we are in a fold
if foldStart < 0
" Detect if we are on a misspelled word
let lines = spellsuggest( spellbadword(v:beval_text)[ 0 ], 5, 0 )
else
" we are in a fold
let numLines = foldEnd - foldStart + 1
" if we have too many lines in fold, show only the first half_of_max
" and the last half_of_max lines
if ( numLines >= maxlinenum )
let lines = getline( foldStart, foldStart + maxlinenum/2 - 1 )
let lines += [ '..............' ]
let lines += [ '[-- Snipped ' . ( numLines - maxlinenum ) . ' lines --]' ]
let lines += [ '..............' ]
let lines += getline( foldEnd - maxlinenum/2 + 1, foldEnd )
else
"less than maxlinenum lines, lets show all of them
let lines = getline( foldStart, foldEnd )
endif
endif
" return result
return join( lines, has( "balloon_multiline" ) ? "\n" : " " )
endfun
set balloonexpr=FoldSpellBalloon()
set balloondelay=400
"" settings invalid for the KDE, GTK+ or Win32
"set tooltipForeground=
"set tooltipBackground=
"set tooltipFont=
"set balloonevalcode 59
endif
""}}}balloon control
function! ShortStr(str,max_len)
let max_len_lead = a:max_len/2
let total_len=strlen(a:str)
let trim_str = a:str
if total_len > a:max_len
let trim_str = strpart(a:str, 0, max_len_lead) . ".." . strpart(a:str, total_len - a:max_len + max_len_lead + 2)
endif
return trim_str
endfunction
function! CurDir()
let homedir = '/home/'.$USER
let curdir = substitute(getcwd(), homedir, "~", "g")
let curdir=ShortStr(curdir, 18)
return curdir . "/"
endfunction
"set ruler "" overridden by statusline ""Show the line and column number of the cursor position
"set rulerformat=%20(%2*%<%f%=" %m%r" %3l" %c" %p%%%)
"" {{{statusline control
if filereadable(myfile)
"set statusline=%F%m%r%h%w" [FORMAT=%{&ff}]" [TYPE=%Y]" [POS=%l,%v][%p%%]" %{strftime(""%d/%m/%y" -" %H:%M"")}
"set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
"set statusline=%F%m%r%h%w\ -\ ascii=x\%02.2B,\ pos=%05l,%3v\ (%p%%\ of\ %L\ lines)
set statusline= ""overwrite any existent statusline
set statusline+=%#StatusLineB1#%f%m%r%h%w%0* ""short name
set statusline+=%#StatusLineB2#[BUF:%-1.2n]%0* ""buffer number
set statusline+=%#StatusLineB3#[%{&fileformat}]%0* ""fileformat
set statusline+=%= ""spacer
"set statusline+=%#StatusLineB3#[%{CurDir()}]%0* ""fileformat
set statusline+=%#StatusLineB4#[%p%%]%0* ""position percentage
set statusline+=%#StatusLineB5#[pos=%05l,%3v]%0* ""horizontal/vertical position
set statusline+=%#StatusLineB6#[LEN=%L]%0* ""total line number
set statusline+=%< ""Left aligned to see file name all the time
set laststatus=2 "" 2: the last window will always have a status line
else
set statusline= ""overwrite any existent statusline
set statusline+=%f%m%r%h%w%0* ""short name
set statusline+=[BUF:%-1.2n]%0* ""buffer number
set statusline+=[%{&fileformat}]%0* ""fileformat
set statusline+=%= ""spacer
set statusline+=[%p%%]%0* ""position percentage
set statusline+=[pos=%05l,%3v]%0* ""horizontal/vertical position
set statusline+=[LEN=%L]%0* ""total line number
set statusline+=%< ""Left aligned to see file name all the time
set laststatus=2 "" 2: the last window will always have a status line
endif
""}}}statusline control
"--------------------------------------for mapping-------------------------------
let mapleader = ","
"{{{
"" fast switch btwn buffers
nnoremap
nnoremap
nnoremap
nnoremap
nnoremap
nnoremap
nnoremap
"" za: open or close a fold
"" zA: open or close a fold recursively
nnoremap
nnoremap
if version >= 700
"open file in new tabpage
vnoremap
nnoremap
endif
"" fast search: don't use
nnoremap
nnoremap
nnoremap
nnoremap
nnoremap
nnoremap
vnoremap
vnoremap
vmap
nnoremap
nnoremap
vnoremap
nnoremap
nnoremap
nnoremap
""{{{single-line comment behavior
"nnoremap
"nnoremap
autocmd BufWinEnter,BufNewFile * nnoremap
autocmd BufWinEnter,BufNewFile *.c nnoremap
autocmd BufWinEnter,BufNewFile *.cpp nnoremap
autocmd BufWinEnter,BufNewFile *.v nnoremap
autocmd BufWinEnter,BufNewFile *.sv* nnoremap
autocmd BufWinEnter,BufNewFile *.*vim nnoremap
autocmd BufWinEnter,BufNewFile .*vim* nnoremap
autocmd BufWinEnter,BufNewFile * nnoremap
autocmd BufWinEnter,BufNewFile *.c nnoremap
autocmd BufWinEnter,BufNewFile *.cpp nnoremap
autocmd BufWinEnter,BufNewFile *.v nnoremap
autocmd BufWinEnter,BufNewFile *.sv* nnoremap
autocmd BufWinEnter,BufNewFile *.*vim nnoremap
autocmd BufWinEnter,BufNewFile .*vim* nnoremap
"nnoremap
"nnoremap
"nnoremap
"nnoremap
"}}}single-line comment behavior
"" avoid annoying K by mistake
nnoremap
nnoremap
nnoremap
vnoremap
vnoremap
vnoremap
vnoremap
vnoremap :
vnoremap / y
vnoremap
vnoremap
""vnoremap
vnoremap
vnoremap
inoremap
inoremap
autocmd BufEnter * :if &ft != 'vim' | inoremap
nnoremap
if has("win32")
nnoremap
else
nnoremap
endif
nnoremap
vnoremap
vnoremap
"noremap
"" allow me to use double
noremap