Created
October 4, 2017 01:30
-
-
Save matiasleidemer/ec18037e15b2592734ce44b63248c1b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
set number " shows line numbers | |
"set relativenumber " show relative line numbers | |
set hlsearch " highlight search results | |
set cursorline " highlight cursor line | |
set laststatus=2 " this is needed for airline | |
set visualbell " no sounds | |
set colorcolumn=80 " column with 80 | |
set wildmode=list " expand and folders/tabs when opening a file | |
set backspace=2 " makes backspace work as it should work | |
set autoread " yup | |
filetype off " required | |
let mapleader="," | |
" Vundle config | |
set rtp+=~/.vim/bundle/Vundle.vim | |
set rtp+=/usr/local/opt/fzf | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'tpope/vim-rails' | |
Plugin 'vim-ruby/vim-ruby' | |
Plugin 'MarcWeber/vim-addon-mw-utils' | |
Plugin 'tomtom/tlib_vim' | |
Plugin 'garbas/vim-snipmate' | |
Plugin 'honza/vim-snippets' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'bling/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'rking/ag.vim' | |
"Plugin 'xolox/vim-easytags' | |
Plugin 'xolox/vim-misc' | |
Plugin 'thoughtbot/vim-rspec' | |
Plugin 'jgdavey/tslime.vim' | |
Plugin 'tpope/vim-dispatch' | |
Plugin 'airblade/vim-gitgutter' | |
"Plugin 'Valloric/YouCompleteMe' | |
Plugin 'AndrewRadev/splitjoin.vim' | |
Plugin 'maksimr/vim-jsbeautify' | |
Plugin 'junegunn/vim-easy-align' | |
Plugin 'Konfekt/FastFold' | |
Plugin 'terryma/vim-multiple-cursors' | |
" Plugin 'scrooloose/syntastic' | |
Plugin 'elixir-lang/vim-elixir' | |
Plugin 'mattreduce/vim-mix' | |
" Plugin 'majutsushi/tagbar' | |
Plugin 'neovimhaskell/haskell-vim' | |
Plugin 'DataWraith/auto_mkdir' | |
Plugin 'jodosha/vim-greenbar' | |
Plugin 'kana/vim-textobj-user' | |
Plugin 'nelstrom/vim-textobj-rubyblock' | |
Plugin 'mattn/webapi-vim' | |
Plugin 'mattn/gist-vim' | |
Plugin 'tpope/vim-commentary' | |
Plugin 'fatih/vim-go' | |
Plugin 'rhysd/vim-crystal' | |
" Plugin 'eagletmt/ghcmod-vim' | |
" Plugin 'Shougo/vimproc.vim' | |
" Plugin 'ngmy/vim-rubocop' | |
Plugin 'jiangmiao/auto-pairs' | |
Plugin 'tpope/vim-surround' | |
Plugin 'sickill/vim-pasta' | |
" Plugin 'pangloss/vim-javascript' | |
" Plugin 'othree/yajs.vim' | |
Plugin 'mxw/vim-jsx' | |
" Plugin 'isRuslan/vim-es6' | |
Plugin 'ervandew/supertab' | |
Plugin 'burke/matcher' | |
Plugin 'chriskempson/base16-vim' | |
Plugin 'othree/yajs.vim' | |
Plugin 'flowtype/vim-flow' | |
Plugin 'junegunn/seoul256.vim' | |
Plugin 'wojtekmach/vim-rename' | |
Plugin 'simeji/winresizer' | |
Plugin 'matze/vim-move' | |
Plugin 'w0rp/ale' | |
Plugin 'elmcast/elm-vim' | |
call vundle#end() " required | |
filetype on | |
filetype plugin indent on " required | |
syntax enable | |
" Color scheme | |
" colorscheme Tomorrow-Night-Eighties | |
" let base16colorspace=256 " Access colors present in 256 colorspace | |
" colorscheme base16-default-dark | |
" | |
colorscheme solarized | |
set background=light | |
let g:solarized_contrast="low" | |
let g:solarized_menu=0 | |
let g:tmuxline_theme = 'iceberg' | |
" tags | |
" set tags=./.tags;,~/.vimtags | |
" ctags | |
map <silent> <Leader>rt :!retag<cr> | |
" Set indentation | |
set expandtab | |
set shiftwidth=2 | |
set softtabstop=2 | |
set tabstop=2 | |
" Set folding | |
set foldenable | |
set foldlevelstart=10 | |
set foldnestmax=10 | |
set foldmethod=indent | |
" Code formatting | |
let g:ale_fixers = { 'javascript': ['prettier_standard'], 'ruby': ['rubocop'] } | |
let g:ale_linters = { 'javascript': ['standard'] } | |
let g:ale_lint_on_text_changed = 'never' | |
let g:ale_lint_on_save = 0 | |
let g:ale_lint_on_enter = 0 | |
let g:javascript_standard_options = '--parser babel-eslint --plugin flowtype' | |
map <silent> <Leader>af :ALEFix<cr> | |
map <silent> <Leader>al :ALELint<cr> | |
" Airline config | |
let g:airline_powerline_fonts = 0 | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_theme='bubblegum' | |
let g:loaded_airline = 0 | |
" Display tabs and trailing spaces visually | |
set list listchars=tab:\ \ ,trail:· | |
" Turn Off Swap Files | |
set noswapfile | |
set nobackup | |
set nowb | |
" scrolling | |
set scrolloff=8 "Start scrolling when we're 8 lines away from margins | |
set sidescrolloff=15 | |
set sidescroll=1 | |
" search | |
set incsearch " Find the next match as we type the search | |
set hlsearch " Highlight searches by default | |
set ignorecase " Ignore case when searching... | |
set smartcase " ...unless we type a capital | |
" RSpec.vim mappings | |
au FileType ruby map <Leader>t :call RunCurrentSpecFile()<CR> | |
au FileType ruby map <Leader>s :call RunNearestSpec()<CR> | |
au FileType ruby map <Leader>l :call RunLastSpec()<CR> | |
au FileType ruby map <Leader>a :call RunAllSpecs()<CR> | |
" let g:rspec_runner = "os_x_terminal" | |
let g:rspec_command = '!bundle exec rspec {spec} --format=progress' | |
" let g:rspec_command = 'call Send_to_Tmux("bundle exec rspec {spec} --format=progress \n")' | |
" ==== NERD tree | |
" " Open the project tree and expose current file in the nerdtree with Ctrl-\ | |
nnoremap <silent> <C-\> :NERDTreeFind<CR>:vertical<CR> | |
"Move back and forth through previous and next buffers | |
"with ,z and ,x | |
nnoremap <silent> ,z :bp<CR> | |
nnoremap <silent> ,x :bn<CR> | |
" opens/closes folds | |
nnoremap <Space> za | |
" ,q to toggle quickfix window (where you have stuff like Ag) | |
" ,oq to open it back up (rare) | |
nmap <silent> ,qc :cclose<CR> | |
nmap <silent> ,qo :copen<CR> | |
" Text objects | |
runtime macros/matchit.vim | |
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s | |
call cursor(l, c) | |
endfunction | |
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() | |
" git commit messages | |
autocmd Filetype gitcommit setlocal spell textwidth=72 | |
" shortcuts for changing windows | |
map <C-h> <C-w>h | |
map <C-j> <C-w>j | |
map <C-k> <C-w>k | |
map <C-l> <C-w>l | |
" Tagbar | |
" nmap <F9> :TagbarToggle<CR> | |
" Resize | |
nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR> | |
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR> | |
" Copy relative path to clipboard | |
nnoremap <silent> <Leader>c :let @+ = expand("%")<CR> | |
nnoremap <silent> <Leader>C :let @+ = expand("%") . ":" . line(".")<CR> | |
" The Silver Searcher | |
" Inspired by http://robots.thoughtbot.com/faster-grepping-in-vim/ | |
if executable('ag') | |
" Use ag over grep | |
set grepprg=ag\ --nogroup\ --nocolor\ --path-to-agignore\ $HOME/.agignore | |
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
" ag is fast enough that CtrlP doesn't need to cache | |
let g:ctrlp_use_caching = 0 | |
" bind K to grep word under cursor | |
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR> | |
" bind , (backward slash) to grep shortcut | |
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw! | |
map <Leader>f :Ag<SPACE> | |
endif | |
if executable('matcher') | |
let g:ctrlp_match_func = { 'match': 'GoodMatch' } | |
function! GoodMatch(items, str, limit, mmode, ispath, crfile, regex) | |
" Create a cache file if not yet exists | |
let cachefile = ctrlp#utils#cachedir().'/matcher.cache' | |
if !( filereadable(cachefile) && a:items == readfile(cachefile) ) | |
call writefile(a:items, cachefile) | |
endif | |
if !filereadable(cachefile) | |
return [] | |
endif | |
" a:mmode is currently ignored. In the future, we should probably do | |
" something about that. the matcher behaves like "full-line". | |
let cmd = 'matcher --limit '.a:limit.' --manifest '.cachefile.' ' | |
if !( exists('g:ctrlp_dotfiles') && g:ctrlp_dotfiles ) | |
let cmd = cmd.'--no-dotfiles ' | |
endif | |
let cmd = cmd.a:str | |
return split(system(cmd), "\n") | |
endfunction | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment