[vim] запостите свои конфиги
у меня длиннее
нет!
vim отстой
почему нет? в них хранится какое-то сакральное знание?
Когда я, например, был в яндексе, у меня в конфиге вима были автодействия: при открытии файла исходников убирались пробелы между if/while/etc и открывающей скобкой, а последовательность из четырех пробелов заменялась на таб.
При сохранении файла происходило обратное.
if &t_Co==256
colorscheme xoria256
endif
set incsearch " Incremental search
set hlsearch " Highlight the search results
set ignorecase " Ignore case when searching
set smartcase " Case sensitive when uppercase letters are in the prompt
set tabstop=4 " Tabstop defaults
set shiftwidth=4 " The shiftwidth
set softtabstop=4 " The magic softtabstop that backspaces in one shot
set expandtab " Expand tabs to spaces. Yes, I've moved to the dark side =)
"filetype plugin indent on " Filetype based indentation
set cindent " Now, let's try this, C indentation
set wrap " Wrapping is a good idea
set linebreak " Break lines on words only (wrap mode! :help wrap)
set display+=lastline " Display the last line partially
set modeline " Modelines should be cool TODO: check out the bugs mentioned in vimrc
set backspace=2 " Backspacing everywhere
set showmatch " Show the matching parenthesis...
set matchtime=2 " for 2 1/10th of a second
set virtualedit= " No virtualedit nowhere
set title " Turn on title setting
set wildmenu " Turn on completion menu
set cpoptions+=$ " Don't redisplay changed line immediately
set showcmd " Show the command being composed in status
set number " Turn line numbering on
set laststatus=2 " Status line every time
set cursorline " Highlight the current line
set spelllang=ru,en " Internal speller language settings
set fileencodings=ucs-bom,utf8,cp1251,koi8-r,latin-1,default " Those are file encodings for guessing. The first single-byte is chosen, so everything after cp1251 has no effect
set wildignore=*.o,*.lo,*.in,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn,*.aux,*.out,*.toc,*.log " Don't tab-complete those extensions
set hidden " Allow running from modified buffers (warns of course if not :qa!)
set backup " Yes, we like backups...
set backupdir=~/.backup " when they don't clutter the current dir
set mouse=a " Full mouse support
set printencoding=koi8-r " Printing, printing...
set printoptions+=duplex:off
set tags=./tags;/ " Make vim find tags in parent directories recursively
let mapleader="," " Special commands for plugins start with ',' not '\'
"doesn't work for unicode, unfortunately
"set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;AXJE.UIDCOTNMBRL'POYGK\,QF\;,фисвуапршолдьтщзйкыегмцчня;a0x;je.aidcotnmbrl'poygk\,qf\;
"" CScope setup
"if has("cscope")
" set cscopetag " Use cscope for ^] etc
" set cscopetagorder=0 " cscope tags first, then ctags
"
" set cscopequickfix=s-,c-,d-,i-,t-,e- " use quickfix window
"
" set nocscopeverbose
" " add any database in current directory
" if filereadable("cscope.out")
" cs add cscope.out
" " else add database pointed to by environment
" elseif $CSCOPE_DB != ""
" cs add $CSCOPE_DB
" endif
" set cscopeverbose
"endif
" These are for easy navigation inside wrapped lines
noremap <buffer> <silent> <Up> gk
noremap <buffer> <silent> k gk
noremap <buffer> <silent> <Down> gj
noremap <buffer> <silent> j gj
" noremap <buffer> <silent> <Home> g<Home>
" noremap <buffer> <silent> 0 g0
" noremap <buffer> <silent> ^ g^
" noremap <buffer> <silent> $ g$
" noremap <buffer> <silent> <End> g<End>
inoremap <buffer> <silent> <Up> <C-o>gk
inoremap <buffer> <silent> <Down> <C-o>gj
inoremap <buffer> <silent> <Home> <C-o>g<Home>
inoremap <buffer> <silent> <End> <C-o>g<End>
" This is to find "{" "}" not in the first column
nnoremap [[ ?{<CR>w99[{
nnoremap ][ /}<CR>b99]}
nnoremap ]] j0[[%/{<CR>
nnoremap [] k$][%?}<CR>
" This allows for change paste motion cp{motion}
nmap <silent> cp :set opfunc=ChangePaste<CR>
function! ChangePaste(type, ...)
silent exe "normal! `[v`]\"_c"
silent exe "normal! p"
endfunction
filetype plugin on " Filetype plugins such as latexsuite
" latexsuite specific
set grepprg=grep\ -nH\ $* " This is required by app-vim/latexsuite
let g:Tex_CompileRule_dvi='latex -src-specials -interaction nonstopmode $* %'
let g:Tex_ViewRule_dvi='vi'
let g:tex_flavour='latex'
" taglist specific
let g:Tlist_Enable_Fold_Column=0
" let g:Tlist_GainFocus_On_ToggleOpen=1 " Press enter glitch
" tagbar specific
let g:tagbar_compact=1
" Doxygen highlighting, we want it!
let g:load_doxygen_syntax=1
" This cool mapping uses ctags to find the filename under cursor. Make sure to
" run ctags with --extra=+f
nnoremap gF :exe 'tag '.expand('<cfile>')<cr>
" Allow saving of files as sudo when I forgot to start vim using sudo.
command Sudow w !sudo tee > /dev/null %
nnoremap <F2> :TagbarToggle<CR>
nnoremap <F3> :A<CR>
nnoremap <Leader>t :CtrlP<CR>
% eix -C app-vim -I --format '<installedversions:EQNAMEVERSION>' |grep -v syntax
=app-vim/alternate-2.18
=app-vim/colorschemes-20130124
=app-vim/ctrlp-1.79
=app-vim/tagbar-2.4.1
=app-vim/vcscommand-1.99.45
=app-vim/vim-latex-1.8.23.20130116
=app-vim/vim-spell-en-20060123
=app-vim/vim-spell-ru-20070506
$ cat ~/.vimrc
filetype plugin indent on
syntax on
command -nargs=1 -range Hs execute ":" <line1> ',' <line2> "!ghc /home/bipll/vim.hs -e 'getContents >>= mapM_ putStrLn . map (" substitute(substitute(<q-args>, "!", "\\\\!", "g" "'", "'\\\\''", "g") ") . lines'"
command -nargs=1 -range Hs1 execute ":" <line1> ',' <line2> "!ghc /home/bipll/vim.hs -e 'getContents >>= mapM_ putStrLn . (" substitute(substitute(<q-args>, "!", "\\\\!", "g" "'", "'\\\\''", "g") ") . lines'"
set fileencodings=ucs-bom,utf-8,cp1251,default,latin1
command -range LineCont execute ":" <line1> ',' <line2> "Hs1 \\ss -> let {effLen s = foldl (\\s c -> s + if c == '\\t' then 8 else 1) 0 s `div` 8; maxLen = maximum (map effLen ss) + 1} in map (\\s -> s ++ replicate (maxLen - effLen s) '\\t' ++ \"\\\\\") ss"
$ cat ~/vim.hs
import Data.Char
import Data.List
import Text.Regex.Base
import Text.Regex.TDFA
data Pattern = Chr Char | Str String | Rng [Char] | Reg String | Prd (Char -> Bool)
data Substitute = SC Char | SS String | SF (String -> String)
matches :: Pattern -> String -> Bool
matches (Chr p) s = p `elem` s
matches (Str p) s = matches p s where
matches (_:_) "" = False
matches p (_:s') = p `isPrefixOf` s || matches p s'
matches (Rng p) s = any (`elem` p) s
matches (Reg p) s = s =~ p
matches (Prd p) s = any p s
pickChar :: (Char -> Bool) -> String -> (String,String,String)
pickChar p s = case break p s of
(bef,mid:aft) -> (bef,[mid],aft)
_ -> (s,"","")
match1 :: Pattern -> String -> (String,String,String)
match1 (Chr p) = pickChar (== p)
match1 (Str p) = match (length p) p where
match _ (_:_) "" = ("","","")
match l p (~(c:s' | p `isPrefixOf` s = ("",p,drop l s)
| otherwise = (c:bef,mid,aft) where (bef,mid,aft) = match l p s'
match1 (Rng p) = pickChar (`elem` p)
match1 (Reg p) = (=~ p)
match1 (Prd p) = pickChar p
matchOmni :: Pattern -> String -> (String,[(String,String)])
matchOmni p s = case match1 p s of
(bef,"","") -> (bef,[])
(bef,mid,aft) -> case matchOmni p aft of
(_,[]) -> (bef,[(mid,aft)])
(bef',ms) -> (befmid,bef'):ms)
subst :: Substitute -> String -> String
subst (SC c) = const [c]
subst (SS s) = const s
subst (SF f) = f
replace1 :: Pattern -> Substitute -> String -> String
replace1 p r s = case match1 p s of
(_,"","") -> s
(bef,mid,aft) -> bef ++ subst r mid ++ aft
replaceOmni :: Pattern -> Substitute -> String -> String
replaceOmni p r s = bef ++ concatMap (\(m,t) -> subst r m ++ t) ms where (bef,ms) = matchOmni p s
set ts=4
set shiftwidth=4
" Search options
set ignorecase
set smartcase
set incsearch
set hlsearch
" Enables persistent undo
set undofile
set undodir=~/.vimundo
" Enables status line for one window
set laststatus=2
" Disables "No write since last change" message while changing buffer
set hidden
" Commands to make autoindent work
filetype on
filetype plugin on
filetype indent on
set expandtab
set shiftwidth=2
set softtabstop=2
" clang_complete options
let g:clang_library_path = "/usr/lib"
let g:clang_snippets = 1
let g:clang_trailing_placeholder = 1
"{{{ Enable plugins
" disable all previously defined commands, useful for reloading vimrc
autocmd!
" I'm not oldfag, so, bye-bye good ol vi
set nocompatible
filetype off
call vundle#rc
"{{{ Plugins list
"
Bundle 'git://git.wincent.com/command-t.git'
Bundle 'msanders/snipmate.vim.git'
Bundle 'altercation/vim-colors-solarized.git'
Bundle 'Lokaltog/vim-powerline.git'
Bundle 'DoxygenToolkit'
Bundle 'LaTeX-Suite-aka-Vim-LaTeX'
Bundle 'StarRange'
Bundle 'The-NERD-Commenter'
Bundle 'The-NERD-tree'
" Bundle 'calendar--Matsumoto'
Bundle 'gnupg'
Bundle 'imaps'
" Bundle 'journal'
Bundle 'libList'
Bundle 'matchit.zip'
Bundle 'taglist'
Bundle 'surround'
Bundle 'bufexplorer.zip'
Bundle 'Workspace-Manager'
Bundle 'sessionman'
Bundle 'view_diff'
Bundle 'gitdiff'
Bundle 'vcscommand'
" Bundle 'DirDiff'
Bundle 'FSwitch'
Bundle 'c.vim'
Bundle 'OmniCppComplete'
Bundle 'javacomplete'
Bundle 'lua_omni'
Bundle 'SearchComplete'
Bundle 'SuperTab-continued.'
Bundle 'ProtoDef'
Bundle 'STL-improved'
Bundle 'Tabular'
Bundle 'switch_headers'
Bundle 'renamer'
Bundle 'hexHighlight'
Bundle 'JavaDecompiler'
"}}}
filetype plugin indent on
syntax on
"}}}
"{{{ General options
"
if has("gui_running")
runtime ftplugin/man.vim
nmap K :Man <cword><CR>
endif
"
" let g:solarized_termcolors=256
" let g:solarized_visibility="low"
let g:Powerline_symbols = 'fancy'
set background=dark
" colo solarized
colo ir_black
" set background=light
set backup " keep a backup file
set backupdir=$HOME/.vim/backup
set showcmd " display incomplete commands
set incsearch " do incremental searching
set smartcase
set hidden
set lazyredraw
set textwidth=70
set backspace=indent,eol,start " more powerful backspacing
set history=100 " keep 50 lines of command line history
set ruler " show the cursor position all the time
"
" " Suffixes that get lower priority when doing tab completion for filenames.
" " These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
" We want always use tabs. Also we want that tab character appears as 3 spaces
set noexpandtab " do not replace tab with spaces
set shiftwidth=3 " define shift value in spaces
set softtabstop=0 " define display value \t in spaces
set tabstop=3 " define real value \t in spaces
set foldmethod=syntax " how to make folds
set virtualedit=all " feel free to navigate anywhere
set formatoptions=tcqrn " define text format options
set wildmenu " show pretty line on completion
set shm=aoOAI
set sidescroll=5
" set listchars=trail:·,tab:\»\ ,precedes:<,extends:>
" set list
set showbreak=\ →\
set hlsearch " Also switch on highlighting the last used search pattern
set mouse=a
set kp=man\ --sections=3,2,9
set langmap=йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ\;qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>
set statusline=%F%m%r%h%w\ [Формат=%{&ff}]\ [Тип=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [Позиция=%04l,%04v]\ [%p%%]\ [Длина=%L]
set laststatus=2
function! FoldSpellBalloon
let foldStart = foldclosed(v:beval_lnum )
let foldEnd = foldclosedend(v:beval_lnum)
let lines = []
" 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 14
" and the last 14 lines
if ( numLines > 31 )
let lines = getline( foldStart, foldStart + 14 )
let lines += [ '-- Snipped ' . ( numLines - 30 ) . ' lines --' ]
let lines += getline( foldEnd - 14, foldEnd )
else
"less than 30 lines, lets show all of them
let lines = getline( foldStart, foldEnd )
endif
endif
" return result
return join( lines, has( "balloon_multiline" ) ? "\n" : " " )
endfunction
set balloonexpr=FoldSpellBalloon
set ballooneval
set balloondelay=100
"}}}
"{{{ Folding
let perl_fold = 1
let perl_fold_blocks = 1
"let g:tex_fold_enabled=1
let g:vimsyn_folding = 'afmpP'
let g:vimsyn_noerror = 1
let g:xml_syntax_folding = 1
"{{{ pretify fold text with custom function
" enable it with Autocommand, e.g. for java
function! MyFoldText
let line = getline(v:foldstart)
let commentBegin = '^[ \t]*\(\/\*\|\/\/\)[*/\\]*[ \t]*$'
if match( line, commentBegin ) == 0
let prefix = substitute( line, '^\([ \t]\)*.*', '\1*', '' )
let linenum = v:foldstart
while linenum < v:foldend
let line = getline( linenum )
let content = substitute( line, '^\([ \t\/\*]*\)\(.*\)$', '\2', 'g' )
if content != ''
break
endif
let linenum = linenum + 1
endwhile
let sub = prefix . ' ' . content
else
let sub = line
let startbrace = substitute( line, '^.*{[ \t]*$', '{', 'g')
if startbrace == '{'
let line = getline(v:foldend)
let endbrace = substitute( line, '^[ \t]*}\(.*\)$', '}', 'g')
if endbrace == '}'
let sub = sub.substitute( line, '^[ \t]*}\(.*\)$', '..}\1', 'g')
endif
endif
endif
let n = v:foldend - v:foldstart + 1
let l:info = " [" . n . "]"
let num_w = getwinvar( 0, '&number' ) * getwinvar( 0, '&numberwidth' )
let fold_w = getwinvar( 0, '&foldcolumn' )
let maxSubLength = winwidth(0) - num_w - fold_w - strlen( l:info )
let sub = strpart( sub, 0, maxSubLength)
return printf('%-*s%s', maxSubLength, sub, l:info)
endfunction
"}}}
"}}}
"{{{ Autocommands
"{{{ all
"{{{ plugins options
"{{{ NERD Tree
let NERDSpaceDelims=1
let NERDTreeWinPos="right"
"}}}
"{{{ Bufexplorer
let g:bufExplorerDefaultHelp=1 " Do not show default help.
let g:bufExplorerReverseSort=1 " Sort in reverse order.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSplitRight=1 " Split right.
"}}}
"}}}
"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).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
function! SynStack
if !exists("*synstack")
return
endif
echo map(synstack(line('.' col('.' 'synIDattr(v:val, "name")')
endfunc
"}}}
"{{{ text
"set 'textwidth' to 78 characters for text files.
autocmd FileType text setlocal textwidth=78
"}}}
"{{{ snipmate
"{{{ plugins options
let g:snips_author = 'Sergey Dovgal'
"}}}
autocmd FileType snippet set ai
autocmd FileType snippet set flp+=
"}}}
"{{{ java
" when gf pressed on import statement, go to file where '.' replaced
" on '/'
" set includeexpr=substitute(v:fname,'\\.','/','g')
let java_highlight_all=1
let java_ignore_javadoc=0
" let java_highlight_functions="indent"
autocmd Filetype java set foldtext=MyFoldText
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
autocmd FileType java set tags=./tags,tags,/usr/share/vim/vimfiles/tags/java
autocmd FileType java set makeprg=myant
" java compilation tricks
" the "\%DEntering:\ %f," rule relies on a sed script which generates
" "Entering: " messages for each test class run (the directory name is
" generated from the test class package and a hard-coded src root)
" the "%\\C" at the start of the exception matching line tells to match
" case-exact (the exception mathching lines rely on the %D rule that sets
" up the correct directory from the package structure)
" ant/junit/javac errorformat
autocmd FileType java set errorformat=
\%-G%.%#build.xml:%.%#,
\%-G%.%#warning:\ %.%#,
\%-G%\\C%.%#EXPECTED%.%#,
\%f:%l:\ %#%m,
\C:%f:%l:\ %m,
\%DEntering:\ %f\ %\\=,
\%ECaused\ by:%[%^:]%#:%\\=\ %\\=%m,
\%ERoot\ cause:%[%^:]%#:%\\=\ %\\=%m,
\%Ecom.%[%^:]%#:%\\=\ %\\=%m,
\%Eorg.%[%^:]%#:%\\=\ %\\=%m,
\%Ejava.%[%^:]%#:%\\=\ %\\=%m,
\%Ejunit.%[%^:]%#:%\\=\ %\\=%m,
\%-Z%\\C\ at\ com.mypkg.%.%#.test%[A-Z]%.%#(%f:%l)\ %\\=,
\%-Z%\\C\ at\ com.mypkg.%.%#.setUp(%f:%l)\ %\\=,
\%-Z%\\C\ at\ com.mypkg.%.%#.tearDown(%f:%l)\ %\\=,
\%-Z%^\ %#%$,
\%-C%.%#,
\%-G%.%#
" autocmd FileType java :so "~/.vim/javakit/JavaKit.vim"
" autocmd FileType java set gp=galj
"}}}
"{{{ c++
let protodefprotogetter="$HOME/.vim/bundle/ProtoDef/pullproto.pl"
autocmd Filetype c,cpp set foldtext=MyFoldText | nmap <buffer> <silent> <leader> ,PP " ProtoDef
autocmd Filetype cpp set tags+="$HOME/.vim/tags/cpp"
" enable cscope
if has("cscope")
set csto=0
set cst
map <C--> :cstag <C-R>=expand("<cword>")<CR><CR>
map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR>
map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
"}}}
"{{{ python
autocmd FileType python setlocal tw=0
autocmd FileType python setlocal foldmethod=indent
"}}}
"{{{ ms word
autocmd BufReadPre *.doc set ro
autocmd BufReadPost *.doc %!antiword "%"
"}}}
"{{{ rsl
au BufNewFile,BufRead *.rsl setf rsl | set makeprg=rsltc\ %
" au BufNewFile,BufRead *.rsl set errorformat=%f:%l:%c: %t
"}}}
"{{{ latex
au Filetype tex setlocal grepprg=grep\ -nH\ $* |
\ setlocal iskeyword+=: |
\ nnoremap <buffer> <Leader>xl :call RunLaTeX<cr> |
\ vnoremap <buffer> <Leader>xp :call Tex_PartCompile<cr> |
\ nnoremap <buffer> <Leader>xv :call ViewLaTeX<cr> |
\ nnoremap <buffer> <Leader>xs :call Tex_ForwardSearchLaTeX<cr>
let g:tex_flavor = "latex"
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_MultipleCompileFormats = 'dvi,pdf'
let g:Tex_IgnoreLevel = 10
let g:Tex_IgnoredWarnings =
\'Underfull'."\n".
\'Overfull'."\n".
\'specifier changed to'."\n".
\'You have requested'."\n".
\'Missing number, treated as zero.'."\n".
\'There were undefined references'."\n".
\'Citation %.%# undefined'."\n".
\'Empty `thebibliography'. "\n".
\'Font shape'."\n"
let g:Tex_GotoError = 0
let g:Tex_HotKeyMappings = 'eqnarray*,eqnarray,bmatrix,frame'
let g:Tex_ViewRule_pdf = 'evince'
function! MainFile
return g:Tex_MainFile
endf
let g:Tex_MainFileExpression = 'MainFile'
"}}}
"{{{ tasklist
let g:tlWindowPosition = 1
let g:tlRememberPosition = 1
"}}}
"{{{ bin
" vim -b : edit binary using x-format!
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!x
au BufReadPost *.bin set ft=x | endif
au BufWritePre *.bin if &bin | %!x -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!x
au BufWritePost *.bin set nomod | endif
augroup END"}}}
"{{{ sh
" call IMAP("$", "${<++>}", "sh")
" call IMAP("/", "\"${<++>}\"", "sh")
"}}}
"{{{ fswitch
nmap <silent> <Leader>of :FSHere<cr>
nmap <silent> <Leader>ol :FSRight<cr>
nmap <silent> <Leader>oL :FSSplitRight<cr>
nmap <silent> <Leader>oh :FSLeft<cr>
nmap <silent> <Leader>oH :FSSplitLeft<cr>
"}}}
"{{{ Commands
"{{{ Diff between curr buffer and file it was loaded from
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
"}}}
"{{{ Multiple sustitution
" " replacing all occurences of each key in the dictionary with its value
function! Refactor(dict) range
execute a:firstline . ',' . a:lastline . 's/\C\<\%(' . join(keys(a:dict'\|'). '\)\>/\='.string(a:dict).'[submatch(0)]/ge'
endfunction
command! -range=% -nargs=1 Refactor :<line1>,<line2>call Refactor(<args>)
"}}}
"{{{ Open snippets file
fun! OpenSnippet
exec 'rightb vsplit ' . g:snippets_dir . &filetype . '.snippets'
endf
command! OpenSnippet :call OpenSnippet
function! ReloadSnippet( snippets_dir, ft )
if strlen( a:ft ) == 0
let filetype = "_"
else
let filetype = a:ft
endif
call ResetSnippets
call GetSnippets( a:snippets_dir, filetype )
endfunction
command! ReloadSnippet :call ReloadSnippet("~/.vim/bundle/snipMate/snippets/", &filetype)
"}}}
"{{{ spelling
let g:IsSpellingSwitchedOn = 0
function! SwitchSpelling
if (g:IsSpellingSwitchedOn == 1)
silent exec 'syntax clear SpellErrors'
let g:IsSpellingSwitchedOn = 0
else
silent exec 'source `vimspell.sh %`'
let g:IsSpellingSwitchedOn = 1
endif
endfunction
command! SwitchSpelling :call SwitchSpelling
" au BufNewFile,BufRead *.rsl set errorformat=%f:%l:%c: %t
"}}}
"{{{ Source the vimrc file after saving it
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
autocmd bufwritepost .gvimrc source $MYGVIMRC
endif
"}}}
"}}}
"}}}
" highlight Folded ctermbg=8
" {{{ Mappings
let mapleader = ","
let VCSCommandMapPrefix = '<Leader>v'
map Q gq
map Y y$
nmap yy yymy
vmap y ymy
nmap p pmp
inoremap <C-U> <C-G>u<C-U>
noremap <C-n> :cn<CR>
noremap <C-p> :cp<CR>
map <esc><esc> <esc>:nohl<CR>
nmap <Tab> w
nmap <S-Tab> W
nmap <C-Q> q
nmap <leader>h :tabprev<CR>
nmap <leader>l :tabnext<CR>
nmap <leader>j :bnext<CR>
nmap <leader>k :bprevious<CR>
" nmap <leader>t :tabnew<CR>
nmap <leader>n :NERDTreeToggle<CR>
nmap <leader>s :SessionList<CR>
nmap <F5> :make<CR>
imap <F5> make<CR>a
nmap <F2> :w<CR>
imap <F2> w<CR>a
nmap <F1> :Tlist<CR>
imap <F1> Tlist<CR>a
nmap <silent> <Leader>of :FSHere<cr> " FSwitch
nmap <insert> "+p
nmap <delete> "+yy
imap <insert> +pa
imap <delete> +yya
vmap <delete> "+y
" nmap ¯ :set nohlsearch<CR> " mapped to <alt-/>
" imap ¯ <ESC>:set nohlsearch<CR>a " mapped to <alt-/>
" nmap <C--> :SwitchSpelling<CR><CR>
" imap <C--> <ESC>:SwitchSpelling<CR><CR>a
" nmap <C-S-P> :call SynStack<CR>
" map <leader>v <Plug>TaskList
"
" Insert mode maps {{{
" call IMAP("\"", "\"\"", "sh")
" call IMAP("(", "", "sh")
" call IMAP("[", "[<++>]", "sh")
"}}}
" vim: foldmethod=marker
и еще snippets отсюда git://github.com/taxilian/snipmate-snippets.git
потом подумал что он не очень и перешел на qtcreator и jidea
почувствовал себя как за штурвалом самолета
вернул обратно
sy on
set tabstop=4
set shiftwidth=4
set number
set smarttab
set smartindent
set wrap
set showmatch
set hlsearch
set incsearch
set ignorecase
set ruler
set lz
syntax on
set nocp
filetype plugin on
if has("autocmd")
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
set guifont=Monaco:h13
" view manpages in vim
ru ftplugin/man.vim
if (match(fnamemodify(expand("%" ':e' 'php'
set ff=unix
endif
call pathogen#infect
syntax enable
set background=dark
" let g:solarized_termcolors=256
colorscheme solarized
nnoremap о j
nnoremap л k
nnoremap р h
nnoremap д l
Представлен новый плагин для редактора Vim - CoVim, предназначенный для организации совместного редактирования одного документа одновременно несколькими пользователями, работающими на разных компьютерах и взаимодействующими по сети. Каждый пользователь видит курсоры других участников, выделенных разными цветами, а также в режиме реального времени наблюдает за всеми вносимыми в документ изменениями.
set nocompatible
filetype plugin on
filetype indent on
let g:tex_flavor='latex'
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set textwidth=110
set t_Co=256
syntax on
colorscheme mypablo
set number
set showmatch
" intelligent comments
set comments=sl:/*,mb:\ *,elx:\ */
set keymap=russian-jcukenwin
set iminsert=0
set imsearch=0
highlight clear SpellBad
" Install OmniCppComplete like described on http://vim.wikia.com/wiki/C++_code_completion
" This offers intelligent C++ completion when typing ‘.’ ‘->’ or <C-o>
" Load standard tag files
set tags+=~/.vim/tags/cpp
set tags+=~/.vim/tags/gl
set tags+=~/.vim/tags/sdl
let Tlist_Ctags_Cmd = "/usr/bin/ctags"
let Tlist_WinWidth = 30
" Enhanced keyboard mappings
"
" in normal mode F2 will save the file
nmap <F2> :w<CR>
" in insert mode F2 will exit insert, save, enters insert again
imap <F2> <ESC>:w<CR>i
" switch between header/source with F4
map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
" recreate tags file with F5
map <F5> :!ctags -R –c++-kinds=+p –fields=+iaS –extra=+q .<CR>
map <F6> :TlistToggle<cr>
map <F7> :make<CR>
" build using makeprg with <S-F7>
map <S-F7> :make clean all<CR>
" goto definition with F12
set pastetoggle=<F11>
map <F12> <C-]>
" in diff mode we use the spell check keys for merging
if &diff
" diff settings
map <M-Down> ]c
map <M-Up> [c
map <M-Left> do
map <M-Right> dp
map <F9> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg
else
" spell settings
:setlocal spell spelllang=en
" set the spellfile - folders must exist
set spellfile=~/.vim/spellfile.add
map <M-Down> ]s
map <M-Up> [s
endif
Отдельная магия для vim-latexsuite.
Плагины omnicpp, bufferexplorer.
По умлочанию _vimrc лежит в C:/Program Files ..../.../_vimrc
Но мне нужно чтобы он читался допустим из D:/Settings/_vimrc, и все плагины оттуда же.
Let the Mortal Kombat begin!
vim -V
Поправить руками (vim запустить с правами администратора):
:e $MYVIMRC
Дать каждому участнику по тексту, и кто быстрее стартовый текст (возможно, пустой) превратит в свой, подавив все редактирование оппонента, тот Чак Норрис.
Я только что открыл для себя вим. Использую для javascript. Пока что настроил hlsearch, подсветку строк длинее 80 символов и свои регэкспы для js в ctags.
filetype off
runtime ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim
source ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#runtime_append_all_bundles
call pathogen#helptags
if !&cp | set cp | endif
let s:cpo_save=&cpo
set cpo&vim
set encoding=utf8
set history=1000
set nocompatible
set keymodel=""
set ai
set aw
set bs=2
set whichwrap=b,s,<,>,[,]
set nobackup
set ruler
set shiftwidth=4
set tabstop=4
set softtabstop=4
set showmatch
set expandtab
set incsearch
set hlsearch
set guifont=ter-c16n
set ignorecase
set smartcase
set wildmenu
set wildmode=list:longest
set scrolloff=3
set number
set foldmethod=indent
set foldlevel=99
syntax on
filetype on
filetype plugin on
filetype indent on
map <silent> <F4> :silent :NERDTreeToggle<CR>
imap <silent> <F4> :silent :NERDTreeToggle<CR>
set dir=~/.vim/swap
nmap <tab> I<tab><esc>
nmap <s-tab> ^i<bs><bs><bs><esc>
nmap <F2> :nohl<CR>
imap <F2> :nohl<CR>
map! <S-Insert> *
vmap "*d
vmap <C-Del> "*d
vmap <S-Del> "*d
vmap <C-Insert> "*y
vmap <S-Insert> "-d"*P
nmap <S-Insert> "*P
colorscheme symfony
set guifont=Lucida_Console:h10:cANSI
set helplang=en
syntax enable
set guifont=Dejavu\ Sans\ Mono\ 11
autocmd FileType python map <buffer> <F3> :call Flake8<CR>
let g:flake8_cmd="/usr/bin/flake8-python2"
let g:flake8_max_line_length=120
map <Leader>td <Plug>TaskList
map <Leader>g :GundoToggle<CR>
map <Leader>j :RopeGotoDefinition<CR>
map <Leader>r :RopeRename<CR>
map <F5> :BufOnly<CR>
nmap <Leader>a <Esc>:Ack!
noremap <F1> :Ack <cword><CR>
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplCheckDupeBufs = 0
let NERDTreeIgnore = ['\.pyc$']
плагины:
[submodule "bundle/fugitive"]
path = bundle/fugitive
url = http://github.com/tpope/vim-fugitive.git
[submodule "bundle/snipmate"]
path = bundle/snipmate
url = http://github.com/msanders/snipmate.vim.git
[submodule "bundle/surround"]
path = bundle/surround
url = http://github.com/tpope/vim-surround.git
[submodule "bundle/git"]
path = bundle/git
url = http://github.com/tpope/vim-git.git
[submodule "bundle/supertab"]
path = bundle/supertab
url = http://github.com/ervandew/supertab.git
[submodule "bundle/minibufexpl"]
path = bundle/minibufexpl
url = http://github.com/sontek/minibufexpl.vim.git
[submodule "bundle/command-t"]
path = bundle/command-t
url = http://github.com/wincent/Command-T.git
[submodule "pyflakes-pathogen"]
path = pyflakes-pathogen
url = http://github.com/mitechie/pyflakes-pathogen.git
[submodule "bundle/ack"]
path = bundle/ack
url = http://github.com/mileszs/ack.vim.git
[submodule "bundle/gundo"]
path = bundle/gundo
url = http://github.com/sjl/gundo.vim.git
[submodule "bundle/pydoc"]
path = bundle/pydoc
url = http://github.com/fs111/pydoc.vim.git
[submodule "bundle/py.test"]
path = bundle/py.test
url = http://github.com/alfredodeza/pytest.vim.git
[submodule "bundle/makegreen"]
path = bundle/makegreen
url = http://github.com/reinh/vim-makegreen
[submodule "bundle/tasklist"]
path = bundle/tasklist
url = http://github.com/vim-scripts/TaskList.vim.git
[submodule "bundle/nerdtree"]
path = bundle/nerdtree
url = http://github.com/vim-scripts/The-NERD-tree.git
[submodule "bundle/ropevim"]
path = bundle/ropevim
url = http://github.com/sontek/rope-vim.git
[submodule "bundle/vim-pathogen"]
path = bundle/vim-pathogen
url = http://github.com/tpope/vim-pathogen.git
[submodule "bundle/flake8"]
path = bundle/flake8
url = http://github.com/nvie/vim-flake8.git
[submodule "bundle/bufonly"]
path = bundle/bufonly
url = http://github.com/duff/vim-bufonly.git
[submodule "bundle/vim-javascript-indent"]
path = bundle/vim-javascript-indent
url = http://github.com/itspriddle/vim-javascript-indent.git
Оставить комментарий
Eka74
и список плагинов ( и языки или задачи с которыми их используете)