Friday, February 15, 2019

Re: mksession restore just deleted buffer

Le vendredi 15 février 2019 11:57:05 UTC+1, meine a écrit :
> On Thu, Feb 14, 2019 at 01:31:26PM -0800, nivaemail@gmail.com wrote:
> > I have two buffers in buffers' list and after buffer deleting the second one, restarting vim, it is always in the buffers's list.
> >
> > I don't understand why it appears again.
>
> You have to update the vim session you made by using `:mks!`
>
> //meine

It's done via these :


if has('autocmd')
aug Geometry
au!
au VimLeavePre * call geometry#SaveGeometry()
au VimEnter * call geometry#RestoreGeometry()
aug END
endif


fun! geometry#MkSession() "{{{
silent! execute 'mks! '.g:geometry#sessionfile
endfunction "}}}

fun! geometry#GetGeometry() "{{{
return [&columns,&lines] + getwinpos()
endfunction "}}}

fun! geometry#SaveGeometry() "{{{
let ret = writefile(geometry#GetGeometry(), g:geometry#file, 'b')
call geometry#MkSession()
endfunction "}}}

fun! geometry#RestoreGeometry() "{{{

if filereadable(g:geometry#file)
let geom = readfile(g:geometry#file) "137*21+156+156
" if geom != ''
" let winsize = split(geom,'+')
" silent! execute 'set columns='.split(winsize[0],'*')[0]
" silent! execute 'set lines='.split(winsize[0],'*')[1]
" silent! execute "winpos ".winsize[1].' '.winsize[2]
" endif
silent! execute 'set columns='.geom[0]
silent! execute 'set lines='.geom[1]
silent! execute "winpos ".geom[2].' '.geom[3]
endif

if filereadable(g:geometry#sessionfile)
silent! execute 'source '.g:geometry#sessionfile
endif
endfunction "}}}

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: