-
Notifications
You must be signed in to change notification settings - Fork 3
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
Question: Close Buffer with <esc>
#15
Comments
Change the prepare_buffer = function(opts)
local buf = vim.api.nvim_create_buf(false, true)
vim.keymap.set('n', '<Esc>', '<cmd>close<cr>', {buffer = buf})
return vim.api.nvim_open_win(buf, true, opts)
end, You also may want to try this patch #14 , it allows you specify buffer options (filetype, number column, syntax highlinghting, etc.). The following lua code maps vim.api.nvim_create_autocmd("FileType", {
pattern = { "messages" },
callback = function(args)
vim.keymap.set("n", "q", "<cmd>close<cr>",
{ silent = false, noremap = true, buffer = args.buf, }
)
end,
}) |
First route worked like a charm, thank you! |
Thanks @hehelego and glad to hear it works now @harrisoncramer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello! Thanks so much for building this.
Would it be possible to name the messages buffer, or provide some sort of identifying information?
I'd love to be able to hit
<esc>
to close it, but I'm not seeing it in the:buffers
call and not sure how to target it with a lua function. Apologies if this isn't in scope. Thanks!The text was updated successfully, but these errors were encountered: