2013-07-04 01:39:44 -07:00
|
|
|
" vim:cc=79,39
|
|
|
|
set nocompatible " screw vi
|
2013-07-03 15:03:54 -07:00
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
if has('multi_byte')
|
|
|
|
scriptencoding utf-8 " allow it in this script
|
|
|
|
set termencoding=utf-8 " and this terminal supports it
|
|
|
|
set encoding=utf-8 " and the default file is in it
|
2013-07-03 15:03:54 -07:00
|
|
|
endif
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
if (&term =~ "^xterm") " enable colors on any xterm
|
|
|
|
let &t_Co=256
|
|
|
|
let &t_AF="\e[38;5;%dm"
|
|
|
|
let &t_AB="\e[48;5;%dm"
|
|
|
|
endif
|
|
|
|
|
|
|
|
if has('syntax')
|
|
|
|
syntax enable " required for folding as well
|
|
|
|
set hlsearch " highlight search results
|
|
|
|
endif
|
2013-07-03 15:03:54 -07:00
|
|
|
|
|
|
|
if has('gui_running')
|
2013-07-04 01:39:44 -07:00
|
|
|
set guioptions-=m " hide menu
|
|
|
|
set guioptions-=T " hide toolbar
|
|
|
|
set guifont=Consolas:h9
|
|
|
|
set columns=84
|
|
|
|
set lines=36
|
|
|
|
cd $HOME " might not be ideal...
|
|
|
|
|
|
|
|
colorscheme candycode
|
2013-07-03 15:03:54 -07:00
|
|
|
else
|
2013-07-04 01:39:44 -07:00
|
|
|
colorscheme Tomorrow-Night
|
2013-07-03 15:03:54 -07:00
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
set colorcolumn=79
|
2013-07-03 15:03:54 -07:00
|
|
|
endif
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
set history=512 " command lines to remember
|
|
|
|
|
|
|
|
set ruler " write out the cursor position
|
|
|
|
set lazyredraw " when executing macros, untyped things
|
|
|
|
|
|
|
|
if has('title')|set title|endif " terminal title
|
|
|
|
|
|
|
|
" be less verbose with some terms and tell vim to shut up
|
|
|
|
set shortmess=atI
|
|
|
|
|
|
|
|
" lower the priority of tab-completing files with these extensions
|
|
|
|
set suffixes=.bak,~,.swp,.o,.log,.out
|
|
|
|
|
|
|
|
set noerrorbells visualbell t_vb= " disable bells
|
|
|
|
|
|
|
|
" TODO: check if dir exists
|
|
|
|
set backupdir=~/.vim/backup " put tilde files elsewhere
|
|
|
|
|
|
|
|
set scrolloff=3 " row context during scrolling
|
|
|
|
set sidescrolloff=2 " col context during scrolling
|
|
|
|
|
|
|
|
set number " lines
|
|
|
|
let c_syntax_for_h=1 " use C highlighting for .h files
|
|
|
|
|
|
|
|
set incsearch " show first search result as we type
|
|
|
|
set ignorecase " insensitive searching
|
|
|
|
set smartcase " except when uppercase is used
|
2013-07-03 15:03:54 -07:00
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
set infercase " use existing case when ins-completing
|
2013-07-03 15:03:54 -07:00
|
|
|
|
|
|
|
set foldmethod=syntax
|
2013-07-04 01:39:44 -07:00
|
|
|
set foldlevelstart=99 " start with everything unfolded
|
2013-07-03 15:03:54 -07:00
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
if 0
|
|
|
|
set autoindent " when creating newline, use same indent
|
|
|
|
if has('smartindent')
|
|
|
|
set smartindent " automatic indents with a lot of stuff
|
|
|
|
endif
|
|
|
|
endif " it's really just annoying though
|
|
|
|
|
|
|
|
set diffopt+=iwhite " ignore whitespace in diff command
|
2013-07-03 15:03:54 -07:00
|
|
|
|
|
|
|
" word wrapping
|
|
|
|
set nowrap
|
|
|
|
set nolinebreak
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
set tabstop=8 shiftwidth=8 smarttab " 8 space tabs
|
|
|
|
|
2013-07-04 02:07:41 -07:00
|
|
|
fu! TabFour()
|
2013-07-04 01:39:44 -07:00
|
|
|
setlocal tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
2013-07-04 02:07:41 -07:00
|
|
|
endf
|
2013-07-04 01:39:44 -07:00
|
|
|
|
2014-03-13 10:15:09 -07:00
|
|
|
fu! TabTwo()
|
|
|
|
setlocal tabstop=2 shiftwidth=2 expandtab
|
|
|
|
endf
|
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
if has('autocmd')
|
|
|
|
augroup tabs " 4 spaces as tabs for various languages
|
|
|
|
au!
|
|
|
|
au FileType bash,sh,zsh,awk,python,lua,vim call TabFour()
|
|
|
|
au BufRead,BufNewFile *.json call TabFour()
|
2014-03-13 10:15:09 -07:00
|
|
|
au BufRead,BufNewFile PKGBUILD call TabTwo()
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
augroup reload " http://superuser.com/a/417997
|
|
|
|
au!
|
|
|
|
au BufWritePost .vimrc,_vimrc,vimrc so $MYVIMRC
|
2013-07-04 01:39:44 -07:00
|
|
|
augroup END
|
|
|
|
|
2013-07-04 02:07:41 -07:00
|
|
|
fu! ResCur() " attempt to preserve cursor position
|
|
|
|
if line("'\"") > 1 && line("'\"") <= line("$")
|
|
|
|
normal! g`"
|
|
|
|
return 1
|
|
|
|
endif
|
|
|
|
endf
|
|
|
|
augroup resCur
|
|
|
|
au!
|
2013-07-08 17:45:51 -07:00
|
|
|
au BufWinEnter * call ResCur()
|
2013-07-04 02:07:41 -07:00
|
|
|
augroup END
|
2013-07-04 01:39:44 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
set backspace=eol,start,indent " make backspace useful
|
|
|
|
|
|
|
|
" easy indent/unindent
|
|
|
|
nn <tab> >>
|
|
|
|
nn <s-tab> <<
|
|
|
|
" indentation without ending selection
|
|
|
|
vn <silent> <tab> >gv
|
|
|
|
vn <silent> <s-tab> <gv
|
2013-07-03 15:03:54 -07:00
|
|
|
|
2013-07-04 01:39:44 -07:00
|
|
|
" might make return useful
|
|
|
|
"nn <s-cr> J
|
|
|
|
"nn <c-cr> dd
|
|
|
|
" oh wait, terminals don't do that...
|
|
|
|
|
|
|
|
nn <F5> :w<cr>
|
|
|
|
nn <F8> :e<cr>
|
|
|
|
nn <F10> :q<cr>
|
|
|
|
nn <c-F5> :w!<cr>
|
|
|
|
nn <c-F8> :e!<cr>
|
|
|
|
nn <c-F10> :q!<cr>
|
|
|
|
nn <s-F5> :wall<cr>
|
|
|
|
"nn <s-F8> :eall<cr>
|
|
|
|
nn <s-F10> :qall<cr>
|
|
|
|
|
|
|
|
" bad habits
|
|
|
|
no <up> <nop>
|
|
|
|
no <down> <nop>
|
|
|
|
no <left> <nop>
|
|
|
|
no <right> <nop>
|
|
|
|
ino <up> <nop>
|
|
|
|
ino <down> <nop>
|
|
|
|
ino <left> <nop>
|
|
|
|
ino <right> <nop>
|
|
|
|
nn <c-up> <c-y>
|
|
|
|
nn <c-down> <c-e>
|
|
|
|
nn <c-s-up> :m-2<cr>
|
|
|
|
nn <c-s-down> :m+1<cr>
|
|
|
|
|
|
|
|
" rebind annoying things
|
|
|
|
nn Q gq
|
|
|
|
nn K <nop>
|
|
|
|
|
|
|
|
if v:version < 703 " even debian stable has 7.3, so...
|
|
|
|
set nomodeline
|
|
|
|
else
|
|
|
|
if &termencoding == "utf-8"
|
|
|
|
set list listchars=tab:»·,trail:·,extends:…,nbsp:‗
|
|
|
|
else
|
|
|
|
set list listchars=tab:>-,trail:.,extends:>,nbsp:_
|
|
|
|
endif
|
|
|
|
endif
|