Skip to content

Commit dfa9957

Browse files
committed
fuck
1 parent aaa96a4 commit dfa9957

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lua/dired/init.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,16 +603,18 @@ local function create_shortcut_manager()
603603
local idx = 1
604604
-- {shortcut -> line_num}
605605
local assigned = {} -- type table<string, int>
606-
-- {line_num -> shortcut}
607-
local line_shortcuts = {}
608606
local existing_keymaps = {}
609607

610608
return {
609+
get = function()
610+
return assigned
611+
end,
611612
reset = function(state)
612-
for shortcut, _ in pairs(existing_keymaps) do
613+
for shortcut, _ in pairs(assigned) do
613614
pcall(vim.keymap.del, 'n', shortcut, { buffer = state.buf })
614615
end
615616
assigned = {}
617+
pool = vim.split(Config.shortcuts, '')
616618
end,
617619
assign = function(state, row)
618620
local key = select(1, unpack(pool))
@@ -687,6 +689,9 @@ Browser.State = {
687689
-- Function to update display with entries
688690
local function update_display(new_state, entries_to_show)
689691
vim.schedule(function()
692+
if next(s.shortcut_manager.get()) ~= nil then
693+
s.shortcut_manager.reset(new_state)
694+
end
690695
if api.nvim_buf_is_valid(new_state.buf) then
691696
api.nvim_buf_set_lines(new_state.buf, 0, -1, false, {})
692697
api.nvim_buf_clear_namespace(new_state.buf, ns_id, 0, -1)
@@ -935,14 +940,12 @@ Actions.openDirectory = function(state, path)
935940
hl_mode = 'combine',
936941
})
937942
end
938-
939943
if
940944
api.nvim_get_current_buf() == refreshed_state.search_buf
941945
and api.nvim_get_mode().mode ~= 'i'
942946
then
943-
vim.cmd.startinsert()
947+
vim.cmd('startinsert!')
944948
end
945-
946949
return refreshed_state
947950
end)
948951
end)

0 commit comments

Comments
 (0)