Skip to content

Instantly share code, notes, and snippets.

@muchzill4
Created January 29, 2013 06:21
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 muchzill4/4662231 to your computer and use it in GitHub Desktop.
Save muchzill4/4662231 to your computer and use it in GitHub Desktop.
" | >>> VIM CONFIGURATION
" |
" | put together by muchzill4@gmail.com
" | thanks stevelosh(.com), you've helped me a lot
" |
" | >>> Pathogen
" |
filetype off
call pathogen#infect()
filetype plugin indent on
set omnifunc=syntaxcomplete#Complete
set nocompatible
" | >>> Backup & Undo
" |
set nowb
set nobk
set noswapfile
set undofile
set undoreload=10000
set undodir=~/.vim/tmp/undo//
set backupdir=~/.vim/tmp/backup//
set directory=~/.vim/tmp/swap//
" If above are not there yet, create'em!
if !isdirectory(expand(&undodir))
call mkdir(expand(&undodir), "p")
endif
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p")
endif
if !isdirectory(expand(&directory))
call mkdir(expand(&directory), "p")
endif
" | >> Searching
" |
set ignorecase " ignore case in search pattenrns
set smartcase " only if using lowercase letters
set gdefault
" | >> Indenting
" |
set shiftround
set tabstop=4
set shiftwidth=4
set softtabstop=4
set noexpandtab
set smarttab
set autoindent
" | >> General
" |
set encoding=utf-8
set modelines=0
set history=1000
set showmode
set showcmd
set relativenumber
set numberwidth=4
set wrap
set linebreak
set ruler
set textwidth=0
set colorcolumn=+1
set laststatus=2
set novisualbell
set hls
set incsearch
set autoread " reload files that have been updated outside vim
set showmatch
set matchpairs+=<:>
set scrolloff=3
set splitbelow
set splitright
set nolazyredraw
set ttyfast
set title
set notimeout
set ttimeout
set ttimeoutlen=10
set list
set listchars=tab:>\ ,eol:¬,trail:·
set showbreak=↪
set matchtime=3
set statusline=%f
set statusline+=%=
set statusline+=%l
set statusline+=/
set statusline+=%L
set hidden
set nocursorline
set nocursorcolumn
set clipboard+=unnamed " use system clipboard
set formatoptions=qrn1
" | Ignoring Files
" |
set wildmenu
set wildmode=list:longest
set wildignore+=.hg,.git,.svn
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg,*.ico,*.ai,*.psd,*.ttf,*.svg
set wildignore=+*.ttf,*.woff,*.eof
set wildignore+=*.DS_Store
" | >>> Gui options
" |
if has('gui_running')
set guifont=Envy\ Code\ R:h13
set noantialias
" disable blinking
set guicursor+=a:blinkon0
" remove gui clutter
set go-=l
set go-=L
set go-=r
set go-=R
set go-=T
set linespace=1
" Full screen means FULL screen
set fuoptions=maxvert,maxhorz
end
" | >>> Syntax
" |
syntax on
colorscheme notsobadwolf
let php_sql_query=0
let php_show_semicolon=0
let php_alt_blocks=0
let php_highlight_quotes=1
" Don't try to highlight lines longer than 800 characters.
set synmaxcol=800
" | >>> Language/file specific
" |
augroup python_sets
au!
au FileType python setlocal
\ softtabstop=4
\ tabstop=4
\ shiftwidth=4
\ expandtab
\ textwidth=80
augroup END
" | >>> Bindings
" |
let mapleader=','
" esc
inoremap jk <esc>
" ,1 to underline, yay!
nnoremap <leader>1 yypwv$r=
" edit .vimrc
nnoremap <leader>ev :e $MYVIMRC<cr>
" smart way to move btw. windows (arrows)
noremap <down> <c-w>j
noremap <up> <c-w>k
noremap <left> <c-w>h
noremap <right> <c-w>l
" uppercase, lowercase, camelcase
noremap <c-k>l viwu<esc>
noremap <c-k>u viwU<esc>
noremap <c-k>c bvU<esc>
" fullscreen
inoremap <F1> <ESC>:set invfullscreen<CR>a
noremap <F1> :set invfullscreen<cr>
" tab for matching braces
nnoremap <tab> %
vnoremap <tab> %
" smart way to move thru file
noremap H ^
noremap L $
noremap K <C-u>
noremap J <C-d>
" temp remove search hl
nnoremap <F12> :set hlsearch!<cr>
" colon to space
nnoremap <space> :
" fast saving
nnoremap <leader>w :w!<cr>
" delete / change while in insert mode
inoremap <C-d> <esc>ddi
inoremap <C-c> <esc>cc
" quit
noremap <leader>q :q<cr>
" buffer delete
noremap <leader>d :bd<cr>
" edit color scheme
noremap <leader>ec :vsplit ~/.
" | >>> Helpers
" |
" show syntax highlighting groups for word under cursor
" autochdir that does not confuse plugins
autocmd BufEnter * silent! lcd %:p:h
noremap <c-s-p> :call SynStack()<cr>
function! SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
" reload config on modify
augroup w_config
au!
au BufWritePost .vimrc source %
augroup END
" reload colorscheme on save
augroup colorscheme_dev
au!
au BufWritePost notsobadwolf.vim color notsobadwolf
augroup END
" save file on focus lost
augroup lost_focus
au!
au FocusLost * :silent! wall
augroup END
" return to the same line when you reopen a file
" Thanks, Amit & SLJ
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
" | >>> Plugin settings
" |
" NERDTree
noremap <silent> <leader>n :NERDTreeToggle<cr>
let NERDTreeIgnore=['\.png$', '\.jpg$', '\.gif$'] " Don't show image files.
let NERDTreeBookmarksFile='/Users/much4/.vim/tmp/NERDTreeBookmarks'
let NERDTreeChDirMode=1
let NERDTreeShowBookmarks=1
let NERDTreeShowLineNumbers=0
" EasyMotion
let g:EasyMotion_leader_key = '<leader>m'
let g:EasyMotion_do_shade = 1
" CtrlP
let g:ctrlp_map = '<leader>t'
let g:ctrlp_cmd = 'CtrlP'
noremap <leader>b :CtrlPBuffer<cr>
" Snipmate
let g:snippets_dir = '/Users/much4/.vim/snippets'
" Ack
nnoremap <leader>a :Ack!<space>
nnoremap <leader>A :cw<cr>
let g:ackprg = 'ack --nogroup --nocolor --column'
" Autoclose
let g:AutoClosePairs_add = "<> | '\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment