Created
January 14, 2017 19:56
-
-
Save keevie/7e25728272b26211cb47a9f89ee267d5 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
"" For the plugins, first run the command below: | |
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
" Then open vim and type: | |
set clipboard=unnamedplus | |
set t_Co=256 | |
set updatetime=1000 | |
set linebreak | |
set encoding=utf-8 | |
set rtp+=$HOME/.vim/bundle/Vundle.vim | |
set incsearch | |
set scrolloff=5 | |
"auto resize splits | |
:autocmd VimResized * wincmd = | |
"Install Vundle if it is not already installed | |
if !isdirectory(expand("~/.vim/bundle/Vundle.vim")) | |
silent !git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
endif | |
call vundle#begin() | |
Bundle 'chriskempson/tomorrow-theme', {'rtp': 'vim/'} | |
Plugin 'bling/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'bling/vim-bufferline' | |
Plugin 'ervandew/supertab' | |
Plugin 'gerw/vim-latex-suite' | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'jpo/vim-railscasts-theme' | |
Plugin 'AndrewRadev/splitjoin.vim.git' | |
Plugin 'universal-ctags/ctags' | |
Plugin 'kien/rainbow_parentheses.vim' | |
Plugin 'nathanaelkane/vim-indent-guides' | |
Plugin 'thoughtbot/vim-rspec' | |
Plugin 'wincent/command-t' | |
Plugin 'airblade/vim-gitgutter' | |
"Plugin 'vim-syntastic/syntastic' | |
Plugin 'godlygeek/tabular' | |
Plugin 'plasticboy/vim-markdown' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-surround' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'tpope/vim-commentary' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'tpope/vim-obsession' | |
Plugin 'tpope/vim-eunuch' | |
Plugin 'vim-scripts/Vim-R-plugin' | |
Plugin 'xuhdev/vim-latex-live-preview' | |
Plugin 'beloglazov/vim-online-thesaurus' | |
Plugin 'tpope/vim-endwise' | |
Plugin 'tpope/vim-rails' | |
Plugin 'scrooloose/nerdtree' | |
" Plugin 'sheerun/vim-polyglot' | |
"Plugin 'easymotion/vim-easymotion' | |
Plugin 'justinmk/vim-sneak' | |
Plugin 'matze/vim-move' | |
Plugin 'krisajenkins/vim-pipe' | |
" Plugin 'aliou/sql-heredoc.vim' | |
" Plugin 'krisajenkins/vim-postgresql-syntax' | |
call vundle#end() | |
syntax enable | |
set background=dark | |
colorscheme Tomorrow-Night-Eighties | |
filetype plugin on | |
let mapleader = "\<Space>" | |
" Airline customization: | |
let g:airline_theme = 'bubblegum' | |
let g:airline_powerline_fonts = 1 | |
let g:airline#extensions#whitespace#checks = [] | |
let g:airline_section_c = '%f' | |
let g:airline_section_y = '%{bufnr("%")}' | |
let g:airline_section_z = '%l/%L' | |
"Start nerdtree | |
nnoremap <leader>o :NERDTreeToggle<CR> | |
"Splitjoin mappings | |
nmap sj :SplitjoinSplit<CR> | |
nmap sk :SplitjoinJoin<CR> | |
"vim-move | |
let g:move_key_modifier = 'C' | |
"command t | |
nnoremap <Leader>b :CommandT<CR> | |
let g:CommandTCancelMap = ['<ESC>', '<C-c>'] | |
"Sneak mappings | |
let g:sneak#s_next = 1 | |
nmap f <Plug>Sneak_s | |
nmap F <Plug>Sneak_S | |
xmap f <Plug>Sneak_s | |
xmap F <Plug>Sneak_S | |
omap f <Plug>Sneak_s | |
omap F <Plug>Sneak_S | |
"wasn't using easymotion, maybe it sucks? | |
"Anyway, keeping this in case I change my mind | |
"easymotion mappings | |
" " <Leader>f{char} to move to {char} | |
" map <Leader>f <Plug>(easymotion-bd-f) | |
" nmap <Leader>f <Plug>(easymotion-overwin-f) | |
" " s{char}{char} to move to {char}{char} | |
" nmap s <Plug>(easymotion-overwin-f2) | |
" " Move to line | |
" map <Leader>l <Plug>(easymotion-bd-jk) | |
" nmap <Leader>l <Plug>(easymotion-overwin-line) | |
" " Move to word | |
" map <Leader>w <Plug>(easymotion-bd-w) | |
" nmap <Leader>w <Plug>(easymotion-overwin-w) | |
"Space tab to switch buffers | |
nmap <Leader><Tab> :bn<CR> | |
filetype indent on | |
" Backup files in different directory | |
set backupdir=~/.vim/tmp-files,. | |
set directory=~/.vim/tmp-files,. | |
set laststatus=2 | |
set modeline | |
set mouse=a | |
set ttymouse=xterm2 | |
set wildmode=longest,list,full | |
set wildmenu | |
" Line numbering | |
set invnumber | |
set relativenumber | |
set numberwidth=3 | |
" Prevent the tar plugin from loading: | |
let g:loaded_tarPlugin = 1 | |
let g:leaded_tar = 1 | |
" No more reaching for Esc | |
inoremap jk <Esc> | |
" Make control p faster for git maybe? | |
let g:ctrlp_use_caching = 0 | |
if executable('ag') | |
set grepprg=ag\ --nogroup\ --nocolor | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
else | |
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] | |
let g:ctrlp_prompt_mappings = { | |
\ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'], | |
\ } | |
endif | |
" New line without entering insert mode | |
nmap <CR> o<Esc> | |
hi normal ctermbg=none | |
noremap ; : | |
nnoremap J <C-w>l | |
nnoremap K <C-w>h | |
" Tabs and hidden characters | |
set expandtab | |
set list | |
set listchars=tab:▸-,trail:~ | |
hi SpecialKey ctermfg=66 guifg=#649A9A | |
" Vim indent guides | |
let g:indent_guides_auto_colors = 1 | |
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=45 | |
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=100 | |
" Get rid of Ex mode, enter into it too often by accident. | |
nnoremap Q <Nop> | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" RAINBOW PARENTHESES | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
au VimEnter * RainbowParenthesesToggle | |
au Syntax * RainbowParenthesesLoadRound | |
au Syntax * RainbowParenthesesLoadSquare | |
au Syntax * RainbowParenthesesLoadBraces | |
let g:rbpt_colorpairs = [ | |
\ ['brown', 'RoyalBlue3'], | |
\ ['Darkblue', 'SeaGreen3'], | |
\ ['darkgray', 'DarkOrchid3'], | |
\ ['darkgreen', 'firebrick3'], | |
\ ['darkcyan', 'RoyalBlue3'], | |
\ ['darkred', 'SeaGreen3'], | |
\ ['darkmagenta', 'DarkOrchid3'], | |
\ ['brown', 'firebrick3'], | |
\ ['gray', 'RoyalBlue3'], | |
\ ['cyan', 'SeaGreen3'], | |
\ ['darkmagenta', 'DarkOrchid3'], | |
\ ['Darkblue', 'firebrick3'], | |
\ ['darkgreen', 'RoyalBlue3'], | |
\ ['darkcyan', 'SeaGreen3'], | |
\ ['darkred', 'DarkOrchid3'], | |
\ ['red', 'firebrick3'], | |
\ ] | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" VIM LATEX | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
filetype plugin on | |
set shellslash | |
set grepprg=grep\ -nH\ $* | |
let g:tex_flavor='latex' | |
" preview latex with latex live preview | |
let g:livepreview_previewer='evince' | |
" Compile PDF with latexmk: | |
let g:Tex_DefaultTargetFormat = 'pdf' | |
let g:Tex_CompileRule_pdf = 'latexmk -pdflatex="pdflatex -shell-escape % %S" -pdf $*' | |
" Compile with F2 (works in both normal and insert mode) | |
au BufEnter *.tex imap <F2> <Esc>:w<cr><leader>ll | |
au BufEnter *.tex map <F2> :w<cr><leader>ll | |
au BufEnter *.tex imap <F1> <Esc> | |
au BufEnter *.tex map <F1> <Esc> | |
" Navigate up through wrapped lines | |
au BufEnter *.tex nmap j gj | |
au BufEnter *.tex nmap k gk | |
au BufEnter *.tex set shiftwidth=2 | |
"au BufEnter *.tex set tw=79 | |
"au BufEnter *.tex set formatoptions+=t | |
au BufEnter *.tex setlocal spell spelllang=en_us | |
"au BufEnter *.tex set wrap linebreak nolist | |
"au BufEnter *.tex highlight OverLength ctermbg=DarkMagenta ctermfg=white guibg=#592929 | |
"au BufEnter *.tex match OverLength /\%81v./ "/\%81v.\+/ | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" PYTHON-SPECIFIC SETTINGS | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Highlight text on line that exceeds 80 characters for various filetypes: | |
au BufEnter *.py highlight OverLength ctermbg=DarkMagenta ctermfg=white guibg=#592929 | |
au BufEnter *.py match OverLength /\%81v./ "/\%81v.\+/ | |
au BufEnter *.py set cul " underline line where cursor is | |
au BufEnter *.py set shiftwidth=4 | |
au BufEnter *.py map ,c :s/^/#/<CR>:noh<CR> | |
au BufEnter *.py let g:airline#extensions#tabline#enabled = 1 | |
" run python programs with F5 | |
"noremap <silent> <F5> :!clear;python2 %<CR> | |
au BufEnter *.py map <silent> <F5> :!clear;python2 %<CR> | |
""""Ruby settings | |
autocmd Filetype ruby setlocal ts=2 sts=2 sw=2 | |
au BufEnter *.rb map <silent> <F5> :!clear;ruby %<CR> | |
"au Bufenter *.rb vnoremap <F4> :w !ruby<CR> | |
au BufEnter *.rb highlight OverLength ctermbg=DarkMagenta ctermfg=white guibg=#592929 | |
au BufEnter *.rb match OverLength /\%81v./ "/\%72.\+/ | |
au BufEnter *.rb map <Leader>s :call RunNearestSpec()<CR> | |
au BufEnter *.rb map <Leader>t :call RunCurrentSpecFile()<CR> | |
au BufEnter *.rb map <Leader>A :call RunAllSpecs()<CR> | |
" au BufEnter *.rb noremap :w<CR> :w<CR>:SyntasticCheck rubocop<CR> | |
"au BufEnter *.rb set cul " underline line where cursor is | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" MARKDOWN-SPECIFIC SETTINGS | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:vim_markdown_folding_disabled=1 | |
let g:vim_markdown_math=1 | |
" Convert to html with F2 (works in both normal and insert mode) | |
au BufEnter *.md set ft=markdown | |
au BufEnter *.md map <F2> <Esc>:w<cr>:! markdown % > %:r.html<cr><cr> | |
au BufEnter *.md imap <F2> <Esc>:w<cr>:! markdown % > %:r.html<cr><cr> | |
au BufEnter *.md map <F9> <Esc>:w<cr>:! pandoc -S % -o %:r.pdf<cr><cr> | |
au BufEnter *.md imap <F9> <Esc>:w<cr>:! pandoc -S % -o %:r.pdf<cr><cr> | |
au BufEnter *.md map <F10> <Esc>:w<cr>:! markdown-pdf % -o %:r.pdf<cr><cr> | |
au BufEnter *.md imap <F10> <Esc>:w<cr>:! markdown-pdf % -o %:r.pdf<cr><cr> | |
" For wrapped lines: | |
au BufEnter *.md set wrap linebreak nolist | |
au BufEnter *.md nmap j gj | |
au BufEnter *.md nmap k gk | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" SQL Settings | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" """ Syntastic""" | |
let g:syntastic_mode_map = { 'mode': 'active', | |
\ 'active_filetypes': [], | |
\ 'passive_filetypes': ['html'] } | |
let g:syntastic_ruby = ['rubocop'] | |
""Tabularize""" | |
nnoremap <Leader>a= :Tabularize /=<CR> | |
vnoremap <Leader>a= :Tabularize /=<CR> | |
nnoremap <Leader>a: :Tabularize /:\zs<CR> | |
vnoremap <Leader>a: :Tabularize /:\zs<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment