1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 00:19:02 -08:00

set up sessions and undo history

This commit is contained in:
Connor Olding 2015-03-10 15:21:29 -07:00
parent f47e46856a
commit c6591da83c
2 changed files with 32 additions and 6 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@ ssh/*
!ssh/crawl
vim/backup/*
vim/swp/*
vim/undo/*
vim/.*
vim/bundle/*
*.swp

View file

@ -24,22 +24,24 @@ if has("win32")
" something/vim/
" something/vim/after
let $MYVIMRC=expand('<sfile>')
let rcvim=expand('<sfile>:p:h:h').'/vim'
let g:rcvim=expand('<sfile>:p:h:h').'/vim'
if !exists('win32_once')
let win32_once=1
let $PATH.=';'.msys
let &runtimepath=rcvim.','.&runtimepath.','.rcvim.'/after'
let &runtimepath=g:rcvim.','.&runtimepath.','.g:rcvim.'/after'
endif
else
let rcvim='~/.vim'
let g:rcvim='~/.vim'
endif
let &backupdir=rcvim.'/backup' " stash tilde files elsewhere
let &backupdir=g:rcvim.'/backup' " stash tilde files elsewhere
" the double slash at the end dumps the path of the file for uniqueness
let &directory=rcvim.'/swp//' " stash swap files too
let &directory=g:rcvim.'/swp//' " stash swap files too
let &undodir=g:rcvim.'/undo/' " undo files are cool
try | call mkdir(&backupdir, "p") | catch /E739/ | endtry
try | call mkdir(&directory, "p") | catch /E739/ | endtry
try | call mkdir(&undodir, "p") | catch /E739/ | endtry
if (&term =~ "^xterm") " enable colors on any xterm
let &t_Co=256
@ -82,13 +84,18 @@ set incsearch " show first search result as we type
set ignorecase " insensitive searching
set smartcase " except when uppercase is used
set infercase " use existing case when ins-completing
set tabstop=8 shiftwidth=8 smarttab " 8 space tabs
set foldmethod=marker
set foldlevelstart=99 " start with everything unfolded
let c_syntax_for_h=1 " use C highlighting for .h files
set nowrap " word wrapping is pretty weak in vim
set ffs=unix,dos " ffs indeed
set tabstop=8 shiftwidth=8 smarttab " 8 space tabs
set nobomb " bombs are bad ok
set undofile " remember undos across files/sessions
set diffopt+=iwhite " ignore whitespace in diff command
if has('mksession')
set sessionoptions=blank,buffers,curdir,options,folds,tabpages,winsize,resize,winpos
end
if 0
set autoindent " when creating newline, use same indent
@ -99,6 +106,18 @@ endif " it's really just annoying though
" autocmd {{{1
fu! SaveSession()
let sf=g:rcvim.'/.session.vim'
execute 'mksession! '.sf
endf
fu! LoadSession()
let sf=g:rcvim.'/.session.vim'
if filereadable(sf)
execute 'so '.sf
endif
endf
fu! TabFour()
setlocal tabstop=8 shiftwidth=4 expandtab softtabstop=4
endf
@ -116,6 +135,11 @@ if has('autocmd')
au FileType ruby call TabTwo()
augroup END
augroup sessions
au!
au VimEnter * call LoadSession()
augroup END
augroup nobells " good lord vim you are archaic
au!
au GUIEnter * set vb t_vb=
@ -207,6 +231,7 @@ Inn <s-Del> X
nn <Leader>p "0p
nn <Leader>P "0P
nn <Leader>e :tabe
nn <Leader><F10> :call SaveSession()<cr>:xall<cr>
nn <silent> <Leader>d :cd %:p:h<cr>:pwd<cr>
nn <Leader>. @:
"nn <Leader>? :exec getline(".")