Skip to content

Instantly share code, notes, and snippets.

@regedarek
Created June 12, 2015 14:13
Show Gist options
  • Save regedarek/e50c9a687281e0cd6e52 to your computer and use it in GitHub Desktop.
Save regedarek/e50c9a687281e0cd6e52 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'bling/vim-airline'
Plugin 'edkolev/tmuxline.vim'
Plugin 'jwhitley/vim-matchit'
Plugin 'killphi/vim-ruby-refactoring'
Plugin 'honza/vim-snippets'
Plugin 'SirVer/ultisnips'
Plugin 'Valloric/YouCompleteMe'
Plugin 'ervandew/supertab'
Plugin 'maxbrunsfeld/vim-yankstack'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'chriskempson/base16-vim'
Plugin 'FelikZ/ctrlp-py-matcher'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'airblade/vim-rooter'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-eunuch'
Plugin 'thoughtbot/vim-rspec'
Plugin 'benmills/vimux'
Plugin 'tpope/vim-endwise'
Plugin 'skalnik/vim-vroom'
Plugin 'tpope/vim-bundler'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-commentary'
Plugin 'tommcdo/vim-exchange'
Plugin 'pangloss/vim-javascript'
Plugin 'kchmck/vim-coffee-script'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'tpope/vim-haml'
Plugin 'slim-template/vim-slim.git'
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
Plugin 'rking/ag.vim'
Plugin 'duff/vim-bufonly'
Plugin 'regedarek/vim-bufexplorer'
Plugin 'vim-scripts/bufkill.vim'
Plugin 'jiangmiao/auto-pairs'
call vundle#end()
colorscheme base16-default
syntax enable
let mapleader=","
set t_Co=256
let base16colorspace=256 " Access colors present in 256 colorspace
set background=dark
set hidden " allow unsaved background buffers and remember marks/undo for them
set history=700 " remember more commands and search history
set noswapfile " No swap files when editing please
set autoread " Set to auto read when a file is changed from the outside
set expandtab shiftwidth=2 " set tab
set softtabstop=2 tabstop=2 " set tab
set autoindent
set laststatus=2
set showmatch
set nofoldenable " disable folding
set clipboard=unnamed
set mouse=a
set incsearch
set hlsearch
set ignorecase smartcase " make searches case-sensitive only if they contain upper-case characters
" set cursorline
set number
set switchbuf=useopen
set numberwidth=5
set winwidth=79
set t_ti= t_te= " Prevent Vim from clobbering the scrollback buffer. See
set scrolloff=3 " keep more context when scrolling off the end of a buffer
set backup " Store temporary files in a central spot
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set tags=./tags;
set noesckeys
set ttimeout
set ttimeoutlen=1
set timeoutlen=500
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set showcmd " display incomplete commands
set wildmode=longest,list " use emacs-style tab completion when selecting files, etc
set wildignore+=*.o,*.png,*.gif,*.obj
set wildignore+=.git,*/public/*,*/tmp/*,*/log/*
set wildignore+=*.so,*.swp,*.zip " MacOSX/Linux
set wildmenu " make tab completion for files/buffers act like bash
set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CUSTOM AUTOCMDS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
augroup vimrcEx
" Clear all autocmds in the group
autocmd!
autocmd FileType text setlocal textwidth=78
" markdown filetype file
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=conf
" Jump to last cursor position unless it's invalid or in an event handler
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
"for ruby, autoindent with two spaces, always expand tabs
autocmd FileType ruby,haml,eruby,yaml,html,javascript,sass,cucumber set ai sw=2 sts=2 et
autocmd BufEnter *.rb :Rooter
autocmd BufEnter *.erb :Rooter
" Unbind <enter> nohl behaviour on quickfix
autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
autocmd CmdwinEnter * nnoremap <buffer> <CR> <CR>
augroup END
" Keys maps
map <silent> <F1> :BufExplorer<CR>
map <silent> <F2> :Gstatus<CR>
map <silent> <F7> :s/:\([^ ]*\)\(\s*\)=>/\1:/g<CR>
imap jj <Esc>
nmap zz v$h
nmap <silent> rr :NERDTreeToggle<CR>
nmap <silent> <leader>b :Gbrowse<CR>
nmap <silent> <leader>d :BufOnly<CR>
nmap <silent> ff :BD<CR>
nmap <S-j> <<
nmap <S-k> >>
vnoremap < <gv
vnoremap > >gv
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap <CR> :nohlsearch<CR>
imap <c-c> <esc>
cnoremap %% <C-R>=expand('%:h').'/'<cr>
noremap <leader>w :StripWhitespace<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CtrlP
let g:ctrlp_custom_ignore = {
\ 'file': '\v\.(exe|dat|so|dll|log|gif|jpg|jpeg|png)$'
\ }
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
let g:ctrlp_map = '<c-p>'
let g:ctrlp_mruf_relative = 1
let g:ctrlp_mruf_exclude = '\v\.git/(MERGE_MSG|rebase-merge|COMMIT_EDITMSG|PULLREQ_EDITMSG|index)'
let g:ctrlp_working_path_mode = 0
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_mruf_last_entered = 1
let g:ctrlp_prompt_mappings = {
\ 'PrtSelectMove("j")': ['<s-j>', '<down>'],
\ 'PrtSelectMove("k")': ['<s-k>', '<up>'],
\ 'CreateNewFile()': ['<s-n>'],
\ 'ToggleFocus()': ['<tab>'],
\ 'ToggleByFname()': ['<c-d>'],
\ 'ToggleType(1)': ['<c-f>', '<c-j>', '<c-up>'],
\ 'ToggleType(-1)': ['<c-b>', '<c-k>', '<c-down>'],
\ 'MarkToOpen()': ['<s-l>'],
\ 'OpenMulti()': ['<s-D>'],
\ }
let g:ctrlp_open_new_file = 0
let g:ctrlp_open_multi = 'vr'
let g:ctrlp_arg_map = 0
let g:ctrlp_jump_to_buffer = 1
let g:ctrlp_dotfiles = 0
let g:ctrlp_match_window_reversed = 0
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore "**/*.pyc"
\ -g ""'
" Ag
let g:ackprg = 'ag --nogroup --nocolor --column --smart-case'
" Gist
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
let g:gist_post_private = 1
" Airline
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline#extensions#tmuxline#enabled = 0
" Tmuxline
let g:tmuxline_powerline_separators = 0
let g:tmuxline_preset = 'nightly_fox'
let g:tomato#show_clock = 1
let g:tomato#show_count_down = 1
" Rspec
let g:VimuxUseNearest = 1
let g:vroom_use_vimux = 1
let g:vroom_use_colors = 1
map <Leader>t :VroomRunTestFile<CR>
map <Leader>T :VroomRunNearestTest<CR>
map <Leader>l :VroomRunLastTest<CR>
" Yankstack
let g:yankstack_map_keys = 0
let g:yankstack_yank_keys = ['y', 'd']
nmap <leader>p <Plug>yankstack_substitute_older_paste
nmap <leader>P <Plug>yankstack_substitute_newer_paste
" Vimux
function! VimuxSlime()
call VimuxSendText(@v)
call VimuxSendKeys("Enter")
endfunction
vmap <leader>s "vy :call VimuxSlime()<CR>
" Easymotion
let g:EasyMotion_leader_key = ','
let g:EasyMotion_do_mapping = 1
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012347890'
let g:EasyMotion_mapping_w = 's'
let g:EasyMotion_mapping_b = 'S'
" Syntastic
let g:syntastic_ruby_checkers = ['rubocop', 'mri']
let g:syntastic_ruby_rubocop_exec = 'rubocop'
let g:syntastic_coffee_coffeelint_args = "-f .coffeelint.json"
" Ultisnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" YouCompleteMe
let g:ycm_key_list_select_completion = ['<C-j>', '<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-k>', '<C-p>', '<Up>']
" SuperTab
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:SuperTabCrMapping = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment