Last active
October 3, 2023 20:06
-
-
Save atsmith813/51fa357201f719d1593daa0b285b08e5 to your computer and use it in GitHub Desktop.
My VIM setup
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
syntax on | |
" Add jbuilder syntax highlighting | |
au BufNewFile,BufRead *.json.jbuilder set ft=ruby | |
" Add spell check to md files | |
autocmd BufRead,BufNewFile *.md setlocal spell | |
" Set 'Ctrl+n' to NERDTree toggle | |
map <C-n> :NERDTreeToggle<CR> | |
" Toggle indent lines | |
map <Leader>ig :IndentLinesToggle<CR> | |
" test.vim shortcuts | |
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> | |
" Add empty line below | |
nmap oo o<Esc>k | |
set cc=80 | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
set number | |
set statusline+=%F | |
set backspace=indent,eol,start | |
" Download vim-plug if not found. | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
" Plugins will be downloaded under the specified directory. | |
call plug#begin('~/.vim/plugged') | |
" Declare the list of plugins. | |
Plug 'scrooloose/nerdtree' | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'vim-airline/vim-airline' | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'tpope/vim-fugitive' | |
Plug 'pangloss/vim-javascript' | |
Plug 'elzr/vim-json' | |
Plug 'mxw/vim-jsx' | |
Plug 'tpope/vim-rails' | |
Plug 'tpope/vim-endwise' | |
Plug 'scrooloose/syntastic' | |
Plug 'bronson/vim-trailing-whitespace' | |
Plug 'nathanaelkane/vim-indent-guides' | |
Plug 'rking/ag.vim' | |
Plug 'vim-syntastic/syntastic' | |
Plug 'yggdroot/indentline' | |
Plug 'kchmck/vim-coffee-script' | |
Plug 'elixir-lang/vim-elixir' | |
Plug 'godlygeek/tabular' | |
Plug 'valloric/youcompleteme' | |
Plug 'smerrill/vcl-vim-plugin' | |
Plug 'janko-m/vim-test' | |
Plug 'joker1007/vim-ruby-heredoc-syntax' | |
" List ends here. Plugins become visible to Vim after this call. | |
call plug#end() | |
filetype plugin on | |
let NERDTreeMinimalUI = 1 | |
let NERDTreeDirArrows = 1 | |
let g:ctrlp_max_files = 0 | |
let g:ctrlp_max_depth = 40 | |
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git' | |
let g:indentLine_enabled = 0 | |
let g:indentLine_char = '│' | |
let g:indentLine_color_term = 103 | |
set background=dark | |
" Add syntax rule | |
let g:ruby_heredoc_syntax_filetypes = { | |
\ "javascript" : { | |
\ "start" : "JAVASCRIPT", | |
\}, | |
\ "html" : { | |
\ "start" : "HTML", | |
\}, | |
\} | |
" 'start' is heredoc start literal. | |
" Use Silver Searcher for CtrlP | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment