Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use info://... for buffer name #10

Open
tomtomjhj opened this issue Aug 19, 2023 · 2 comments
Open

Use info://... for buffer name #10

tomtomjhj opened this issue Aug 19, 2023 · 2 comments

Comments

@tomtomjhj
Copy link

Thanks for nice plugin!

Currently, info.vim uses info:... format for buffer names. I suggest changing it to the standard info://... format, following many other plugins, e.g. fugitive://, man://, fern://.

Vim always interprets a filename that starts with scheme:// as an absolute path, so it removes ambiguity. For example, there can be a file named info:... in cwd. This is why :h Cmd-event recommends this format. This also allows ignoring the info buffers in :oldfiles with set viminfo+=rinfo://.

@HiPhish
Copy link
Owner

HiPhish commented Aug 20, 2023

I'm afraid I don't quite follow. Can you please give me an example (even if it is contrived) where my scheme could be a problem? The reason I went with for example info:make.info#Top instead of info://make.info#Top is that the former is the URI scheme proposed by GNU Texinfo for Info files without path. See info:texinfo.info#Info%20Files (or :Info texinfo Info\ Files).

I would prefer to remain compatible with this suggestion because it is supported by Emacs as well (principle of lease surprise). However, I think pragmatism trumps least surprise, Vim is not Emacs.

Truth be told, I don't like working on this plugin anymore. It is far too complicated for Vim script and it relies on standalone info to render the text. I would prefer to just rewrite it in Lua for Neovim only and use lpeg (which will be included with Neovim 0.10) to parse the Info files directly and render them myself. But Info files are often compressed, I don't know how I would deal with those. So far standalone info has been giving me support for them for free.

@tomtomjhj
Copy link
Author

Can you please give me an example (even if it is contrived) where my scheme could be a problem?

For example, user may want to edit the file named info:info.vim in the cwd.

touch info:info.vim
vim info:info.vim # shows the info page for info.vim

With the current scheme, info.vim cannot tell whether the user wants the file or the info page.
On the other hand, vim unambiguously interprets info://... as an absolute path.

v:oldfiles records the file names (among many other things) of the recently edited buffers.
For example, if you edit, ~/.vimrc, :oldfiles will display /home/user/.vimrc (after you rerun vim).

In some cases, you may want to exclude some files from v:oldfiles, especially when they are temporary files or not real files,
e.g. /tmp/*, fugitive://* (git commit, blob, ..), man:// (man page), and info pages.
This can be done with :h viminfo-r (or :h shada-r), but this only filters the filename by the prefix of the file name.

With info:info.vim scheme, the filename recorded in v:oldfiles will be /path/to/cwd/info:info.vim.
Therefore, it cannot be ignored from :oldfiles.
With info://info:info.vim scheme, exactly info://info:info.vim is recorded in v:oldfiles, so you can filter it out with set viminfo+=rinfo://.

So I think info:// scheme is more practical, but I do understand the advantage of info: scheme's compatibility.

Truth be told, I don't like working on this plugin anymore. It is far too complicated for Vim script and it relies on standalone info to render the text.

Fair enough 🙃

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

No branches or pull requests

2 participants