Monday, January 16, 2017

Re: Undead buffer: gets deleted but respawns on session launch

On Tuesday, April 23, 2013 at 8:41:08 AM UTC-7, Sylvia Ganush wrote:
> Good day.
>
> What may cause a deleted buffer to reappear on session launch?
>
> I once edited a file, a Figlet font. I deleted the buffer, and
> then exited Vim as I usually do:
>
> :mksession! session.vim
> :wqa
>
> But when restart the session the deleted buffer is still present on the
> :ls list. The buffer itself is empty. A 'ghost', if you wish.
>
> What gives?
>
> Regards,
>
> Sylvia

http://stackoverflow.com/questions/5238251/deleting-buffer-from-vim-session/41683144#41683144



Ok: this was annoying me, too. I have a command (Arch Linux: Krusader file manager)

vim --remote

that enables me to right-click a file in Krusader and open that fike in Vim. I also save Vim sessions via my ~/.vimrc:

" Save session on quitting Vim:
autocmd! VimLeave * mksession! ~/.vim/vim_session.vim
" mksession! overwrites old session

" Restore session on starting Vim:
autocmd! VimEnter * source ~/.vim/vim_session.vim

However, a file I opened externally via vim --remote, e.g.

/mnt/Vancouver/Programming/scripts/chunk.sh

stubbornly persists between sessions, even after doing the usual :bd, :bw, :bw! etc. commands, and/or deleting the vim session file.

Looking at the vim_session.vim file, I noted an 'argadd' line with the offending, persistent file:

argadd /mnt/Vancouver/Programming/scripts/chunk.sh

So,

:help arglist

:argd /mnt/Vancouver/Programming/scripts/chunk.sh
" delete that arg

Finally, clear that file from the buffer list (:bd). Restart Vim: the previous session is restored, minus that file.

--
--
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: