Skip to content

Instantly share code, notes, and snippets.

@morganwilde
Created March 11, 2014 13:27
Show Gist options
  • Save morganwilde/9485572 to your computer and use it in GitHub Desktop.
Save morganwilde/9485572 to your computer and use it in GitHub Desktop.
vimrc
" Configuration file for vim
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup
" syntax highlighting
let g:solarized_termcolors=256
syntax enable
set background=dark
colorscheme solarized
" line numbers
set number
" tab settings
set expandtab
" size of a hard tabstop
set tabstop=4
" size of an "indent"
set shiftwidth=4
" keep indentation on a new line
set autoindent
set cindent
" add color marker after 80 symbols in width
set colorcolumn=80
set ruler
" display commands while you type them
set showcmd
" highlight search
set hls
" incremental search (while typing)
set incsearch
" Shift-Enter - insert a line before the current line
nmap <S-Enter> O<Esc>
nmap <CR> o<Esc>
" add .glsl highlighting
autocmd BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl set ft=glsl
" temporarily switch to manual mode when inserting text that starts a fold
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
" folding
set foldcolumn=4
set foldmethod=indent
set foldlevel=10
set ssop+=folds
" go indent fix
filetype off
filetype plugin indent off
set rtp+=$GOROOT/misc/vim
filetype plugin indent on
syntax on
" swap files
set swapfile
set dir=~/vimswps
set backup
set writebackup
set backupdir=~/vimswps
" buffers
" writes all buffers before close
set autowriteall
" macros
" C
" #include <$1>
let @i = 'I#include <A>'
" printf("$1");
let @p = 'Iprintf("A");'
" block {}
let @b = 'A {
a
€kb€kb€kb€kb€kb€kb€kb€kb}kA€kb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment