From 5b18ebb7e0bd388fd556378af1b5f23328917c84 Mon Sep 17 00:00:00 2001 From: Rodrigo Hashimoto Date: Tue, 7 Jun 2022 03:50:44 -0300 Subject: [PATCH] fix: allow nvim to enter command-line window This autocommand was closing the cmd-line window (q: / CTRL_F) immediately when we tried to enter it. Instead of the autocmd, added a buftype check to not create winbar in the Cmd Window, which was the purpose of that autocmd (I believe). --- lua/user/autocommands.lua | 6 ------ lua/user/winbar.lua | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lua/user/autocommands.lua b/lua/user/autocommands.lua index 7a19a9d3..26bbe4c6 100644 --- a/lua/user/autocommands.lua +++ b/lua/user/autocommands.lua @@ -57,12 +57,6 @@ vim.api.nvim_create_autocmd({ "VimResized" }, { end, }) -vim.api.nvim_create_autocmd({ "CmdWinEnter" }, { - callback = function() - vim.cmd "quit" - end, -}) - vim.api.nvim_create_autocmd({ "CursorMoved", "BufWinEnter", "BufFilePost", "InsertEnter", "BufWritePost" }, { callback = function() require("user.winbar").get_winbar() diff --git a/lua/user/winbar.lua b/lua/user/winbar.lua index 5ee566f4..12d08039 100644 --- a/lua/user/winbar.lua +++ b/lua/user/winbar.lua @@ -1,5 +1,9 @@ local M = {} +M.winbar_buftype_exclude = { + "nofile" +} + M.winbar_filetype_exclude = { "help", "startify", @@ -62,7 +66,7 @@ local get_gps = function() end local excludes = function() - if vim.tbl_contains(M.winbar_filetype_exclude, vim.bo.filetype) then + if vim.tbl_contains(M.winbar_filetype_exclude, vim.bo.filetype) or vim.tbl_contains(M.winbar_buftype_exclude, vim.bo.buftype) then vim.opt_local.winbar = nil return true end