Skip to content

Instantly share code, notes, and snippets.

@theothermattm
Last active August 29, 2015 13:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save theothermattm/8864384 to your computer and use it in GitHub Desktop.
My .vimrc file
" A lot of this comes from
" https://github.com/thoughtbot/dotfiles/blob/master/vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
"filetype off
filetype plugin indent on
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/snippets/*
" no annoying swp files
set nobackup
set nowritebackup
set noswapfile
set laststatus=2
set autowrite " automatically :write before running commands
" line numbers
set number
set ruler
" Display extra whitespace
set list listchars=tab:»·,trail:·,nbsp:·
" Make it obvious where 80 characters is
set textwidth=80
set colorcolumn=+1
" Enable spellchecking for Markdown
autocmd FileType markdown setlocal spell
" scan some directories for 'find' and 'gf'
set path+=./app/**,./test/**
" suffixes to put to the end of the list when completing file names for find
set suffixes=.md,.js
" use system clipboard
set clipboard=unnamed
" don't wrap lines
set nowrap
set autoindent
set smarttab
set shiftwidth=4
set expandtab
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
set wildignore+=*/node_modules/**
set wildignore+=*/.idea/**
set wildignore+=*DS_Store*
set wildignore+=*/build/**
set wildignore+=*/coverage/**
set wildignore+=*/logs/**
set wildignore+=*/bin/**
" if you forget what all the map commands are:
" http://stackoverflow.com/questions/3776117/what-is-the-difference-between-the-remap-noremap-nnoremap-and-vnoremap-mapping
" remap splits, idea from thoughtbot
" you can add <C-W>_ to the end of each of these to maximize/minimize splits
" automatically
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-L> <C-W>l
nnoremap <C-H> <C-W>h
nnoremap <C-I> <C-W>_
" would be great to have another mapping for <C-W>= to equalize splits, but what?
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" enter newlines in edit mode
nmap <S-Enter> O<Esc>
nmap <CR> o<Esc>
" make getting out of insert mode quicker
imap jk <Esc>
" pressing 0 is faster than ^ and I like the behavior of ^ better to go to
" first word
map 0 ^
" map to 'real' middle of line: http://superuser.com/a/216476/297816
map gm :call cursor(0, len(getline('.'))/2)<CR>
" automatically start NERDTree and put it into the main window
"autocmd VimEnter * NERDTree
"autocmd VimEnter * wincmd p
" make markdown *.md files have appropriate syntax highligting
autocmd BufRead,BufNew *.md set filetype=markdown
" I like to move splits with my mouse, sue me...
set mouse=a
" help resizing splits with mouse in tmux
" see http://superuser.com/questions/549930/cant-resize-vim-splits-inside-tmux
set mouse+=a
if &term =~ '^screen'
" tmux knows the extended mouse mode
set ttymouse=xterm2
endif
" tab navigation like firefox
" http://vim.wikia.com/wiki/Alternative_tab_navigation
nnoremap <C-S-T> :tabprevious<CR>
nnoremap <C-T> :tabnext<CR>
inoremap <C-S-T> <Esc>:tabprevious<CR>i
inoremap <C-T> <Esc>:tabnext<CR>i
" #### BEGIN PLUGIN CONFIGURATION
" TODO separate file somehow?
" install vundle: https://github.com/gmarik/vundle
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Equipping VIM for javascript, YCM and tern: http://oli.me.uk/2013/06/29/equipping-vim-for-javascript/
Plugin 'Valloric/YouCompleteMe'
" you will need to run npm install in the bundle directory for tern for vim
Plugin 'marijnh/tern_for_vim'
colorscheme github
" syntax highlighting
syntax on
Plugin 'jelera/vim-javascript-syntax'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdtree'
" assumes NERDTree is installed: https://github.com/scrooloose/nerdtree
map <C-n> :NERDTreeToggle<CR>
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'tpope/vim-fugitive'
Plugin 'Raimondi/delimitMate'
Plugin 'kien/ctrlp.vim'
" make ctrlp's default command MRU files
let g:ctrlp_cmd = 'CtrlPMRUFiles'
map <C-p>o :CtrlP<CR>
Plugin 'mtth/scratch.vim'
Plugin 'gcmt/taboo.vim'
" TODO find a better shortcut for this
"map <C-t> :TabooRename
"seems to be causing perf issues in macvim?
"Plugin 'airblade/vim-gitgutter'
"Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'henrik/vim-open-url'
Plugin 'mileszs/ack.vim'
" set silver searcher as default search instead of ack
let g:ackprg = 'ag --nogroup --nocolor --column'
call vundle#end()
""" ### END PLUGIN CONFIGURATION
@theothermattm
Copy link
Author

A work in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment