No more unite-session

Fri, 18 Oct 2019 16:56:51 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 18 Oct 2019 16:56:51 -0500
changeset 805
59b23772424a
parent 804
17b16f2ff839
child 806
fb0c343bb872

No more unite-session

.vim/autoload/vimrc.vim file | annotate | diff | comparison | revisions
.vimrc file | annotate | diff | comparison | revisions
--- a/.vim/autoload/vimrc.vim
+++ b/.vim/autoload/vimrc.vim
@@ -25,9 +25,13 @@ func! vimrc#MkNonExDir(file, buf) abort
   endif
 endfunc
 
-func! vimrc#AutoSessionConfig() abort
+func! vimrc#AutoSessionCheck() abort
   if strlen(v:servername) > 0 && match(v:servername, 'VIM') == -1
-    exec 'UniteSessionLoad ' . tolower(v:servername)
+    let sessionfile = g:vimcache . "/session/" . tolower(v:servername) . ".vim"
+
+    if filereadable(sessionfile)
+      execute "source " . sessionfile
+    endif
   endif
 endfunc
 
--- a/.vimrc
+++ b/.vimrc
@@ -27,7 +27,6 @@ let s:filename   = expand('<sfile>')
   Plug 'Shougo/vimproc.vim'
   Plug 'Shougo/unite.vim'
   Plug 'Shougo/vimfiler.vim'
-  Plug 'Shougo/unite-session'
   Plug 'sjl/gundo.vim', {'on': 'GundoToggle'}
   Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'}
 
@@ -69,7 +68,6 @@ nnoremap <silent> <F5>   :GundoToggle<CR
 nnoremap <silent> <F8>   :TagbarToggle<CR>
 
 nnoremap <leader>ub :Unite buffer<CR>
-nnoremap <leader>us :Unite session<CR>
 
 " let F4, :noh work as-is in insert mode
 imap <F4> <C-O><F4>
@@ -122,10 +120,14 @@ noremap <silent> <leader>a :call vimrc#A
 
 " Commands & Aliases  {{{
 command! -nargs=+ CAlias call vimrc#CommandAlias(<f-args>)
+
 command! Gcd call vimrc#Gcd()
 command! Hgcd call vimrc#Hgcd()
+
 command! SyntaxCompleteOn setl omnifunc=syntaxcomplete#Complete
 
+command! Mksession execute v:this_session ? ("mksession! " . v:this_session) : ("echo 'no this_session'")
+
 command! -nargs=+ -complete=file -bar Ag call vimrc#Ag(<q-args>)
 CAlias Rg Ag
 
@@ -216,7 +218,7 @@ set sessionoptions=buffers,curdir,localo
 " Enable enhanced % matching in ruby
 runtime macros/matchit.vim
 
-for subdir in ['backup', 'tmp', 'undo']
+for subdir in ['backup', 'tmp', 'undo', 'session']
   if !filewritable(g:vimcache . '/' . subdir)
     call mkdir(g:vimcache . '/' . subdir, 'p', 0700)
   endif
@@ -258,7 +260,7 @@ augroup vimrc
   autocmd WinLeave * stopinsert
 
   " set and load a session based on servername
-  autocmd VimEnter  * call vimrc#AutoSessionConfig()
+  autocmd VimEnter * ++nested call vimrc#AutoSessionCheck()
 
   " complement to autowriteall
   autocmd FocusLost * silent! wa

mercurial