Skip to content

Instantly share code, notes, and snippets.

@loganking
Created August 13, 2015 21:08
Show Gist options
  • Save loganking/9fa23bdcd11e332d3777 to your computer and use it in GitHub Desktop.
Save loganking/9fa23bdcd11e332d3777 to your computer and use it in GitHub Desktop.
My current .vimrc
" First load Pathogen
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
""
"" Basic Setup
""
set nocompatible " Use vim, no vi defaults
set number " Show line numbers
set ruler " Show line and column number
set showcmd " Show incomplete move command while it's typed
syntax enable " Turn on syntax highlighting allowing local overrides
set encoding=utf-8 " Set default encoding to UTF-8
set mouse=a
set foldmethod=syntax " Set folds to be determined by syntax settings
set foldcolumn=3 " Set folds to be displayed in a side column
let php_folding=1 " Enable folds for php syntax
autocmd BufRead * normal zR
set splitbelow " Horizontal splits open below
set splitright " Vertical splits open to the right
""
"" Whitespace
""
set autoindent " automatic indent new lines
set smartindent " be smart about it
set nowrap " don't wrap lines
set tabstop=2 " a tab is four spaces
set softtabstop=2
set shiftwidth=2 " an autoindent (with <<) is four spaces
set expandtab " use spaces for tabs
set list " Show invisible characters
set backspace=indent,eol,start " backspace through everything in insert mode
if exists("g:enable_mvim_shift_arrow")
let macvim_hig_shift_movement = 1 " mvim shift-arrow-keys
endif
" List chars
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " "
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the first column when wrap is off and the line continues beyond the left of the screen
""
"" Searching
""
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
"" set autcomplete to search in current buffer, buffers in other windows, loaded and unloaded buffers in buffers list, and tag completion list
"" notably, this removes the default inclusion of searching in included files to significantly speed up autocomplete
set complete=.,w,b,u,t
""
"" Wild settings
""
" TODO: Investigate the precise meaning of these settings
" set wildmode=list:longest,list:full
" Disable output and VCS files
set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem
" Disable archive files
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
" Ignore bundler and sass cache
set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*
" Disable temp and backup files
set wildignore+=*.swp,*~,._*
""
"" Backup and swap files
""
set backupdir=~/dotfiles/.vim/_backup// " where to put backup files.
set directory=~/dotfiles/.vim/_temp// " where to put swap files.
" Set up visual options
set guifont=DejaVu\ Sans\ Mono:h12
syntax enable
set background=dark
colorscheme solarized
if &term == 'xterm-256color' " this is actually iTerm as compared to gVim or MacVim
" change iTerm's profile so that Vim has nicer colors
execute ':silent !echo -e "\033]50;SetProfile=Vim\a"' | execute ':redraw!'
" change iTerm's profile back to default when exiting
au VimLeave * execute 'silent !echo -e "\033]50;SetProfile=Default\a"'
endif
" Set up NERDTree
let g:NERDTreeShowHidden=1 " sets NERDTree to show hidden files
let g:NERDTreeChDirMode=2 " sets NERDTree to change the working directory when the tree root is changed
let g:NERDTreeBookmarksFile=$HOME."/dotfiles/.vim/.NERDTreeBookmarks" " sets NERDTree to store bookmarks in ~/dotfiles/.vim/
let g:NERDTreeMouseMode=2 " sets NERDTree to open directories with a single click and files with a double click
"autocmd vimenter * if !argc() | NERDTree ~/sites/ | endif " open NERDTree to ~/sites/ if no args are passed when opened
" Set up DirDiff
let g:DirDiffExcludes=".svn,tmp" " sets patterns of files to exclude when calculating the diffs
" Key Remaps
let mapleader = ","
let g:mapleader = ","
nmap <leader>[ :tabp<cr>
nmap <leader>] :tabn<cr>
nnoremap <leader>t :TagbarToggle<cr>
nnoremap <leader>n :NERDTreeToggle<cr>
nnoremap <leader>e :InlineEdit<cr>
xnoremap <leader>e :InlineEdit<cr>
inoremap <c-e> <esc>:InlineEdit<cr>a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment