Skip to content

Instantly share code, notes, and snippets.

@pwnall
Created March 31, 2016 01:10
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 pwnall/64c6e73679fad02656ed2e37909fd8f9 to your computer and use it in GitHub Desktop.
Save pwnall/64c6e73679fad02656ed2e37909fd8f9 to your computer and use it in GitHub Desktop.
My .vimrc
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
colorscheme default
" Add plugins installed in bundle/ to the runtime path.
call pathogen#infect()
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set expandtab
" Avoid encoding surprises.
if has("multi_byte")
set encoding=utf-8
setglobal fileencoding=utf-8
setglobal nobomb
end
syntax on " Syntax highlighting.
if has("gui_running")
let g:solarized_contrast="high" " The default value is normal.
let g:solarized_bold=1
let g:solarized_italic=1
let g:solarized_underline=1
set background=light
colorscheme solarized
endif
set ruler
set hlsearch " Highlight search matches.
set incsearch " Focus on the first match as I type a search command.
set ignorecase " Case-insensitive search.
set smartcase " But do a case-sensitive search if I type uppercase.
set showcmd
set showmatch
set modeline
set number " Line numbers.
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start
" Saner behavior for tabs.
set switchbuf=usetab,newtab
" Save per-buffer state across vim restarts.
set history=1000
set viminfo='10000,<10000,s10000,%10000,:1000,/1000
" Use the system clipboard.
if has("xterm_clipboard")
set clipboard=unnamedplus
endif
" In many terminal emulators the mouse works just fine, thus enable it.
if has("mouse")
set mouse=a
endif
" Visual warning for lines that exceed 79 characters.
if exists("+colorcolumn")
set colorcolumn=80
highlight ColorColumn ctermbg=lightgrey guibg=darkgrey
end
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
set autoindent
set copyindent " Copy the previous line indentation when auto-indenting.
if has("autocmd")
filetype plugin indent on
endif
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
endif
" Trim blank spaces at the end of a line.
if has("autocmd")
autocmd BufWritePre * :%s/\s\+$//e
endif
" Execute per-project .vimrc files, but limit the commands allowed in them.
set exrc
set secure
" TagsList: show up on the right, one-click navigation, 40-characters wide
let Tlist_Auto_Open = 1
let Tlist_Auto_Update = 1
let Tlist_Compact_Format = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Sort_Type = "name"
let Tlist_Use_Right_Window = 1
let Tlist_Use_SingleClick = 1
let Tlist_WinWidth = 40
" Ctrl+P ignores packages and build stuffs.
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = '\v[\/](node_modules|bower_components|target|dist)|(\.(swp|ico|git|svn))$'
" Workaround for the fact that I type too fast for my keyboard :)
command W w
command WQ wq
command Wq wq
command Q q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment