0

When I'm using Neovim in conjunction to firenvim to edit a text box in the browser, I typically have the need to open another file.

I'd like to disable Neovim's ability to read from and write to other files besides the one in the current buffer.

This is to be used in conjunction with some other settings and features of firenvim in order to lock down Neovim inside the browser for security.

Is there a way to block Neovim from opening another file?

1 Answer 1

0

Not sure if it can close all the holes, but I'd probably start with something like:

augroup test | au!
    autocmd BufLeave * throw 'Not allowed!'
augroup end

No doubt, you also should at least have :set secure.

2
  • Wouldn't the autocmd effectively disallow any exiting when used? I don't want to open another file but still want to be able to quit the current buffer. Dec 24, 2020 at 10:22
  • 1
    @JohnZhau As usual, read :h BufLeave.
    – Matt
    Dec 24, 2020 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.