Maintainer:
Version:
Last Change:
Sections:
Tip:
Example:
set nocompatible
set history=400
filetype plugin on
filetype indent on
set autoread
set mouse=a
let mapleader = ","
let g:mapleader = ","
nmap <leader>w :w!<cr>
nmap <leader>f :find<cr>
map <leader>s :source ~/vim_local/vimrc<cr>
map <leader>e :e! ~/vim_local/vimrc<cr>
autocmd! bufwritepost vimrc source ~/vim_local/vimrc
syntax enable
if MySys() == "mac"
set gfn=Bitstream/ Vera/ Sans/ Mono:h14
set nomacatsui
set termencoding=macroman
elseif MySys() == "linux"
set gfn=Monospace/ 11
endif
if has("gui_running")
set guioptions-=T
let psc_style='cool'
colorscheme ps_color
else
set background=dark
colorscheme zellner
endif
map <leader>1 :set syntax=cheetah<cr>
map <leader>2 :set syntax=xhtml<cr>
map <leader>3 :set syntax=python<cr>
map <leader>4 :set ft=javascript<cr>
map <leader>$ :syntax sync fromstart<cr>
autocmd BufEnter * :syntax sync fromstart
if has("gui_running")
set cursorline
hi cursorline guibg=#333333
hi CursorColumn guibg=#333333
endif
hi Pmenu guibg=#333333
hi PmenuSel guibg=#555555 guifg=#ffffff
set ffs=unix,dos,mac
nmap <leader>fd :se ff=dos<cr>
nmap <leader>fu :se ff=unix<cr>
set so=7
set wildmenu
set ruler
set cmdheight=2
set nu
set lz
set hid
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
set ignorecase
set incsearch
set magic
set noerrorbells
set novisualbell
set t_vb=
set showmatch
set mat=2
set hlsearch
set laststatus=2
function! CurDir()
let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
return curdir
endfunction
set statusline=/ %F%m%r%h/ %w/ / CWD:/ %r%{CurDir()}%h/ / / Line:/ %l/%L:%c
function! VisualSearch(direction) range
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", '///.*$^~[]')
let l:pattern = substitute(l:pattern, "/n___FCKpd___0quot;, "", "")
if a:direction == 'b'
execute "normal ?" . l:pattern . "^M"
else
execute "normal /" . l:pattern . "^M"
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
vnoremap <silent> * :call VisualSearch('f')<CR>
vnoremap <silent> # :call VisualSearch('b')<CR>
map <space> /
map <c-space> ?
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
"Buffer related"
map <leader>bd :Bclose<cr>
map <down> <leader>bd
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
try
set switchbuf=usetab
set stal=2
catch
endtry
imap <m-$> <esc>$a
imap <m-0> <esc>0i
imap <D-___FCKpd___0gt; <esc>$a
imap <D-0> <esc>0i
map <leader>cd :cd %:p:h<cr>
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
vnoremap $ <esc>`>a"<esc>`<i"<esc>
vnoremap $q <esc>`>a'<esc>`<i'<esc>
vnoremap $w <esc>`>a"<esc>`<i"<esc>
inoremap $1 ()<esc>:let leavechar=")"<cr>i
inoremap $2 []<esc>:let leavechar="]"<cr>i
inoremap $4 {<esc>o}<esc>:let leavechar="}"<cr>O
inoremap $3 {}<esc>:let leavechar="}"<cr>i
inoremap $q ''<esc>:let leavechar="'"<cr>i
inoremap $w ""<esc>:let leavechar='"'<cr>i
au BufNewFile,BufRead *./(vim/)/@! inoremap " ""<esc>:let leavechar='"'<cr>i
au BufNewFile,BufRead *./(txt/)/@! inoremap ' ''<esc>:let leavechar="'"<cr>i
imap <m-l> <esc>:exec "normal f" . leavechar<cr>a
imap <d-l> <esc>:exec "normal f" . leavechar<cr>a
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
iab xname Amir Salihefendic
map 0 ^
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
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 completeopt=menu
func! Cwd()
let cwd = getcwd()
return "e
endfunc
func! 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
endfunc
func! CurrentFileDir(cmd)
return a:cmd . " " . expand("%:p:h") . "/"
endfunc
cno $h e ~/
cno $d e ~/Desktop/
cno $j e ./
cno $q <C-/>eDeleteTillSlash()<cr>
cno $c e <C-/>eCurrentFileDir("e")<cr>
cno $tc <C-/>eCurrentFileDir("tabnew")<cr>
cno $th tabnew ~/
cno $td tabnew ~/Desktop/
cnoremap <C-A> <Home>
cnoremap <C-E> <End>
cnoremap <C-K> <C-U>
map <c-q> :sb
map <leader>q :e ~/buffer<cr>
set viminfo='10,/"100,:20,%,n~/.viminfo
au BufReadPost * if line("'/"") > 0|if line("'/"") <= line("___FCKpd___0quot;)|exe("norm '/"")|else|exe "norm ___FCKpd___0quot;|endif|endif
map <F9> ggVGg?
command! Bclose call <SID>BufcloseCloseIt()
function! <SID>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)
endif
endfunction
set nobackup
set nowb
set noswapfile
set nofen
set fdl=0
set expandtab
set shiftwidth=2
map <leader>t2 :set shiftwidth=2<cr>
map <leader>t4 :set shiftwidth=4<cr>
au FileType html,python,vim,javascript setl shiftwidth=2
au FileType html,python,vim,javascript setl tabstop=2
au FileType java setl shiftwidth=4
au FileType java setl tabstop=4
set smarttab
set lbr
set tw=500
set ai
set si
set cindent
set wrap
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
let Grep_Skip_Dirs = 'RCS CVS SCCS .svn'
let Grep_Cygwin_Find = 1
map <leader>y :YRShow<cr>
let g:explVertical=1
let g:explWinSize=35
let g:explSplitLeft=1
let g:explSplitBelow=1
let g:explHideFiles='^/.,.*/.class$,.*/.swp$,.*/.pyc$,.*/.swo$,/.DS_Store let g:explDetailedHelp=0 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 "/sw/bin/ctags-exuberant" "name" set grepprg=grep/ -nH/ $* let g:Tex_DefaultTargetFormat="pdf" let g:Tex_ViewRule_pdf='xpdf' autocmd FileType tex map <silent><leader><space> :w!<cr> :silent! call Tex_RunLaTeX()<cr> autocmd FileType tex inoremap $i /indent autocmd FileType tex inoremap $* /cdot autocmd FileType tex inoremap $i /item autocmd FileType tex inoremap $m /[<cr>/]<esc>O au BufNewFile,BufRead *.todo so ~/vim_local/syntax/amido.vim autocmd FileType vim map <buffer> <leader><space> :w!<cr>:source %<cr> let xml_use_xhtml = 1 let html_use_css = 1 let html_number_lines = 0 let use_xhtml = 1 autocmd FileType ruby map <buffer> <leader><space> :w!<cr>:!ruby %<cr> autocmd FileType php compiler php autocmd FileType php map <buffer> <leader><space> <leader>cd:w<cr>:make %<cr> au FileType python so ~/vim_local/syntax/python.vim autocmd FileType python map <buffer> <leader><space> :w!<cr>:!python %<cr> autocmd FileType python so ~/vim_local/plugin/python_fold.vim autocmd FileType python set makeprg=python/ -c/ /"import/ py_compile,sys;/ sys.stderr=sys.stdout;/ py_compile.compile(r'%')/" autocmd FileType python set efm=%C/ %.%#,%A/ / File/ /"%f/"//,/ line/ %l%.%#,%Z%[%^/ ]%//@=%m au FileType python set cindent au FileType python inoremap <buffer> $r return au FileType python inoremap <buffer> $s self au FileType python inoremap <buffer> $c ##<cr>#<space><cr>#<esc>kla au FileType python inoremap <buffer> $i import au FileType python inoremap <buffer> $p print au FileType python inoremap <buffer> $d """<cr>"""<esc>O function! Python_Eval_VSplit() range let src = tempname() let dst = tempname() execute ": " . a:firstline . "," . a:lastline . "w " . src execute ":!python " . src . " > " . dst execute ":pedit! " . dst endfunction au FileType python vmap <F7> :call Python_Eval_VSplit()<cr> autocmd FileType cheetah set ft=xml autocmd FileType cheetah set syntax=cheetah autocmd FileType vim set nofen au FileType java inoremap <buffer> <C-t> System.out.println();<esc>hi autocmd FileType java source ~/vim_local/macros/jcommenter.vim autocmd FileType java let b:jcommenter_class_author='Amir Salihefendic (amix@amix.dk)' autocmd FileType java let b:jcommenter_file_author='Amir Salihefendic (amix@amix.dk)' autocmd FileType java map <buffer> <F2> :call JCommentWriter()<cr> autocmd FileType java inoremap <buffer> $pr private autocmd FileType java inoremap <buffer> $r return autocmd FileType java inoremap <buffer> $pu public autocmd FileType java inoremap <buffer> $i import autocmd FileType java inoremap <buffer> $b boolean autocmd FileType java inoremap <buffer> $v void autocmd FileType java inoremap <buffer> $s String function! JavaFold() setl foldmethod=syntax setl foldlevelstart=1 syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend syn match foldImports //(/n/?import./+;/n/)/+/ transparent fold function! FoldText() return substitute(getline(v:foldstart), '{.*', '{...}', '') endfunction setl foldtext=FoldText() endfunction au FileType java call JavaFold() au FileType java setl fen au BufEnter *.sablecc,*.scc set ft=sablecc au FileType javascript so ~/vim_local/syntax/javascript.vim 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 au FileType javascript call JavaScriptFold() au FileType javascript setl fen au FileType javascript imap <c-t> console.log();<esc>hi au FileType javascript imap <c-a> alert();<esc>hi au FileType javascript setl nocindent au FileType javascript inoremap <buffer> $r return au FileType javascript inoremap <buffer> $d //<cr>//<cr>//<esc>ka<space> au FileType javascript inoremap <buffer> $c /**<cr><space><cr>**/<esc>ka au FileType html,cheetah set ft=xml au FileType html,cheetah set syntax=html autocmd FileType c map <buffer> <leader><space> :w<cr>:!gcc %<cr> autocmd FileType sml map <silent> <buffer> <leader><space> <leader>cd:w<cr>:!sml %<cr> autocmd BufNewFile,BufRead *.scm map <buffer> <leader><space> <leader>cd:w<cr>:!petite %<cr> autocmd BufNewFile,BufRead *.scm inoremap <buffer> <C-t> (pretty-print )<esc>i autocmd BufNewFile,BufRead *.scm vnoremap <C-t> <esc>`>a)<esc>`<i(pretty-print <esc> map <F8> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg autocmd FileType python inorea <buffer> cfun <c-r>=IMAP_PutTextWithMovement("def <++>(<++>):/n<++>/nreturn <++>")<cr> autocmd FileType python inorea <buffer> cclass <c-r>=IMAP_PutTextWithMovement("class <++>:/n<++>")<cr> autocmd FileType python inorea <buffer> cfor <c-r>=IMAP_PutTextWithMovement("for <++> in <++>:/n<++>")<cr> autocmd FileType python inorea <buffer> cif <c-r>=IMAP_PutTextWithMovement("if <++>:/n<++>")<cr> autocmd FileType python inorea <buffer> cifelse <c-r>=IMAP_PutTextWithMovement("if <++>:/n<++>/nelse:/n<++>")<cr> autocmd FileType cheetah,html,javascript inorea <buffer> cfun <c-r>=IMAP_PutTextWithMovement("function <++>(<++>) {/n<++>;/nreturn <++>;/n}")<cr> autocmd filetype cheetah,html,javascript inorea <buffer> cfor <c-r>=IMAP_PutTextWithMovement("for(<++>; <++>; <++>) {/n<++>;/n}")<cr> autocmd FileType cheetah,html,javascript inorea <buffer> cif <c-r>=IMAP_PutTextWithMovement("if(<++>) {/n<++>;/n}")<cr> autocmd FileType cheetah,html,javascript inorea <buffer> cifelse <c-r>=IMAP_PutTextWithMovement("if(<++>) {/n<++>;/n}/nelse {/n<++>;/n}")<cr> autocmd FileType cheetah,html inorea <buffer> cahref <c-r>=IMAP_PutTextWithMovement('<a href="<++>"><++></a>')<cr> autocmd FileType cheetah,html
分享到:
相关推荐
史上最强的vimrc文件,据说有800行,还是作者精简后的结果.
vimrc的模板,对vim进行了大量的配置,安装了十几个插件,把vim打造成了具有智能提示、智能补全功能的IDE;其中,ycm插件的安装可参见我的博客
【vimrc-survey】是一个项目,它通过分析GitHub上的.dotvimrc或.vimrc文件来探索最常用的Vim配置行。这个项目利用Python语言作为工具,进行数据抓取和分析,帮助用户了解社区中广泛使用的Vim编辑器个性化设置。 ...
下面将详细介绍Vim编辑器的基本概念、8.2版本的新特性以及如何管理和自定义.vimrc文件。 1. Vim编辑器基础: Vim分为命令模式和插入模式。在命令模式下,用户可以执行移动光标、复制、粘贴、删除等操作;插入模式...
Vimrc文件是Vim编辑器的配置文件,用于存储用户个人的设置和快捷键映射,使得Vim能够按照用户的需求进行定制化。在本文中,我们将深入探讨`vimrc`设置,了解如何优化和个性化你的Vim体验。 首先,让我们了解一下`...
来自网上,vim的配置文件,号称最强,刚刚使用,效果有待检验。
要使用这个配置文件,只需将提供的配置代码复制到文本文件中,改名为“.vimrc”,然后放置到用户的用户文件夹根目录下,并重新打开Vim即可看到配置效果。此外,源码已经托管在GitHub上,方便用户获取更新和更多新...
读者感兴趣的话直接复制下面的代码到文本文件 然后把文件改名为“ vimrc” 不要忘记前面的“ ” 然后把文件放到用户文件夹的根目录下面即可 重新打开vim即可看到效果 ">花了很长时间整理的 感觉用起来很方便 共享...
Vimscript 的语法简洁,与 Vim 的命令行接口有很强的关联性,使得编写配置文件更为直观。 **三、.vimrc 文件的常用配置** 1. **基本设置** - `set nocompatible`: 关闭 Vi 兼容模式,充分利用 Vim 的特性。 - `...
这段脚本将无插件模式启动 Vim,并使用指定的_vimrc文件。 **molokai.vim 文件** 这个文件是 Molokai 颜色主题的实现文件,包含了一系列 Vim 高亮组的定义。在 Vim 中,不同的代码元素如关键字、函数名、字符串、...
标题提到的“史上最NB的VIM配置文件”显然指的是一个精心优化过的`.vimrc`文件,这是VIM的初始化脚本,用于存储用户的所有自定义设置和映射。 首先,我们来看`.vimrc`文件。这是一个纯文本文件,其中包含了VIM启动...
Vim脚本,即.vimrc文件,是Vim的配置文件,用于定义用户首选项和自定义功能。通过编辑.vimrc,用户可以个性化他们的Vim环境,包括设置快捷键、改变颜色方案、启用特定插件等。描述中提到的"支持多种语言,语法高亮...
原网站好像上不了,我有幸下载到一份,珍藏吧。 使用文件夹内的shell脚本进行安装,非常简单的。 Maintainer: amix the lucky stiff http://amix.dk - amix@amix.dk
首先,vimrc文件是vim的配置文件,它包含了用户自定义的各种设置和快捷键映射,使得vim能够按照个人喜好和需求运行。"vimrc-4.5-for-v8"很可能是一个针对vim 8.x版本优化的配置文件,包含了对语法高亮、自动补全、...
Vim的配置文件位于用户的家目录下 `.vimrc`,这是一个初始化脚本,用于设置Vim的各种选项和映射。若要自定义Vim的配置,可以按照以下步骤操作: 1. 使用以下命令创建或编辑 `.vimrc` 文件: ```bash nano ~/....
这个配置是根据网上“最N vim配置“修正了一些错误和增加了一些我认为方便的设置,功能确实很强,感谢Amix,本人保留他(她)的说明,里面的配置都有说明,很容易就懂,建议大家好好去看一遍,包你有长进。 运行环境 ...
它的自定义性极强,可以通过配置文件来调整编辑器的行为,以适应个人的工作习惯和需求。在这个"vim配置文件"中,我们将深入探讨Vim的配置机制、常用配置选项以及如何优化你的Vim体验。 首先,Vim的配置文件被称为`....
搜索强化vimrc配置文件参考了网上最流行配置,去掉无关功能,配置行有中文说明,下载前请自行安装gvim7.3,下载包覆盖即可,安装的插件有: tlist ctags winmanager grep visuamark neocomplcache snipmate delimitmate ...
- Vimrc 是 Vim 的配置文件,通常位于用户主目录下的 `.vimrc` 或 `_vimrc` 文件。这个文件包含了启动 Vim 时会执行的一系列命令和设置,用来定制个人的工作环境。 2. **基本配置** - `set nocompatible`: 禁用 ...
然后,通过.vimrc文件,我们可以自定义快捷键、设置选项和加载插件,使得Vim更加符合个人的工作习惯。 在"史上最强vim配置"中,我们可能会涉及到以下关键知识点: 1. **启动速度优化**:通过减少.vimrc中的加载项...