Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
319 lines (234 sloc) 8.66 KB
set shell=/bin/sh
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
" Leader
let mapleader = " "
set nocompatible " Use Vim settings, rather then Vi settings
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
if filereadable(expand("~/.dotfiles/vim/vim.bundles"))
source ~/.dotfiles/vim/vim.bundles
endif
filetype plugin indent on
set backspace=indent,eol,start " make backspace work better
" NERDTree
map <Leader>/ :NERDTreeToggle<CR>
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Slimux
nnoremap <C-x> :SlimuxREPLSendLine<CR>
nnoremap <Leader>x :SlimuxREPLSendBuffer<CR>
vnoremap <Leader>x :SlimuxREPLSendSelection<CR>
augroup vimrcEx
autocmd!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile *.md set filetype=markdown
" Enable spellchecking for Markdown
autocmd BufRead,BufNewFile *.md setlocal spell
" Automatically wrap at 80 characters for Markdown
autocmd BufRead,BufNewFile *.md setlocal textwidth=80
augroup END
au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
au BufEnter *.org call org#SetOrgFileType()
au BufNewFile,BufRead vim.bundles set filetype=vim
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
" Code folding
set foldlevelstart=0
" Space to toggle folds
nnoremap <Space> za
vnoremap <Space> za
" Refocus folds
nnoremap ,z zMzvzz
" Make zO recursively open whatever top level fold we're in, no matter where
" the
" cursor happens to be.
nnoremap zO zCzO
inoremap <S-Tab> <C-d>
" Display extra whitespace
set list listchars=tab:»·,trail:·
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
" if executable('ag')
" " Use Ag over Grep
" set grepprg=ag\ --nogroup\ --nocolor
"
" " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
" let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden --ignore-dir=.git -g ""'
" endif
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/node_modules/* " MacOSX/Linux
let g:ctrlp_custom_ignore = '\v[\/](node_modules|bower_components|build|target|dist)|(\.(swp|ico|git|svn))$'
" Color scheme
" set background=dark
" let base16colorspace=256
" colorscheme base16-ocean
" highlight NonText guibg=#060606
" highlight Folded guibg=#0A0A0A guifg=#9090D0
let g:onedark_termcolors=16
colorscheme onedark
" let g:startify_custom_header=$doge
vmap <S-Up> <Plug>SchleppUp
vmap <S-Down> <Plug>SchleppDown
vmap <S-Left> <Plug>SchleppLeft
vmap <S-Right> <Plug>SchleppRight
let g:tmuxline_separators = {
\ 'left' : '',
\ 'left_alt': '>',
\ 'right' : '',
\ 'right_alt' : '<',
\ 'space' : ' '}
" Numbers
set number
set numberwidth=5
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
" Snippets are activated by Shift+Tab
" let g:snippetsEmu_key = "<S-Tab>"
" let g:tagbar_ctags_bin = ""/opt/boxen/homebrew/bin/ctags"
" nmap <leader>t :TagbarToggle<CR>
nnoremap <leader>t :CtrlPCurWD<CR>
nnoremap <leader>p :CtrlPTag<CR>
" Reevaluate current file - useful for editing .vimrc
nnoremap <leader>r :so %<CR>
" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
" let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
" Index ctags from any project, including those outside Rails
" map <Leader>ct :!ctags -R .<CR>
" Switch between the last two files
nnoremap <leader><leader> <c-^>
" vim-rspec mappings
" nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
" nnoremap <Leader>s :call RunNearestSpec()<CR>
" nnoremap <Leader>l :call RunLastSpec()<CR>
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Remap semicolon to colon
map ; :
let g:syntastic_check_on_open=1
let g:syntastic_javascript_checkers = ['eslint', 'flow']
let g:syntastic_javascript_flow_exe = 'flow check-contents'
map <Leader>s :SyntasticToggleMode<CR>
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_coffee_checkers = []
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "⚠"
" Haskell
map <silent> tw :GhcModTypeInsert<CR>
map <silent> ts :GhcModSplitFunCase<CR>
map <silent> tq :GhcModType<CR>
map <silent> te :GhcModTypeClear<CR>
let g:haskell_tabular = 1
vmap a= :Tabularize /=<CR>
vmap a; :Tabularize /::<CR>
vmap a- :Tabularize /-><CR>
" Elm
autocmd FileType Elm nnoremap <leader>el :ElmEvalLine<CR>
autocmd FileType Elm vnoremap <leader>es :<C-u>ElmEvalSelection<CR>
autocmd FileType Elm nnoremap <leader>em :ElmMakeCurrentFile<CR>
:au BufWritePost *.elm ElmMakeFile("Main.elm")
" autocmd bufwritepost *.js silent !standard % --format
set autoread
autocmd BufReadPre *.js let b:javascript_lib_use_ramda = 1
autocmd BufReadPre *.js let b:javascript_lib_use_react = 1
" vim-jsx
let g:jsx_ext_required = 0
" Local config
if filereadable($HOME . "/.vimrc.local")
source ~/.vimrc.local
endif
" Enable mouse #yolo
set mouse=a
" Enable ruler
set colorcolumn=80
set viminfo='100,n$HOME/.vim/files/info/viminfo
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
"This unsets the "last search pattern" register by hitting return
nnoremap <CR> :noh<CR><CR>
" " NeoComplete
" " Disable AutoComplPop.
" let g:acp_enableAtStartup = 0
" " Use neocomplete.
" let g:neocomplete#enable_at_startup = 1
" " Use smartcase.
" let g:neocomplete#enable_smart_case = 1
" " Set minimum syntax keyword length.
" let g:neocomplete#sources#syntax#min_keyword_length = 3
" let g:neocomplete#min_keyword_length = 3
" Clojure
let g:clojure_align_subforms = 1
let g:clojure_align_multiline_strings = 1
let g:clojure_fuzzy_indent = 1
let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let', '^run*', 'fresh']
let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
" StatusLine
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_section_y = ''
" Surround a word with taim()
nmap <buffer> <Leader>ta ysiwftaim<CR>f(
" Surround a visual selection with taim()
vmap <buffer> <Leader>ta Sftaim<CR>f(
" Use without requiring separately
nmap <buffer> <Leader>tA ysiwfrequire('taim')<CR>f(
vmap <buffer> <Leader>tA Sfrequire('taim')<CR>f(
" Surround a word with treis()
nmap <buffer> <Leader>tr ysiwftreis<CR>f(
" Surround a visual selection with treis()
vmap <buffer> <Leader>tr Sftreis<CR>f(
nmap <buffer> <Leader>tR ysiwfrequire('treis')<CR>f(
vmap <buffer> <Leader>tR Sfrequire('treis')<CR>f(
" Let's get Ag working
let g:ackprg = "ag --vimgrep"