Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Is it possible to persist gina buffers in a session? #171

Open
frangio opened this issue Jun 14, 2018 · 5 comments
Open

Is it possible to persist gina buffers in a session? #171

frangio opened this issue Jun 14, 2018 · 5 comments

Comments

@frangio
Copy link

frangio commented Jun 14, 2018

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

@lambdalisue
Copy link
Owner

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.

@frangio
Copy link
Author

frangio commented Jun 14, 2018

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.)

@lambdalisue
Copy link
Owner

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.

@frangio
Copy link
Author

frangio commented Jun 15, 2018

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.

@lambdalisue
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants