Maintainer: Version: Blog_post: Syntax_highlighted: Raw_version: How_to_Install_on_Unix: How_to_Upgrade: Sections: Plugins_Included: Revisions:set history=700
filetype plugin onfiletype indent onset autoreadlet mapleader
= ","let g:mapleader
= ","nmap <leader>w :w!
<cr>map <leader>e :e! ~/.vim_runtime/vimrc
<cr>autocmd!
bufwritepost vimrc
source ~/
.vim_runtime/vimrc
set so=7
set wildmenu set ruler set cmdheight=2
set hid set backspace=eol
,start
,indent
set whichwrap+=
<,>,h
,l
set ignorecase set smartcaseset hlsearch set incsearch set nolazyredraw set magic set showmatch set mat=2
set noerrorbellsset novisualbellset t_vb=
set tm=500
syntax enable if MySys() == "mac" set gfn=Menlo
:h14
set shell=/bin/bash
elseif MySys() == "windows" set gfn=Bitstream\ Vera\ Sans\ Mono
:h10
elseif MySys() == "linux" set gfn=Monospace\ 10
set shell=/bin/bash
endifif has("gui_running") set guioptions-=T
set t_Co=256
set background=dark
colorscheme peaksea
set nonuelse colorscheme zellner
set background=dark
set nonuendifset encoding=utf8
try lang en_US
catchendtryset ffs=unix
,dos
,mac
set nobackupset nowbset noswapfiletry if MySys() == "windows" set undodir=C
:\Windows\Temp
else set undodir=~/.vim_runtime/undodir
endif set undofilecatchendtryset expandtabset shiftwidth=4
set tabstop=4
set smarttabset lbrset tw=500
set ai set si set wrap vnoremap <silent> * :call VisualSearch('f')
<CR>vnoremap <silent> # :call VisualSearch('b')
<CR>vnoremap <silent> gv :call VisualSearch('gv')
<CR>map <leader>g :vimgrep // **/*.
<left><left><left><left><left><left><left>function! CmdLine
(str
) exe "menu Foo.Bar :" . a:str emenu Foo
.Bar
unmenu Foo
endfunctionfunction! VisualSearch
(direction
) range
let l:saved_reg
= @" execute "normal! vgvy" let l:pattern
= escape(@",
'\\/.*$^~[]') let l:pattern
= substitute(l:pattern,
"\n$",
"",
"") if a:direction == 'b' execute "normal ?" . l:pattern
. "^M" elseif a:direction == 'gv' call CmdLine("vimgrep " . '/'. l:pattern
. '/' . ' **/*.') elseif a:direction == 'f' execute "normal /" . l:pattern
. "^M" endif let @/
= l:pattern
let @" = l:saved_reg
endfunctioncno $h e ~/
cno $d e ~/Desktop/
cno $j e ./
cno $c e
<C-\>eCurrentFileDir("e")
<cr>cno $q
<C-\>eDeleteTillSlash()
<cr>cnoremap <C-A> <Home>cnoremap <C-E> <End>cnoremap <C-K> <C-U>cnoremap <C-P> <Up>cnoremap <C-N> <Down>map ½ $
imap ½ $
vmap ½ $
cmap ½ $
func! Cwd
() let cwd
= getcwd() return "e endfuncfunc! DeleteTillSlash
() let g:cmd
= getcmdline() if MySys() == "linux" || MySys() == "mac" let g:cmd_edited
= substitute(g:cmd,
"\\(.*\[/\]\\).*",
"\\1",
"") else let g:cmd_edited
= substitute(g:cmd,
"\\(.*\[\\\\]\\).*",
"\\1",
"") endif if g:cmd
== g:cmd_edited
if MySys() == "linux" || MySys() == "mac" let g:cmd_edited
= substitute(g:cmd,
"\\(.*\[/\]\\).*/",
"\\1",
"") else let g:cmd_edited
= substitute(g:cmd,
"\\(.*\[\\\\\]\\).*\[\\\\\]",
"\\1",
"") endif endif return g:cmd_edited
endfuncfunc! CurrentFileDir
(cmd
) return a:cmd . " " . expand("%:p:h") . "/"endfuncmap <space> /
map <c-space> ?
map <silent> <leader><cr> :noh
<cr>map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
map <leader>bd :Bclose
<cr>map <leader>ba :1,300 bd!
<cr>map <right> :bn
<cr>map <left> :bp
<cr>map <leader>tn :tabnew
<cr>map <leader>te :tabedit
map <leader>tc :tabclose
<cr>map <leader>tm :tabmove
map <leader>cd :cd %:p:h
<cr>command! Bclose
call <SID>BufcloseCloseIt()
function!
BufcloseCloseIt
() let l:currentBufNum
= bufnr("%") let l:alternateBufNum
= bufnr("#") if buflisted(l:alternateBufNum
) buffer #
else bnext endif if bufnr("%") == l:currentBufNum
new endif if buflisted(l:currentBufNum
) execute("bdelete! ".l:currentBufNum
) endifendfunctiontry set switchbuf=usetab
set stal=2
catchendtryset laststatus=2
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD
:\ %r%{CurDir()}%h\ \ \ Line
:\ %l/%L
:%c
function! CurDir
() let curdir
= substitute(getcwd(),
'/Users/amir/',
"~/",
"g") return curdir
endfunctionfunction! HasPaste
() if &paste
return 'PASTE MODE ' else return '' endifendfunctionvnoremap $1
<esc>`>a)
<esc>`
<esc>
vnoremap $2 <esc>`>a]<esc>`<esc>
vnoremap $3 <esc>`>a}<esc>`<esc>
vnoremap $$ <esc>`>a"<esc>`<esc>
vnoremap $q <esc>`>a'<esc>`<esc>
vnoremap $e <esc>`>a"<esc>`<esc>
inoremap $1 ()<esc>i
inoremap $2 []<esc>i
inoremap $3 {}<esc>i
inoremap $4 {<esc>o}<esc>O
inoremap $q ''<esc>i
inoremap $e ""<esc>i
inoremap $t <><esc>i
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
map 0 ^
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`
if MySys() == "mac"
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
set guitablabel=%t
map <leader>cc :botright cope<cr>
map <leader>n :cn<cr>
map <leader>p :cp<cr>
let g:bufExplorerDefaultHelp=0
let g:bufExplorerShowRelativePath=1
map <leader>o :BufExplorer<cr>
let g:miniBufExplModSelTarget = 1
let g:miniBufExplorerMoreThanOne = 2
let g:miniBufExplModSelTarget = 0
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplVSplit = 25
let g:miniBufExplSplitBelow=1
let g:bufExplorerSortBy = "name"
autocmd BufRead,BufNew :call UMiniBufExplorer
map <leader>u :TMiniBufExplorer<cr>
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
map <leader>ss :setlocal spell!<cr>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
let python_highlight_all = 1
au FileType python syn keyword pythonDecorator True None False self
au BufNewFile,BufRead *.jinja set syntax=htmljinja
au BufNewFile,BufRead *.mako set ft=mako
au FileType python inoremap <buffer> $r return
au FileType python inoremap <buffer> $i import
au FileType python inoremap <buffer> $p print
au FileType python inoremap <buffer> $f #--- PH ----------------------------------------------<esc>FP2xi
au FileType python map <buffer> <leader>1 /class
au FileType python map <buffer> <leader>2 /def
au FileType python map <buffer> <leader>C ?class
au FileType python map <buffer> <leader>D ?def
au FileType javascript call JavaScriptFold()
au FileType javascript setl fen
au FileType javascript setl nocindent
au FileType javascript imap <c-t> AJS.log();<esc>hi
au FileType javascript imap <c-a> alert();<esc>hi
au FileType javascript inoremap <buffer> $r return
au FileType javascript inoremap <buffer> $f //--- PH ----------------------------------------------<esc>FP2xi
function! JavaScriptFold()
setl foldmethod=syntax
setl foldlevelstart=1
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
function! FoldText()
return substitute(getline(v:foldstart), '{.*', '{...}', '')
endfunction
setl foldtext=FoldText()
endfunction
let MRU_Max_Entries = 400
map <leader>f :MRU<CR>
let g:CommandTMaxHeight = 15
set wildignore+=*.o,*.obj,.git,*.pyc
noremap <leader>j :CommandT<cr>
noremap <leader>y :CommandTFlush<cr>
let Grep_Skip_Dirs = 'RCS CVS SCCS .svn generated'
set grepprg=/bin/grep\ -nH
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
map <leader>q :e ~/buffer<cr>
au BufRead,BufNewFile ~/buffer iab <buffer> xh1 ===========================================
map <leader>pp :setlocal paste!<cr>
map <leader>bb :cd ..<cr>
阅读(2180) | 评论(0) | 转发(0) |