-
-
Save arthurchui/a6900f759b6519ac44c99c097fc9ab0d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| " Great presentation on vim | |
| " http://slidedeck.io/inside/vim-presentation | |
| autocmd filetype crontab setlocal nobackup nowritebackup | |
| set nocompatible | |
| filetype off | |
| " Python3 | |
| let g:python3_host_prog = '/usr/local/bin/python3' | |
| " PLUG BEGIN | |
| call plug#begin('~/.vim/plugged') | |
| " Navigation | |
| Plug 'scrooloose/nerdtree' | |
| Plug 'rking/ag.vim' | |
| Plug 'ctrlpvim/ctrlp.vim' | |
| Plug 'bogado/file-line' | |
| set noshowmode | |
| " Git | |
| Plug 'tpope/vim-fugitive' | |
| Plug 'airblade/vim-gitgutter' | |
| Plug 'tpope/vim-git' | |
| Plug 'tpope/vim-rhubarb' | |
| " Rails | |
| Plug 'tpope/vim-bundler' | |
| Plug 'tpope/vim-rails' | |
| " Testing | |
| Plug 'janko-m/vim-test' | |
| " Syntax | |
| Plug 'guns/vim-sexp' | |
| Plug 'tpope/vim-sexp-mappings-for-regular-people' | |
| Plug 'sheerun/vim-polyglot' | |
| " Editing | |
| Plug 'terryma/vim-multiple-cursors' | |
| Plug 'scrooloose/nerdcommenter' | |
| " Formatting | |
| Plug 'tpope/vim-surround' | |
| " Autocomplete | |
| if has('nvim') | |
| Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
| else | |
| Plug 'Shougo/deoplete.nvim' | |
| Plug 'roxma/nvim-yarp' | |
| Plug 'roxma/vim-hug-neovim-rpc' | |
| endif | |
| let g:deoplete#enable_at_startup = 1 | |
| " Snippets | |
| Plug 'MarcWeber/vim-addon-mw-utils' | |
| Plug 'tomtom/tlib_vim' | |
| Plug 'garbas/vim-snipmate' | |
| Plug 'honza/vim-snippets' | |
| let g:snipMate = {} | |
| let g:snipMate.scope_aliases = {} | |
| let g:snipMate.scope_aliases['ruby'] = 'ruby,rails' | |
| " Shell | |
| Plug 'tpope/vim-eunuch' | |
| call plug#end() | |
| " PLUG END | |
| " Presentation | |
| filetype plugin indent on | |
| au BufRead,BufNewFile *.es6 setfiletype javascript | |
| au FileType markdown setlocal nospell | |
| " Leader character | |
| let mapleader = "," | |
| " Themes | |
| syntax enable | |
| " Appearance | |
| set laststatus=2 | |
| set encoding=utf-8 | |
| set number | |
| set nowrap | |
| " Whitespace | |
| set smarttab | |
| set expandtab | |
| set backspace=indent,eol,start | |
| set tabstop=2 | |
| set shiftwidth=2 | |
| set softtabstop=2 | |
| " Open new split panes to right and bottom, which feels more natural | |
| set splitbelow | |
| set splitright | |
| nnoremap vv :vsp<CR> | |
| " Focus pane | |
| nnoremap <C-j> <C-w>j | |
| nnoremap <C-k> <C-w>k | |
| nnoremap <C-h> <C-w>h | |
| nnoremap <C-l> <C-w>l | |
| " Resize pane | |
| nnoremap <C-S-Up> 5<C-w>- | |
| nnoremap <C-S-Down> 5<C-w>+ | |
| nnoremap <C-S-Left> 5<C-w>< | |
| nnoremap <C-S-Right> 5<C-w>> | |
| " File | |
| nnoremap Q :q<CR> | |
| nnoremap <leader>w :w<CR> | |
| set directory=~/.vim/backup// | |
| " Search | |
| :set incsearch | |
| :set hlsearch | |
| " Editing | |
| " Disable error beeping and flashing | |
| set visualbell | |
| set t_vb= | |
| nnoremap <S-Up> :move-1<CR> | |
| nnoremap <S-Down> :move+<CR> | |
| nnoremap // :noh<CR> | |
| " Spelling | |
| " toggle spelling | |
| nnoremap <leader>s :set invspell<CR> | |
| " ctrlp | |
| let g:ctrlp_max_files = 0 | |
| let g:ctrlp_clear_cache_on_exit = 1 | |
| let g:ctrlp_custom_ignore = 'node_modules\|\.git' | |
| let g:ctrlp_map = '<leader>,' | |
| let g:ctrlp_cmd = 'CtrlP' | |
| nmap <leader>. :CtrlP<cr> | |
| " open multiple files with <c-z> to mark and <c-o> to open. v - opening in | |
| " vertical splits; j - jump to first open buffer; r - open first in current buffer | |
| let g:ctrlp_open_multiple_files = 'hjr' | |
| " ag | |
| 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 -g ""' | |
| " ag is fast enough that CtrlP doesn't need to cache | |
| let g:ctrlp_use_caching = 0 | |
| endif | |
| " grep word under cursor | |
| nnoremap <leader>k :grep! "\b<C-R><C-W>\b"<CR>:cw<CR> | |
| nnoremap <leader>g :Ag<Space> | |
| " nerdtree with tqbs | |
| " Ctrl-P to Display the file browser tree | |
| nmap <C-P> :NERDTreeToggle<CR> | |
| " Show current file in the tree | |
| nmap <leader>p :NERDTreeFind<CR> | |
| " Tells the NERD tree to respect 'wildignore'. | |
| let NERDTreeRespectWildIgnore=1 | |
| " abbr | |
| abbr pry! require 'pry'; binding.pry | |
| " vim-test | |
| let test#strategy = "neovim" | |
| let g:test#preserve_screen = 1 | |
| nmap <silent> t<C-n> :TestNearest<CR> | |
| nmap <silent> t<C-f> :TestFile<CR> | |
| nmap <silent> t<C-s> :TestSuite<CR> | |
| nmap <silent> t<C-l> :TestLast<CR> | |
| nmap <silent> t<C-g> :TestVisit<CR> | |
| if has('nvim') | |
| tmap <C-o> <C-\><C-n> | |
| endif | |
| " window resizing | |
| nnoremap <A-Up> <C-w>-<C-w>- | |
| nnoremap <A-Down> <C-w>+<C-w>+ | |
| nnoremap <A-Left> <C-w><<C-w>< | |
| nnoremap <A-Right> <C-w>><C-w>> | |
| " nerdcommenter | |
| " Add spaces after comment delimiters by default | |
| let g:NERDSpaceDelims = 1 | |
| " Align line-wise comment delimiters flush left instead of following code indentation | |
| let g:NERDDefaultAlign = 'left' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment