aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-10 14:50:06 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-10 14:50:06 +1200
commit5cf226229562e92dd4e2fce2fb6134c82669bdd9 (patch)
tree3c9dbcbc01c7ecb05d85b5cabc9aed8cc780fd89 /vim/plugin
parentAdd 'sessionoptions' settings (diff)
downloaddotfiles-5cf226229562e92dd4e2fce2fb6134c82669bdd9.tar.gz
dotfiles-5cf226229562e92dd4e2fce2fb6134c82669bdd9.zip
Add session_lazy.vim plugin
Mostly to properly tie down the way I want sessions to behave while I write my book. No documentation yet!
Diffstat (limited to 'vim/plugin')
-rw-r--r--vim/plugin/session_lazy.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/vim/plugin/session_lazy.vim b/vim/plugin/session_lazy.vim
new file mode 100644
index 00000000..d40cb670
--- /dev/null
+++ b/vim/plugin/session_lazy.vim
@@ -0,0 +1,23 @@
+"
+" session_lazy.vim: Automatically resume a session from the current directory,
+" if no other filename arguments were passed to Vim.
+"
+" Author: Tom Ryder <tom@sanctum.geek.nz>
+" License: Same as Vim itself
+"
+if exists('g:loaded_session_lazy') || &compatible
+ finish
+endif
+if !has('autocmd') || v:version < 700
+ finish
+endif
+let g:loaded_session_lazy = 1
+
+" Set up
+augroup session
+ autocmd!
+ autocmd VimEnter *
+ \ call session_lazy#Thaw()
+ autocmd VimLeavePre *
+ \ call session_lazy#Freeze()
+augroup END