vim-gina icon indicating copy to clipboard operation
vim-gina copied to clipboard

Is it possible to persist gina buffers in a session?

Open frangio opened this issue 7 years ago • 5 comments

I would like to persist gina:// buffers in a session generated by mksession. Is this possible?

frangio avatar Jun 14 '18 18:06 frangio

I think it's technically possible but difficult with a current implementation.

If I remember the feature of mksession correctly, it creates a vim script file which opens existing buffers. While gina uses an alias name in a bufname for a particular git repository, users must call Gina command to open a buffer so that gina can make the alias. So if you modify the generated vim script by mksession manually, I think it's possible.

Or if gina uses a full path of a git repository and global BufReadCmd to opens a buffer. I've been wondering such changes for the next version. However the change would have a lot of side effects so I don't have any plan for mean time.

lambdalisue avatar Jun 14 '18 19:06 lambdalisue

global BufReadCmd to opens a buffer

I was doing a bit of research into this and I was going to suggest this as well. I think that would be fantastic. Any reason why you didn't go in that direction from the beginning?

(I love this plugin by the way! I hope I can contribute soon.)

frangio avatar Jun 14 '18 19:06 frangio

There are two major reasons.

  1. I'd prefer an alias repo name rather than a full path

Assume you have a git repository under /home/my/code/github.com/me/foo. Gina uses an alias repo name so the bufname of "Gina show README" on that repository would be "gina://foo:show/:README". I prefer this name rather than "gina:///home/my/code/github.com/me/foo:show/:README". If gina defines a global BufReadCmd, an alias bufname cannot be used while no alias info exist.

  1. To propagate command args

Assume that you hit "Gina grep -e hello --and -e world". Currently, gina uses a bufname without given args so the bufname of the above become "gina://brabra:grep". If gina defines a global BufReadCmd, I don't have any good idea to give args through a bufname.

lambdalisue avatar Jun 15 '18 05:06 lambdalisue

What about a bufname scheme similar to neovim's term://? It contains a relative path, not an absolute one, and it can contain all of the extra arguments after a separator.

frangio avatar Jun 15 '18 14:06 frangio

What about a bufname scheme similar to neovim's term://? It contains a relative path, not an absolute one, and it can contain all of the extra arguments after a separator.

Unfortunately no. The bufname must contain an absolute path for mksession while users might load that session file from a different Vim process. If I support global BufReadCmd autocmds, I would like to support it correctly.

Containing all extra arguments in a bufname is one option. Actually, I was thinking it in that way but I haven't tried it so I'm not sure if it's globally (cross-platform) possible.

lambdalisue avatar Jun 17 '18 14:06 lambdalisue