Find file
Fetching contributors…
Cannot retrieve contributors at this time
257 lines (200 sloc) 6.61 KB
set shell=/bin/bash
runtime macros/matchit.vim
set ttyfast
set lazyredraw
" have jsx highlighting/indenting work in .js files as well
let g:jsx_ext_required = 0
" Sessions
let g:session_autoload = 'no'
" leader Mappings
let mapleader = ','
map <Leader>w :update<CR>
map <Leader>q :qall<CR>
map <Leader>gs :Gstatus<CR>
map <Leader>gc :Gcommit<CR>
map <Leader>gp :Gpush<CR>
" Toggle nerdtree with F10
map <F10> :NERDTreeToggle<CR>
" Current file in nerdtree
map <F9> :NERDTreeFind<CR>
" Reduce timeout after <ESC> is recvd. This is only a good idea on fast links.
set ttimeout
set ttimeoutlen=20
set notimeout
" Edit another file in the same directory as the current file
" uses expression to extract path from current file's path
" highlight vertical column of cursor
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline
set cursorline
"key to insert mode with paste using F2 key
map <F2> :set paste<CR>i
" Leave paste mode on exit
au InsertLeave * set nopaste
" Command aliases
cabbrev tp tabprev
cabbrev tn tabnext
cabbrev tf tabfirst
cabbrev tl tablast
set backspace=2 " Backspace deletes like most programs in insert mode
set nocompatible " Use Vim settings, rather then Vi settings
set nobackup
set nowritebackup
set noswapfile "
set history=500
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set hlsearch " highlight matches
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
" Fuzzy finder: ignore stuff that can't be opened, and generated files
let g:fuzzy_ignore = "*.png;*.PNG;*.JPG;*.jpg;*.GIF;*.gif;vendor/**;coverage/**;tmp/**;rdoc/**"
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
filetype plugin indent on
augroup vimrcEx
" For all text files set 'textwidth' to 80 characters.
autocmd FileType text setlocal textwidth=80
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile *.md set filetype=markdown
" Enable spellchecking for Markdown
autocmd FileType markdown setlocal spell
" Automatically wrap at 72 characters for Markdown
autocmd BufRead,BufNewFile *.md setlocal textwidth=72
augroup END
" bind K to search word under cursor
nnoremap K :Ag "\b<C-R><C-W>\b"<CR>:cw<CR>
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
let g:rspec_command = 'call Send_to_Tmux("bundle exec spring rspec {spec}\n")'
let g:mocha_js_command = 'call Send_to_Tmux("mocha --opts spec/javascripts/mocha.opts {spec}\n")'
let g:rspec_runner = "os_x_iterm"
" Display extra whitespace
set list listchars=tab:»·,trail:·
" Airline
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
let = "\ua0"
" let g:airline_theme='powerlineish'
let g:airline_theme = 'tomorrow'
set t_Co=256
:set smartcase
:set ignorecase
:set noantialias
" Color scheme
"colorscheme solarized
" colorscheme tomorrow-night
colorscheme tomorrow
set background=light
set encoding=utf-8
" Highlight line number of where cursor currently is
hi CursorLineNr guifg=#050505
" numbers
set number
set numberwidth=5
" snippets are activated by Shift+Tab
let g:snippetsEmu_key = "<S-Tab>"
" persistent undo
set undodir=~/.vim/undo/
set undofile
set undolevels=1000
set undoreload=10000
" tab completion
" will insert tab at beginning of line,
" will use completion if not at beginning
set wildmode=list:longest,list:full
set complete=.,w,t
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
return "\<c-p>"
inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
" exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
" switch between the last two files
nnoremap <leader><leader> <c-^>
" get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" configure syntastic syntax checking to check on open as well as save
let g:syntastic_ruby_checkers = ['mri']
let g:syntastic_enable_highlighting=0
" remove trailing whitespace on save for ruby files.
function! s:RemoveTrailingWhitespaces()
"Save last cursor position
let l = line(".")
let c = col(".")
call cursor(l,c)
au BufWritePre * :call <SID>RemoveTrailingWhitespaces()
" cycling through your buffers
:nnoremap <C-n> :bnext<CR>
" easy navigation between splits. Instead of ctrl-w + j. Just ctrl-j
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" more natural split opening
set splitbelow
set splitright
" automatically rebalance windows on vim resize
autocmd VimResized * :wincmd =
" zoom a vim pane, <C-w>= to re-balance
nnoremap <leader>- :wincmd _<cr>:wincmd \|<cr>
nnoremap <leader>= :wincmd =<cr>
" go to the beginning of the line
nmap 0 ^
" toggle highlighting until the next search
set hlsearch!
nnoremap <F3> :set hlsearch!<CR>
" make it obvious where 80 characters is
set textwidth=80
set colorcolumn=+1
" turn off splitting lines in vim (specially annoying in slim files)
set formatoptions-=tc
" synchronize Vim's default register and the clipboard register;
" allowing you to simply use `y` and `p`.
set clipboard^=unnamed
" configure running tests from vim-turbux
let g:no_turbux_mappings = 1
map <leader>t <Plug>SendTestToTmux
map <leader>s <Plug>SendFocusedTestToTmux
let g:turbux_command_rspec = 'bundle exec spring rspec'
" Command aliases for typoed commands (accidentally holding shift too long)
command! W w