Tuesday, August 17, 2021

Re: VIM session files treated as 'file list database'?

There's one more tag in the vim session file: after $argadd, after edit, after balt, there are 'badd' specifications. If there are 100 $argadd, then I found 99 'badd'. Since I'm looking for those few that I 'selected' by leaving a buffer/window open/active, 'badd' didfn't help either. The 'edit' single spec mentions a file that also appears in 'balt' list, BTW. 

I can only think that based on 'balt' specs, open tabs/windows/buffers  are re-opened, then there must be some sense of 'logical operations being applied' which then changes what files actually appear in the open GVim editor window. 

What got me across the finish line was good old 'redirect' - along with 'ls' or 'history' - with option 'a', you only get a list of active/open buffers. 

So:  in my .vimrc I mapped Alt-S thusly:

map รณ :set nomore<CR>:redir >> /tmp/chosen-files<CR>:ls a <CR>:redir END <CR>:set more<CR>-

This command, I used, not once per file but once per GVim window (per 'session', if you will) - and in the end had that list of filenames in /tmp/chosen-files.

Bob's your uncle. Hope this helps someone else in the future. 

[Posted from browser on groups web site since this group does not send my own posts back to me - resulting in horrible confusion in distant past. Sorry about that.]

/Bill

On Monday, August 16, 2021 at 2:36:57 PM UTC-4 bill.h...@gmail.com wrote:

Trying to use sessions as 'database' using gvim. I hope this makes sense.

E.g., I'm reviewing 25 text notes/files - most are discarded, but some
are 'hits'. These files, I leave open (control-w to split window,
switch to the lower 'window' on the same file, and go to the next file
in the filelist).

At the end of the buffer list, I have 7 open buffers/'windows' out of
the original 25 files.

I run 'mksession a.vim', and in that file, I see these kinds of entries:

$argadd (25 times)
edit (1 time - current being edited)
balt (7 times)

Now, a simple linux pipe on the cmd-line prints the file names from
the 'balt' specifications/lines in the VIM session file.

BUT - I then realized that those files are NOT the files that open if
I use 'vim -S a.vim'. I can't figure it out. Is this documented other
than in the source code?

FYI, my .vimrc has:
set sessionoptions=buffers,help,resize,winpos,winsize,

(Hope it's obvious once I find the files in vim, I want to copy them
to another subtree so I can annotate, etc. I don't want to write them
one-at-a-time in VIM, even using a macro, as I'm really talking about
more than 600 files, not the measly 25 I use here in my example.)

I can't share the session file, because of the file names included
(legal reasons). BUT if no one knows what to do, I can dummy up
something with a few dozen fake file names to create a kind of example
showing this behavior; it'll just take a bit of time).

Thanks for any help -


--
/Bill

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4a44934f-7558-4ca6-b7f4-d9e14cee76acn%40googlegroups.com.

No comments:

Post a Comment