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

Fixed cmdline_force_redraw hack for path completion #189

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions lua/noice/util/hacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,22 @@ function M.fix_cmp()
end

function M.cmdline_force_redraw()
if vim.api.nvim_get_mode().mode == "c" and vim.fn.getcmdline():find("s/") then
-- HACK: this will trigger redraw during substitue
vim.api.nvim_input("<space><bs>")
if vim.api.nvim_get_mode().mode ~= "c" then return end

local cmdline = vim.fn.getcmdline()
if cmdline:find("s/.") == nil then return end

local ignored_commands = {
"e", "w", "x", "r", "sav", "sp", "mk", "vie", "sv", "vs", "tabe", "tabnew",
"cf", "cg", "caddf", "lf", "lg", "laddf", "diff", "ped", "redi", "so", "up", "vi", "fin"
}
for _, value in ipairs(ignored_commands) do
-- returning here prevents messing with autocompletion for paths
if cmdline:find("^" .. value) then return end
end

-- HACK: this will trigger redraw while typing a substitution command (s/.../.../)
vim.api.nvim_input("<space><bs>")
end

M._guicursor = nil
Expand Down