Skip to content

Instantly share code, notes, and snippets.

@krzkrzkrz
Created January 22, 2015 07:43
Show Gist options
  • Save krzkrzkrz/7a715b527874a47a7ffc to your computer and use it in GitHub Desktop.
Save krzkrzkrz/7a715b527874a47a7ffc to your computer and use it in GitHub Desktop.
" Change leader to a comma because the backslash is too far away. That means all \x commands turn into ,x
" The mapleader has to be set before vundle starts loading all the plugins.
let mapleader="\<space>"
" ================ Vundle Config ====================
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'tpope/vim-rails.git'
Plugin 'kchmck/vim-coffee-script'
Plugin 'tomasr/molokai'
Plugin 'morhetz/gruvbox'
Plugin 'tomtom/tcomment_vim'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'ervandew/supertab'
Plugin 'majutsushi/tagbar'
Plugin 'tpope/vim-endwise'
" Plugin 'wting/gitsessions.vim'
Plugin 'mhinz/vim-startify'
Plugin 'jpalardy/vim-slime'
" Plugin 'epeli/slimux'
Plugin 'jlanzarotta/bufexplorer'
Plugin 'mustache/vim-mustache-handlebars'
" Plugin 'zefei/buftabs'
" Plugin 'fholgado/minibufexpl.vim'
" Plugin 'gcmt/taboo.vim'
" Plugin 'JessicaKMcIntosh/TagmaBufMgr'
" Plugin 'jeetsukumaran/vim-buffergator'
" gist-vim needs webapi
Plugin 'mattn/gist-vim'
Plugin 'mattn/webapi-vim'
" Plugin 'molok/vim-smartusline'
" Must install the_silver_searcher
" cd ~ && https://github.com/ggreer/the_silver_searcher ag && cd ag && ./build.sh && sudo make install
" After, you can remove ~/ag
Plugin 'rking/ag.vim'
" Plugin 'vim-scripts/Bck'
" vim-scripts repos
Plugin 'L9'
" non github repos
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" ================ General Config ====================
set number " Line numbers are good
set backspace=indent,eol,start " Allow backspace in insert mode
set history=1000 " Store lots of :cmdline history
set showcmd " Show incomplete cmds down the bottom
set showmode " Show current mode down the bottom
set cul " Highlight current line
set autoread " Reload files changed outside vim
set ignorecase " Ignore case when searching
set smartcase " When searching try to be smart about cases
set incsearch " Start search as you type
set hlsearch " Highlight search term
set wrap " Wrap long lines
set splitbelow " Split new windows below
set splitright " Split new windows right
set lazyredraw " Wait to redraw
set noshowmatch " Don't match parentheses/brackets
set nocursorline " Don't paint cursor line
let g:loaded_matchparen=1 " Dont highlight matching brackets
let html_no_rendering=1 " Don't render HTML
" Highlight the current line in insert mode different from insert mode
" autocmd InsertLeave * highlight CursorLine guifg=none guibg=#3a3a3a ctermfg=none ctermbg=236 cterm=none
" autocmd InsertEnter * highlight CursorLine guifg=none guibg=#121212 ctermfg=none ctermbg=233 cterm=none
" Don't hide the the filename when entering other modes
set modeline
set laststatus=2
" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set hidden
" Turn on syntax highlighting
syntax on
filetype plugin on
" Solarized theme setings
"let g:solarized_termcolors=256
"colorscheme solarized
" set t_Co=256
" set t_AB=^[[48;5;%dm
" set t_AF=^[[38;5;%dm
" Molokai theme settings
" set t_Co=256
" let g:molokai_original = 1
" let g:rehash256 = 1
" colorscheme molokai
" Gruvbox theme settings
let gruvbox_bold = 1
let g:gruvbox_italic = 0
" let g:gruvbox_hls_cursor = "blue"
let g:gruvbox_invert_selection = 0
let g:gruvbox_termcolors = 256
set bg=dark
colorscheme gruvbox
" Focus on tagbar when it is opened
let g:tagbar_autofocus = 1
" Let ctrlp show hidden files
let g:ctrlp_show_hidden = 1
let g:ackprg = "ack-grep -H --nocolor --nogroup --column"
" Set status line to include filename and other details
" set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
set statusline=
set statusline+=%f " Full filename
set statusline+=\ [%{strlen(&fenc)?&fenc:'none'}, " File encoding
set statusline+=%{&ff}] " File format
set statusline+=%h " Help file flag
set statusline+=%r " Read only flag
set statusline+=%y " Filetype
set statusline+=%m " Modified flag
set statusline+=%= " Left/right separator
set statusline+=%c, " Cursor column
set statusline+=%l/%L " Cursor line/total lines
set statusline+=\ %P " Percent through file
" Vim slime configuration for tmux
let g:slime_paste_file = "$HOME/.vim/.slime_paste"
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": "default", "target_pane": "1"}
let g:slime_no_mappings = 1
xmap <c-c><c-c> <Plug>SlimeRegionSend
nmap <c-c><c-c> <Plug>SlimeLineSend
" nmap <c-c><c-c> <Plug>SlimeMotionSend
" nmap <c-c><c-t> :SlimeSend1
" Vim Slimux configuration
" nmap <C-c><C-c> :SlimuxREPLSendLine<cr>
" xmap <C-c><C-c> :SlimuxREPLSendSelection<cr>
" map <C-c><C-n> :SlimuxREPLConfigure<cr>
" Vim Startify configuration
let g:startify_session_persistence = 1
" let g:startify_list_order = ['sessions', 'files', 'dir', 'bookmarks']
let g:startify_list_order = [
\ [' Sessions:'],
\ 'sessions',
\ [' Recently opened in current directory:'],
\ 'dir',
\ [' Recently opened:'],
\ 'files',
\ [' Bookmarks:'],
\ 'bookmarks',
\ ]
let g:startify_custom_header = [
\ ' "Learn from yesterday, live for today, hope for tomorrow. Everyday is a new day." ',
\ ' ',
\ ' /\ ',
\ ' * / \ _ /\ ',
\ ' /\_ _// \ / \/\ _/ \ /\ ',
\ ' _/ \/\ _/ / \_/ \_/ \__/ _\ ',
\ ' / `./ \_ \_ / // / \\ ',
\ ' __ // \_ / \ \ / _ / / \ ',
\ ' __ __ /\_\ . ___ ___ // |/ ',
\ ' ',
\ ]
" Vim easymotion configuration
map <Leader>w <Plug>(easymotion-w)
map <Leader>b <Plug>(easymotion-b)
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" =============== Vundle Initialization ===============
"
" This loads all the plugins specified in ~/.vim/vundle.vim
" Use Vundle plugin to manage all other plugins
" if filereadable(expand("~/.vim/vundles.vim"))
" source ~/.vim/vundles.vim
" endif
" ================ Turn Off Swap Files ==============
set noswapfile
set nobackup
set nowb
" ================ Use X Window clipboard instead of Vim's ==============
" Make sure vim --version | grep clipboard, returns with +clipboard
" If not, sudo pacman -S gvim
set clipboard=unnamed,unnamedplus
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
" ================ Remaps ======================
nnoremap U <c-r> " Redo
" Make sure xclip is installed, if on Unix. Let gist-vim copy the gist URL into the clipboard
let g:gist_clip_command = 'pbcopy' " For OSX
" let g:gist_clip_command = 'xclip -selection clipboard' " For Unix
" nnoremap <c-b> :BuffergatorToggle<cr>
" let g:buffergator_suppress_keymaps = 1
" let g:buffergator_sort_regime = 'mru'
" noremap <silent> <c-b> :BufExplorerHorizontalSplit<cr>
" noremap <silent> <c-b> :BufExplorerVerticalSplit<cr>
let g:bufExplorerDefaultHelp = 0 " Do not show default help.
let g:bufExplorerDisableDefaultKeyMapping = 1 " Disable default mapping.
noremap <silent> <c-b> :BufExplorer<cr>
nnoremap <c-e> :NERDTreeToggle<cr>
nnoremap <c-r> :Tagbar<cr>
" nnoremap <leader><space> :Ag
" Mapping for window navigation
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
" Mapping for tab navigation
nnoremap <c-t> :tabedit %<cr>
nnoremap <c-n> :bprev<cr>
nnoremap <c-m> :bnext<cr>
" Quick ESC
imap jj <ESC>
" Session management
" Disable for now. <leader>ss used for slime shortcuts
" nnoremap <leader>ss :GitSessionSave<cr>
" nnoremap <leader>ls :GitSessionLoad<cr>
" nnoremap <leader>ds :GitSessionDelete<cr>
" au VimLeavePre ~/Sites/* GitSessionSave " Save session automatically when vim quits
" au VimLeavePre ~/Chef/* GitSessionSave " Save session automatically when vim quits
" Set the ruby syntax for the following files
au BufRead,BufNewFile {Gemfile,Rakefile,config.ru,*.god,*.pill,*.eye} set ft=ruby
" Set the html syntax for the following files
au BufRead,BufNewFile {*.hbs} set ft=html
" ================ Indentation ======================
set autoindent
set smarttab " Be smart when using tabs
set shiftwidth=2 " 1 tab, equal two spaces
set softtabstop=2
set tabstop=2
set expandtab " Use spaces instead of tabs
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail:·
set nowrap "Don't wrap lines
set linebreak "Wrap lines at convenient points
" ================ Folds ============================
set foldmethod=indent "fold based on indent
set foldnestmax=3 "deepest fold is 3 levels
set nofoldenable "dont fold by default
" ================ Completion =======================
set wildmode=list:longest
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
set wildignore+=*vim/backups*
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=vendor/rails/**
set wildignore+=vendor/cache/**
set wildignore+=*.gem
set wildignore+=log/**
set wildignore+=tmp/**
set wildignore+=*.png,*.jpg,*.gif
" ================ Scrolling ========================
set scrolloff=8 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1
set scrolljump=8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment