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

Recipe for permanently previewing an arbitrary file #59

Open
snoblenet opened this issue Apr 2, 2024 · 1 comment
Open

Recipe for permanently previewing an arbitrary file #59

snoblenet opened this issue Apr 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@snoblenet
Copy link

Could the README.md please include a recipe for permanently previewing an arbitrary Markdown file, even if that file is not currently open in a buffer.

@snoblenet snoblenet added the enhancement New feature or request label Apr 2, 2024
@toppair
Copy link
Owner

toppair commented Apr 9, 2024

If you're okay with loading file into a buffer just once, then you could use a user command e.g.:

require('peek').setup({ close_on_bdelete = false, auto_load = false })

vim.api.nvim_create_user_command('PeekOpenFile', function(arg)
  vim.api.nvim_command('edit ' .. arg.args)
  require('peek').open()
  vim.api.nvim_command('bdelete')
end, { nargs = 1, complete = 'file' })

And you would use it like so: :PeekOpenFile path/to/file.md

Not ideal, but it's currently not possible to load preview without loading the file into a buffer. And I don't think something like that should / needs to be implemented.

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

No branches or pull requests

2 participants