Skip to content

Instantly share code, notes, and snippets.

@nvolungis
Created April 27, 2016 19:07
Show Gist options
  • Save nvolungis/ca012ce1671f081a0f73aae0ecffcc8b to your computer and use it in GitHub Desktop.
Save nvolungis/ca012ce1671f081a0f73aae0ecffcc8b to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')
"
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" bundles
Plugin 'christoomey/vim-tmux-navigator'
" nelstrom's plugin depends on kana's
Plugin 'kana/vim-textobj-user'
Plugin 'nelstrom/vim-textobj-rubyblock'
Plugin 'altercation/vim-colors-solarized'
Plugin 'kchmck/vim-coffee-script'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-bundler'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-commentary'
Plugin 'pangloss/vim-javascript'
Plugin 'thoughtbot/vim-rspec'
Plugin 'guns/vim-clojure-static'
Plugin 'tpope/vim-fireplace.git'
Plugin 'scrooloose/nerdtree'
Plugin 'lambdatoast/elm.vim'
Plugin 'mileszs/ack.vim'
Plugin 'mxw/vim-jsx'
Plugin 'godlygeek/tabular'
call vundle#end()
syntax on
syntax enable
filetype plugin indent on
set background=dark
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized
set modeline
set nobackup
set nocompatible
set nowb
set noswapfile
set relativenumber
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set smartindent
set laststatus=2
set guifont=Monoaco:h14
set hlsearch
let mapleader = ","
let g:mpleader = ","
" nerdtree window width
let g:NERDTreeWinSize = 60
" smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
map <C-j> <C-W>J
map <C-k> <C-W>K
map <C-h> <C-W>H
map <C-l> <C-W>L
map <silent> <leader><cr> :noh<cr>
" rspec-vim maps
map <Leader>c :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" switch between tabs
nmap <leader>tl :tabn<cr>
nmap <leader>th :tabp<cr>
" easy saves
nmap <leader>w :w!<cr>
" fix some typos
map :W :w
map :Q :q
" Setup ctrlP
let g:ctrlp_map = '<Leader>f'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_custom_ignore = {
\ 'dir': 'node_modules',
\ }
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
" colorcheming
"
" clipboard
:set clipboard=unnamed
" vnoremap <C-c> "*y
let g:fuzzy_ignore = "*.png;*.PNG;*.JPG;*.jpg;*.GIF;*.gif;vendor/**;coverage/**;tmp/**;rdoc/**"
""""""""""""""""""""""""""""""
" => Number Toggle
""""""""""""""""""""""""""""""
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
" From https://github.com/bronson/vim-trailing-whitespace/blob/master/plugin/trailing-whitespace.vim
highlight ExtraWhitespace ctermbg=darkred guibg=#382424
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
function! s:FixWhitespace(line1,line2)
let l:save_cursor = getpos(".")
silent! execute ':' . a:line1 . ',' . a:line2 . 's/\s\+$//'
call setpos('.', l:save_cursor)
endfunction
" Run :FixWhitespace to remove end of line white space
command! -range=% FixWhitespace call <SID>FixWhitespace(<line1>,<line2>)
noremap <C-n> :call NumberToggle()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment