Skip to content

Instantly share code, notes, and snippets.

@milushov
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milushov/d6a36ad2d37aaa395a02 to your computer and use it in GitHub Desktop.
Save milushov/d6a36ad2d37aaa395a02 to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'scrooloose/nerdtree'
Bundle 'tpope/vim-commentary'
Bundle 'scrooloose/nerdcommenter'
Bundle 'kien/ctrlp.vim'
Bundle 'tommcdo/vim-exchange'
Bundle 'tpope/vim-unimpaired'
"Bundle 'AutoComplPop' make vim sooo slow
"Bundle 'taglist.vim'
"Bundle 'YankRing.vim'
Bundle 'tpope/vim-fugitive'
Bundle 'scrooloose/syntastic'
Bundle 'msanders/snipmate.vim'
Bundle 'tpope/vim-surround'
Bundle 'tsaleh/vim-align'
Bundle 'mileszs/ack.vim'
Bundle 'austintaylor/vim-indentobject'
Bundle 'greplace.vim'
Bundle 'Lokaltog/vim-powerline'
Bundle 'sjl/splice.vim'
"Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'Yggdroot/indentLine'
Bundle 'tpope/vim-endwise'
Bundle 'Raimondi/delimitMate'
Bundle 'calendar.vim--Matsumoto'
Bundle 'chrisbra/NrrwRgn'
Bundle 'utl.vim'
Bundle 'hsitz/VimOrganizer'
Bundle 'sjl/gundo.vim'
Bundle 'AndrewRadev/switch.vim'
" Ruby/Rails
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-bundler'
Bundle 'tpope/vim-rake'
Bundle 'nelstrom/vim-textobj-rubyblock'
Bundle 'ecomba/vim-ruby-refactoring'
Bundle 'apidock.vim'
" color themes
Bundle 'altercation/vim-colors-solarized'
Bundle 'tpope/vim-vividchalk'
Bundle 'tomasr/molokai'
" syntax support
Bundle 'vim-ruby/vim-ruby'
Bundle 'tsaleh/vim-tmux'
Bundle 'Puppet-Syntax-Highlighting'
"Bundle 'JSON.vim'
Bundle 'elzr/vim-json'
Bundle 'tpope/vim-cucumber'
Bundle 'tpope/vim-haml'
Bundle 'godlygeek/tabular'
Bundle 'tpope/vim-markdown'
Bundle 'kchmck/vim-coffee-script'
Bundle 'vitaly/vim-syntastic-coffee'
Bundle 'vim-scripts/jade.vim'
Bundle 'wavded/vim-stylus'
Bundle 'VimClojure'
"Bundle 'slim-template/vim-slim'
Bundle 'groenewege/vim-less'
" Support and minor
Bundle 'kana/vim-textobj-user'
Bundle 'tpope/vim-repeat'
"add to existing wildignore instead of overwriting it
"Bundle 'taasaa/vim-gitignore'
Bundle 'scrooloose/vim-space'
Bundle 'mattn/gist-vim'
Bundle 'mattn/webapi-vim'
"Bundle 'ShowMarks'
"Bundle 'tpope/vim-unimpaired'
"Bundle 'reinh/vim-makegreen'
"Bundle 'skammer/vim-css-color'
"Bundle 'hail2u/vim-css3-syntax'
" be 'modern'
set nocompatible
syntax on
filetype plugin indent on
" prevent vim from adding that stupid empty line at the end of every file
set noeol
set binary
" utf-8/unicode support
" requires Vim to be compiled with Multibyte support, you can check that by
" running `vim --version` and checking for +multi_byte.
if has('multi_byte')
scriptencoding utf-8
set encoding=utf-8
end
" presentation settings
set number " precede each line with its line number
set numberwidth=3 " number of culumns for line numbers
set textwidth=0 " Do not wrap words (insert)
set nowrap " Do not wrap words (view)
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ruler " line and column number of the cursor position
set wildmenu " enhanced command completion
set visualbell " use visual bell instead of beeping
set laststatus=2 " always show the status line
"set listchars=tab:▷⋅,trail:·,eol:$
set listchars=tab:▷⋅,trail:·
set list
" highlight spell errors
hi SpellErrors guibg=red guifg=black ctermbg=red ctermfg=black
" behavior
" ignore these files when completing names and in
" explorer
set wildignore=.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif
" https://github.com/brigade/scss-lint/issues/383#issuecomment-77934345
"set shell=/bin/zsh " use bash for shell commands
set shell=/bin/sh " use bash for shell commands
set autowriteall " Automatically save before commands like :next and :make
set hidden " enable multiple modified buffers
set history=10000
set autoread " automatically read file that has been changed on disk and doesn't have changes in vim
set backspace=indent,eol,start
set guioptions-=T " disable toolbar"
set completeopt=menuone,preview
let bash_is_sh=1 " syntax shell files as bash scripts
set cinoptions=:0,(s,u0,U1,g0,t0 " some indentation options ':h cinoptions' for details
set modelines=5 " number of lines to check for vim: directives at the start/end of file
"set fixdel " fix terminal code for delete (if delete is broken but backspace works)
set autoindent " automatically indent new line
set ts=4 " number of spaces in a tab
set sw=4 " number of spaces for indent
set et " expand tabs into spaces
" mouse settings
if has("mouse")
set mouse=a
endif
set mousehide " Hide mouse pointer on insert mode."
" search settings
set incsearch " Incremental search
set hlsearch " Highlight search match
set ignorecase " Do case insensitive matching
set smartcase " do not ignore if search pattern has CAPS
" omni completion settings
set ofu=syntaxcomplete#Complete
let g:rubycomplete_buffer_loading = 0
let g:rubycomplete_classes_in_global = 1
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType scss set omnifunc=csscomplete#CompleteCSS
"autocmd FileType sass set omnifunc=csscomplete#CompleteCSS
" directory settings
silent !mkdir -vp ~/.backup/undo/ > /dev/null 2>&1
set backupdir=~/.backup,. " list of directories for the backup file
set directory=~/.backup,~/tmp,. " list of directory names for the swap file
set nobackup " do not write backup files
set noswapfile " do not write .swp files
set undofile
set undodir=~/.backup/undo/,~/tmp,.
" folding
set foldcolumn=0 " columns for folding
set foldmethod=indent
set foldlevel=9
set nofoldenable "dont fold by default "
" extended '%' mapping for if/then/else/end etc
runtime macros/matchit.vim
let mapleader = ","
let maplocalleader = "\\"
" showmarks
let g:showmarks_enable = 0 " disabled by default by populardemand ;)
hi! link ShowMarksHLl LineNr
hi! link ShowMarksHLu LineNr
hi! link ShowMarksHLo LineNr
hi! link ShowMarksHLm LineNr
" syntastic
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=2
" delimitMate
let g:delimitMate_expand_space = 1
let g:delimitMate_expand_cr = 1
" nerdtree
" Ctrl-P to Display the file browser tree
nmap <C-P> :NERDTreeToggle<CR>
" ,p to show current file in the tree
nmap <leader>p :NERDTreeFind<CR>
" nerdcommenter
" ,/ to invert comment on the current line/selection
nmap <leader>/ :call NERDComment(0, "invert")<cr>
vmap <leader>/ :call NERDComment(0, "invert")<cr>
" ,t to show tags window
let Tlist_Show_Menu=1
nmap <leader>t :TagbarToggle<CR>
" sessionman
nmap <leader>S :SessionList<CR>
nmap <leader>SS :SessionSave<CR>
nmap <leader>SA :SessionSaveAs<CR>
let g:Conque_Read_Timeout = 50 " timeout for waiting for command output.
let g:Conque_TERM = 'xterm'
" ,sh shell window
nmap <Leader>sh :ConqueSplit bash<cr>
" ,r run command
nmap <Leader>R :ConqueSplit
" yankring
let g:yankring_replace_n_pkey = '<leader>['
let g:yankring_replace_n_nkey = '<leader>]'
" ,y to show the yankring
nmap <leader>y :YRShow<cr>
" put the yankring_history file in ~/.backup
let g:yankring_history_dir = '~/.backup'
" rails
" completing Rails hangs a lot
"let g:rubycomplete_rails = 1
" command-t
"nmap <unique> <silent> <Leader>, :CommandT<CR>
"nmap <unique> <silent> <Leader>. :CommandTFlush<CR>:CommandT<CR>
"let g:CommandTMatchWindowAtTop=1
let g:ctrlp_map = '<leader>,'
"let g:ctrlp_cmd = 'CtrlPMixed'
nmap <leader>. :CtrlPClearAllCache<cr>:CtrlP<cr>
nmap <leader>i :CtrlPBookmarkDir<cr>
nmap <leader>ia :CtrlPBookmarkDirAdd<cr>
nmap <leader>l :CtrlPLine<cr>
nmap <leader>b :CtrlPBuff<cr>
nmap <leader>m :CtrlPBufTag<cr>
nmap <leader>M :CtrlPBufTagAll<cr>
let g:ctrlp_clear_cache_on_exit = 1
" ctrlp leaves stale caches behind if there is another vim process runnin
" which didn't use ctrlp. so we clear all caches on each new vim invocation
cal ctrlp#clra()
let g:ctrlp_max_height = 40
" show on top
"let g:ctrlp_match_window_bottom = 0
"let g:ctrlp_match_window_reversed = 0
" jump to buffer in the same tab if already open
let g:ctrlp_switch_buffer = 1
" if in git repo - use git file listing command, should be faster
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files --exclude-standard -co ']
" open multiple files with <c-z> to mark and <c-o> to open. v - opening in
" vertical splits; j - jump to first open buffer; r - open first in current buffer
let g:ctrlp_open_multiple_files = 'vjr'
"let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'mixed', 'line']
let g:ctrlp_extensions = ['mixed', 'funky']
" Fugitive
" ,g for Ggrep
nmap <leader>g :silent Ggrep<space>
" ,f for global git serach for word under the cursor (with highlight)
nmap <leader>f :let @/="\\<<C-R><C-W>\\>"<CR>:set hls<CR>:silent Ggrep -w "<C-R><C-W>"<CR>:ccl<CR>:cw<CR><CR>
" same in visual mode
:vmap <leader>f y:let @/=escape(@", '\\[]$^*.')<CR>:set hls<CR>:silent Ggrep -F "<C-R>=escape(@", '\\"#')<CR>"<CR>:ccl<CR>:cw<CR><CR>
" Ack
" ,a for Ack
nmap <leader>k :Ack<space>
" vim-indentobject
" add Markdown to the list of indentation based languages
let g:indentobject_meaningful_indentation = ["haml", "sass", "python", "yaml", "markdown"]
" indent-guides
"let g:indent_guides_start_level = 2
"let g:indent_guides_enable_on_vim_startup = 1
"let g:indent_guides_guide_size = 2
"let g:indent_guides_color_change_percent = 5
" indentLine
let g:indentLine_char = '┆'
" VimClojure
let g:vimclojure#ParenRainbow = 1
let g:vimclojure#DynamicHighlighting = 1
" Utl.vim
if has("mac")
let g:utl_cfg_hdl_scm_http_system = "!open '%u'"
end
nmap <leader>o :Utl
" VimOrganizer
au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
au BufEnter *.org call org#SetOrgFileType()
" Gundo
nmap <leader>u :GundoToggle<CR>
let g:gundo_close_on_revert = 1
" Switch
" making some of the switches defined for ruby work in HAML files
autocmd FileType haml let b:switch_definitions =
\ [
\ g:switch_builtins.ruby_hash_style,
\ g:switch_builtins.ruby_string,
\ g:switch_builtins.true_false,
\ g:switch_builtins.true_false,
\ ]
if has('gui_running')
source ~/.vim/gvimrc
end
:let $cur_project = '~/work/aimpr/' "current working derectory
let g:enable_numbers = 0
Bundle "myusuf3/numbers.vim"
Bundle "mattn/pastebin-vim"
"Bundle 'mikewest/vimroom'
Bundle "pangloss/vim-javascript"
"g:javascript_conceal = 1
"Bundle 'majutsushi/tagbar'
"Bundle "kien/tabman.vim"
"Bundle "vim-scripts/loremipsum"
"Bundle "gorkunov/smartgf.vim"
Bundle "gorkunov/smartpairs.vim"
"Bundle "kien/rainbow_parentheses.vim"
"Bundle "skammer/vim-css-color"
Bundle "maksimr/vim-translator"
Bundle "mtscout6/vim-cjsx"
Bundle "othree/html5.vim"
Bundle "evanmiller/nginx-vim-syntax"
autocmd BufNewFile,BufRead *.csx,*.cjsx set filetype=coffee
let g:goog_user_conf = {
\'langpair': 'en|ru',
\'cmd': 'node',
\'v_key': 'T'
\}
Bundle 'noahfrederick/Hemisu'
"Bundle 'powerman/vim-plugin-ruscmd'
Bundle 'flazz/vim-colorschemes'
colorscheme molokai
":set background=light
"let molokai_original = 1
"let g:rehash256 = 1
"colorscheme Tomorrow-Night-Eighties
"colorscheme Tomorrow-Night
set t_Co=256
set autoindent
set smartindent
set smarttab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set autoread
set smartcase " Override the 'ignorecase' option if the search pattern contains upper case characters
set incsearch
set shiftround " drop unused spaces
"set wrap " перенос длинных строк
set lbr " переносить целые слова
set mousehide " скрывать мышь в режиме ввода текста
set encoding=utf-8
set nu " Номерация строк
"set visualbell "No sounds
set laststatus=2
set ignorecase " Игнорировать регистр букв при поиске
set guitablabel=%t " tab name
set nobackup " Отключаеd создание бэкапов
set noswapfile " Отключаем создание swap файлов
set clipboard=unnamed " Работать с буфером обмена сиситемы
" Убрать тулбары
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=L "remove right-hand scroll bar
filetype on
filetype plugin on
filetype indent on
set guifont=Menlo\ Regular\ for\ Powerline:h14
let g:Powerline_symbols = 'fancy' " Powerline (makes neat status bar)
" hide bold vertical line (line, which is part of dotvim from astrails) https://github.com/astrails/dotvim/issues/14
let g:indent_guides_enable_on_vim_startup = 1
set ts=2 sw=2 et
nmap <leader>v :edit $MYVIMRC<CR>
nnoremap <leader>vs :source $MYVIMRC<CR>
" enabling indicate switching to insert mode
" http://stackoverflow.com/questions/6488683/how-do-i-change-the-vim-cursor-in-insert-normal-mode/6489348#6489348
:autocmd InsertEnter,InsertLeave * set cul!
" enabling moving line up or down
inoremap <C-j> <Esc>:m+<CR>==gi
nnoremap <C-k> mz:m-2<CR>`z==
inoremap <C-k> <Esc>:m-2<CR>==gi
vnoremap <C-j> :m'>+<CR>gv=`<my`>mzgv`yo`z
nnoremap <C-j> mz:m+<CR>`z==
vnoremap <C-k> :m'<-2<CR>gv=`>my`<mzgv`yo`z
" http://vim.wikia.com/wiki/Insert_newline_without_entering_insert_mode
map <S-Enter> O<Esc>j
map <CR> o<Esc>k
" http://vim.wikia.com/wiki/Drag_words_with_Ctrl-left/right
:vmap <C-l> xpgvlolo
:vmap <C-h> xhPgvhoho
" enable unselecting of searchig results by press space key two times or escape key
"map <SPACE> <SPACE>:noh<CR>
nnoremap <esc> :noh<return><esc>
map <C-s> :w
" saving by press Ctrl+S
noremap <silent> <C-S> :update<CR>
vnoremap <silent> <C-S> <C-C>:update<CR>
inoremap <silent> <C-S> <C-O>:update<CR>
fu! SaveSess()
execute 'mksession! ' . getcwd() . '/.session.vim'
endfunction
fu! RestoreSess()
if filereadable(getcwd() . '/.session.vim')
execute 'source ' . getcwd() . '/.session.vim'
if bufexists(1)
for l in range(1, bufnr('$'))
if bufwinnr(l) == -1
exec 'sbuffer ' . l
endif
endfor
endif
endif
syntax on
endfunction
if has('gui_running')
if 0 == argc()
:cd $cur_project
"autocmd VimLeave * call SaveSess()
"autocmd VimEnter * call RestoreSess()
end
end
" Mappings for working with splits
" mapings from very very lazy man from there: http://vim.wikia.com/wiki/VimTip427 with my modifications
" Maps Alt-[h,j,k,l] to resizing a window split
:let resize_w = 20
:let resize_h = 5
map <silent> <A-h> :exe "vertical resize " . (winwidth(0) - resize_w)<CR>
map <silent> <A-j> :exe "resize " . (winheight(0) - resize_h)<CR>
map <silent> <A-k> :exe "resize " . (winheight(0) + resize_h)<CR>
map <silent> <A-l> :exe "vertical resize " . (winwidth(0) + resize_w)<CR>
" Maps Alt-[s.v] to horizontal and vertical split respectively
map <silent> <M-s> :split<CR>
map <silent> <M-v> :vsplit<CR>
" Maps Alt-[n,p] for moving next and previous window respectively
map <silent> <A-n> <C-w><C-w>
map <silent> <A-p> <C-w><S-w>
" half-page smooth-scrolling
:map <C-U> <C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y>
:map <C-D> <C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E>
nnoremap <F3> :NumbersToggle<CR>
let g:pastebin_api_dev_key = '8433a2d6cfbfb3977ee3339fcd481903'
let g:pastebin_private = '1'
nnoremap <leader>vr :VimroomToggle<cr>
let g:NERDTreeWinPos = 'right'
let g:NERDTreeWinSize = 40
let g:NERDTreeRespectWildIgnore = 0
ino <silent> <c-r><tab> <c-r>=ShowAvailableSnips()<cr>
if exists('+colorcolumn')
" ruler http://stackoverflow.com/a/3765575/1171144
set colorcolumn=81
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
"function! StartUp()
"if 0 == argc()
"NERDTree
"end
"endfunction
if has('gui_running')
" fuck that, because on start with saved session
" it add yet anoter NERDTree window
" autocmd VimEnter * call StartUp()
end
" http://vim.wikia.com/wiki/Search_all_files_in_project_quickly
map _u :call ID_search()<Bar>execute "/\\<" . g:word . "\\>"<CR>
map _n :n<Bar>execute "/\\<" . g:word . "\\>"<CR>
function! ID_search()
let g:word = expand("<cword>")
let x = system("lid --key=none ". g:word)
let x = substitute(x, "\n", " ", "g")
execute "next " . x
endfun
" select all
"noremap <c-a> ggVG
" http://vim.wikia.com/wiki/Open_PDF_files
":command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk <q-args> -
":command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk <q-args> - |fmt -csw78
set grepprg=ack
hi level13c ctermfg=darkgreen guifg=darkgreen
" from http://vimcasts.org/episodes/working-with-tabs/
" For mac users (using the 'apple' key)
"map <D-S-]> gt
"map <D-S-[> gT
"map <D-1> 1gt
"map <D-2> 2gt
"map <D-3> 3gt
"map <D-4> 4gt
"map <D-5> 5gt
"map <D-6> 6gt
"map <D-7> 7gt
"map <D-8> 8gt
"map <D-9> 9gt
"map <D-0> :tablast<CR>
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/#important-vimrc-lines
nnoremap <leader>w <C-w>v<C-w>l
"key mapping for tab navigation
nmap <Tab> gt
nmap <S-Tab> gT
":au FocusLost,BufLeave,InsertLeave * silent! :update
:au FocusLost,BufLeave * silent! :update
" not working
"Bundle 'sjl/vitality.vim'
"autocmd BufLeave,FocusLost * silent! wall
"autocmd! FocusGained
nnoremap ; :
vnoremap ; :
cnoremap ; :
inoremap kk <Esc>
" I can type :help on my own, thanks.
noremap <F1> <Esc>
" ****************** SCROLLING *********************
set scrolloff=20 " Number of lines from vertical edge to start scrolling
set sidescrolloff=15 " Number of cols from horizontal edge to start scrolling
set sidescroll=1 " Number of cols to scroll at a time
" Resize splits when the window is resized
au VimResized * exe "normal! \<c-w>="
""maximize vim window
"com! MAX :let &lines=500<bar>let &columns=500
"map <leader>m :MAX<CR> move the cursor in insert mode
" move the cursor in insert mode
imap <C-h> <C-o>h
imap <C-j> <C-o>j
imap <C-k> <C-o>k
imap <C-l> <C-o>l
" Jump to start and end of line using the home row keys
nnoremap <c-h> ^
nnoremap <c-l> $
" Remove All the Trailing Whitespacesa (http://vimbits.com/bits/47)
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<cr>
" Highlight word at cursor without changing position (http://vimbits.com/bits/19)
nnoremap <leader>h *<C-O>
" Highlight word at cursor and then Ack it.
nnoremap <leader>H *<C-O>:AckFromSearch!<CR>
" Avoiding trailing white-space in Ruby files
"autocmd BufWritePre {*.rb,*.js,*.coffee,*.scss,*.haml} :%s/\s\+$//e
" Open help to the right or in new tab
cnoremap <expr> hr getcmdtype() == ':' && empty(getcmdline()) ? 'bo vert h ' : 'hr'
cnoremap <expr> ht getcmdtype() == ':' && empty(getcmdline()) ? 'tab h ' : 'ht'
" When opening a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
" start gVim maximized? [not working]
"au GUIEnter * simalt ~x
"let g:NERDTreeQuitOnOpen = 1
cnoremap <C-j> <t_kd>
cnoremap <C-k> <t_ku>
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
" Make Y behave like other capitals
nnoremap Y y$
" split right or below
set splitright
set splitbelow
" http://goo.gl/Upx7U
noremap <silent> <F4> :let @+=expand("%:p")<CR>
" for ctrl-vk
au BufWritePre *.coffee checktime
" Move tabs with alt + left|right
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . tabpagenr()<CR>
Bundle 'nelstrom/vim-visual-star-search'
Bundle 'Lokaltog/vim-easymotion'
let g:EasyMotion_leader_key = '<Leader>e'
" next few lines taken from here https://github.com/freshtonic/dotfiles/blob/master/vimrc
" Easier to type, and I never use the default behavior.
noremap H ^
noremap L g_
" Same when jumping around
nnoremap g; g;zz
nnoremap g, g,zz
Bundle 'airblade/vim-gitgutter'
nmap gh <Plug>GitGutterNextHunk
nmap gH <Plug>GitGutterPrevHunk
vmap <silent> u <esc>:Gdiff<cr>gv:diffget<cr><c-w><c-w>ZZ
Bundle 'Shougo/neocomplcache'
let g:neocomplcache_enable_at_startup = 1
Bundle 'terryma/vim-multiple-cursors'
Bundle 'terryma/vim-expand-region'
set wildignore+=*/tmp/*,*.swp,*.zip,*.png,*.jpg,*.jpeg,*.gif
" it's not wirking when g:ctrlp_user_command is set
" not working with public :-(
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$\|public',
\ 'file': '\v\.(png|jpg|jpeg|gif)$',
\ }
" overwirte variable from ~/.vim/plugins.vim
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files --exclude-standard -co |& egrep -v "\.(png|jpg|jpeg|gif)$"']
let g:ctrlp_mruf_exclude = '/tmp/.*'
let g:ctrlp_max_files = 20000
let g:ctrlp_max_files=0
let g:ctrlp_max_depth = 40
Bundle 'tacahiroy/ctrlp-funky'
nnoremap <leader>f :CtrlPFunky<Cr>
"nnoremap <Space>fU :execute 'CtrlPFunky '.expand('<cword>')<Cr>
let g:ctrlp_buffer_func = { 'enter': 'MyCtrlPMappings' }
func! MyCtrlPMappings()
nnoremap <buffer> <silent> <c-@> :call <sid>DeleteBuffer()<cr>
endfunc
func! s:DeleteBuffer()
exec "bd" fnamemodify(getline('.')[2:], ':p')
exec "norm \<F5>"
endfunc
" https://gist.github.com/andyfowler/1195581#comment-816251
"Bundle 'sjl/vitality.vim'
Bundle 'milkypostman/vim-togglelist'
filetype on
filetype plugin on
filetype indent on
syntax on
let g:gist_clip_command = 'pbcopy'
":set &t_Co=256
"Bundle 'rking/vim-detailed'
"colo detailed
autocmd BufReadPost * call SetCursorPosition()
function! SetCursorPosition()
if &filetype !~ 'commit\c'
if line("'\"") > 0 && line("'\"") <= line("$")
exe "normal! g`\""
normal! zz
endif
end
endfunction
set foldcolumn=4
" Folding - http://vim.wikia.com/wiki/Folding {{{1
" Customized version of folded text, idea by
" http://www.gregsexton.org/2011/03/improving-the-text-displayed-in-a-fold/
function! NeatFoldText() "{{{2
let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' '
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = '| ' . printf("%10s", lines_count . ' lines ')
let foldchar = matchstr(&fillchars, 'fold:\zs.')
let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
let lineCount = line("$")
let foldPercentage = printf("[%.1f", (lines_count*1.0)/lineCount*100) . "%] "
let foldtextend = lines_count_text . foldPercentage . repeat(foldchar, 8)
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn
return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend
endfunction
"}}}
set foldtext=NeatFoldText()
function! MarkdownFolds()
let thisline = getline(v:lnum)
if match(thisline, '^##') >= 0
return ">2"
elseif match(thisline, '^#') >= 0
return ">1"
else
return "="
endif
endfunction
" markdown folding {{{3
function! MarkdownFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
au BufEnter *.md setlocal foldexpr=MarkdownFolds()
au BufEnter *.md setlocal foldmethod=expr
au BufEnter *.md setlocal foldtext=MarkdownFoldText()
au BufEnter *.md setlocal syntax=markdown
" }}}
set foldmethod=syntax
set foldlevelstart=1
let javaScript_fold=1 " JavaScript
let perl_fold=1 " Perl
let php_folding=1 " PHP
let r_syntax_folding=1 " R
let ruby_fold=1 " Ruby
let sh_fold_enabled=1 " sh
let vimsyn_folding='af' " Vim script
let xml_syntax_folding=1 " XML
" Marker only vim files
:autocmd FileType vim setlocal fdm=marker
:autocmd FileType coffee setlocal fdm=indent
:autocmd FileType haml setlocal fdm=indent
nnoremap <Space> za
"}}}
Bundle 'rking/ag.vim'
"Bundle 'Floobits/floobits-vim'
"не работает на макмини
"Bundle 'rorymckinley/vim-rubyhash'
noremap <silent> <F4> :let @+ = expand("%")<CR> "http://goo.gl/W5wFy
Bundle 'moll/vim-bbye'
" 'quote' a word
"nnoremap qw :silent! normal mpea'<Esc>bi'<Esc>`pl
" double "quote" a word
"nnoremap qd :silent! normal mpea"<Esc>bi"<Esc>`pl
" remove quotes from a word
"nnoremap wq :silent! normal mpeld bhd `ph<CR>
Bundle 'rizzatti/funcoo.vim'
Bundle 'rizzatti/dash.vim'
:nmap <silent> <leader>d <Plug>DashSearch
let g:ruby_path=$RUBY_BIN
" GREAT! make shorcuts sj , sk
Bundle 'AndrewRadev/splitjoin.vim'
highlight NonText guifg=bg
" http://stackoverflow.com/questions/11993851/how-to-delete-not-cut
"nnoremap d "_d
"vnoremap d "_d
"set wrap
set synmaxcol=120
"Bundle 'onemanstartup/vim-flog'
"silent exe 'g:flog_enable'
"Bundle 'rainerborene/vim-reek'
"let coffee_lint_options = '-f ~/.coffeelint_config.json'
set cursorline
" Great! - to toggle some definitions
nnoremap - :Switch<cr>
set relativenumber
set number
"}}}
" 21 executing external commands{{{
" TODO: Check for usefullness of zsh in vim
" set sh=/usr/local/bin/zsh
"}}}
" 22 running make and jumping to errors
" 23 language specific{{{
" Russian is specific
set langmap=ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕHГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
"}}}
"
set autoread
autocmd BufNewFile,BufRead,BufReadPost *.eco set syntax=html
autocmd BufNewFile,BufRead,BufReadPost *.eco set fdm=indent
autocmd BufNewFile,BufRead,BufReadPost *.eco set syntax=html
autocmd BufNewFile,BufRead,BufReadPost *.html set syntax=html
autocmd BufNewFile,BufRead,BufReadPost *.html set fdm=indent
autocmd BufNewFile,BufRead,BufReadPost *.html set syntax=html
"http://stackoverflow.com/a/927634/1171144
autocmd CursorHold * checktime
autocmd BufNewFile,BufRead,BufReadPost *.slim set syntax=html
autocmd BufNewFile,BufRead,BufReadPost *.slim set fdm=indent
autocmd BufNewFile,BufRead,BufReadPost *.slim set syntax=slim
autocmd BufNewFile,BufRead,BufReadPost *.cap set syntax=ruby
" This plugin adds ic, ac, iC, and aC as text-objects. Use them in commands like vic, cic, and daC.
Bundle 'coderifous/textobj-word-column.vim'
" align
Bundle 'junegunn/vim-easy-align'
vnoremap <silent> <Enter> :EasyAlign<Enter>
:nmap cp :let @* = expand("%")<CR>
"set guifont=Source\ Code\ Pro\ 14
let g:exchange_no_mappings=1
nmap cx <Plug>(Exchange)
vmap X <Plug>(Exchange)
nmap cxc <Plug>(ExchangeClear)
nmap cxx <Plug>(ExchangeLine)
Bundle 'onemanstartup/vim-slim.git'
syntax enable
filetype plugin indent on
let g:ackprg = 'ag --nogroup --nocolor --column'
Bundle 'vim-scripts/loremipsum'
" http://stackoverflow.com/a/15867373/1171144
nnoremap K :help <C-r><C-w><CR>
highlight Cursor guibg=red
"test
nnoremap <leader>t :w\|:!rspec --color %<cr>
"Bundle 'tpope/vim-rvm'
":autocmd BufEnter * Rvm
" http://www.reddit.com/r/vim/comments/2xl1nz/getting_cut_copy_paste_to_feel_native/
"vnoremap <C-c> "*y
"vnoremap <D-c> "*y
"vnoremap <C-x> "*d
"vnoremap <D-x> "*d
"inoremap <C-v> <Esc>:set paste<CR>i<C-r>*<Esc>:set nopaste<CR>a
"inoremap <D-v> <Esc>:set paste<CR>i<C-r>*<Esc>:set nopaste<CR>a
":autocmd BufWinEnter * setlocal modifiable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment