Skip to content

Instantly share code, notes, and snippets.

@bomatson
Created December 20, 2016 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bomatson/8934bdb193358723ab2acaf3d9042ce7 to your computer and use it in GitHub Desktop.
Save bomatson/8934bdb193358723ab2acaf3d9042ce7 to your computer and use it in GitHub Desktop.
set nocompatible " Must come first because it changes other options.
silent! call pathogen#runtime_append_all_bundles()
syntax enable " Turn on syntax highlighting.
filetype plugin indent on " Turn on file type detection.
runtime macros/matchit.vim " Load the matchit plugin.
set showcmd " Display incomplete commands.
set showmode " Display the mode you're in.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
set wildmenu " Enhanced command line completion.
set wildmode=list:longest " Complete files like a shell.
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
set number " Show line numbers.
set ruler " Show cursor position.
set cursorline " Show the cursorline
set nowrap " No wrap, mofo!
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
set scrolloff=3 " Show 3 lines of context around the cursor.
set title " Set the terminal's title
set visualbell " No beeping.
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set directory=$HOME/.vim/tmp//,. " Keep swap files in one location
set noswapfile
" UNCOMMENT TO USE
set tabstop=2 " Global tab width.
set shiftwidth=2 " And again, related.
set expandtab " Use spaces instead of tabs
set laststatus=2 " Show the status line all the time
" Useful status information at bottom of screen
set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\ %{fugitive#statusline()}%{exists('*CapsLockStatusline')?CapsLockStatusline():''}%=%-16(\ %l,%c-%v\ %)%P
" Use vividchalk
colorscheme vividchalk
" Tab mappings.
map <leader>tt :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>to :tabonly<cr>
map <leader>tn :tabnext<cr>
map <leader>tp :tabprevious<cr>
map <leader>tf :tabfirst<cr>
map <leader>tl :tablast<cr>
map <leader>tm :tabmove
"run this spec"
"map <leader>R :w\|:! rspec %<cr>
"map :E :e <C-R>=expand("%:p:h") . "/" <CR>
" Automatic fold settings for specific files.
set nofoldenable
autocmd FileType ruby setlocal foldmethod=syntax
autocmd FileType css setlocal foldmethod=indent shiftwidth=2 tabstop=2
" For the MakeGreen plugin and Ruby RSpec. Uncomment to use.
" autocmd BufNewFile,BufRead *_spec.rb compiler rspec
" create whitespace group
autocmd BufWinEnter * match ExtraWhitespace /\\\\s\\\\+$/
autocmd InsertEnter * match ExtraWhitespace /\\\\s\\\\+\\\\%#\\\\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\\\\s\\\\+$/
autocmd BufWinLeave * call clearmatches()
" Command to delete whitespace
:command! Rmsp %s/\s\+$//
nnoremap <leader>rm :Rmsp<cr>
" Highlight extra whitespace as red
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
" Toggle NERDTree
map <leader>n :NERDTree<CR>
" Use Ctrl-P for file searching
set runtimepath^=~/.vim/bundle/ctrlp.vim
" ignore the tmp dir for Ctrl-P
if exists("g:ctrl_user_command")
unlet g:ctrlp_user_command
endif
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/vendor/*,*/\.git/*
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.yardoc\|public$|log\|tmp$',
\ 'file': '\.so$\|\.dat$|\.DS_Store$'
\ }
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 ""'
endif
" jshint
let jshint2_read = 1
nnoremap <leader>j :JSHint<CR>
" arduino syntax highlighting
au BufRead,BufNewFile *.pde set filetype=arduino
au BufRead,BufNewFile *.ino set filetype=arduino
"let g:vim_arduino_auto_open_serial = 1
"VIMUX
let g:VimuxOrientation = 'h'
" function! VimuxRunJasmineSpec()
" let specname = matchstr(getline(1), "['\\"].*['\\"]")
" call VimuxRunCommand("clear; RAILS_ENV=test bundle exec rake spec:javascript SPEC=".specname."\\n")
" endfunction
" Run the current file with jasmine
map <Leader>ss :call VimuxRunCommand("clear; cc " . bufname("%") . " && ./a.out" )<CR>
" Run the current file with rspec
map <Leader>sr :call VimuxRunCommand("clear; rspec " . bufname("%"))<CR>
" Run last command executed by VimuxRunCommand
map <Leader>se :VimuxRunLastCommand<CR>
" Close vim tmux runner opened by VimuxRunCommand
map <Leader>sc :VimuxCloseRunner<CR>
" Interrupt any command running in the runner pane
map <Leader>sf :VimuxInterruptRunner<CR>
" Open Dash.app
map <Leader>da :Dash<CR>
let g:dash_activate = 0
" syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint']
" Use ag
" let g:ackprg = 'ag --vimgrep'
" show hidden files
let NERDTreeShowHidden=1
" Human-readable JSON
com! FormatJSON %!python -m json.tool
" Map bc to run CSScomb. bc stands for beautify css
autocmd FileType css noremap <buffer> <leader>bc :CSScomb<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment