Skip to content

Commit 1603991

Browse files
committed
fix bs
1 parent 478d37b commit 1603991

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

lua/dired/init.lua

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
local api, uv, ffi = vim.api, vim.uv, require('ffi')
2-
local Iter = vim.iter
2+
local Iter, mapset = vim.iter, vim.keymap.set
33
local ops = require('dired.ops')
44
local FileOps, PathOps = ops.FileOps, ops.PathOps
55
local ns_id = api.nvim_create_namespace('dired_highlights')
@@ -701,7 +701,7 @@ local function create_shortcut_manager()
701701
right_gravity = false,
702702
})
703703
pool = { unpack(pool, 2) }
704-
vim.keymap.set('n', key, function()
704+
mapset('n', key, function()
705705
local lnum = assigned[key]
706706
local text = api.nvim_buf_get_lines(state.buf, lnum - 1, lnum, false)[1]
707707
if text then
@@ -994,7 +994,7 @@ Browser.State = {
994994

995995
-- Empty query or directory navigation
996996
if query == '' or query:match(SEPARATOR .. '$') then
997-
update_display(state, state.entries)
997+
Actions.openDirectory(state, vim.fs.normalize(line)).run()
998998
return
999999
end
10001000
state.entries = {}
@@ -1376,10 +1376,10 @@ Browser.setup = function(state)
13761376
vim.iter(k):map(function(item)
13771377
if map.buffer and type(map.buffer) == 'table' then
13781378
for _, b in ipairs(map.buffer) do
1379-
vim.keymap.set(m, item, map.action, { buffer = b })
1379+
mapset(m, item, map.action, { buffer = b })
13801380
end
13811381
else
1382-
vim.keymap.set(m, item, map.action, { buffer = map.buffer or state.search_buf })
1382+
mapset(m, item, map.action, { buffer = map.buffer or state.search_buf })
13831383
end
13841384
end)
13851385
end
@@ -1389,22 +1389,10 @@ Browser.setup = function(state)
13891389
nmap(map)
13901390
end)
13911391

1392-
vim.keymap.set('n', 'G', function()
1392+
mapset('n', 'G', function()
13931393
api.nvim_set_current_win(state.win)
13941394
api.nvim_feedkeys(api.nvim_replace_termcodes('G', true, false, true), 'n', false)
13951395
end, { buffer = state.search_buf })
1396-
1397-
vim.keymap.set('i', '<BS>', function()
1398-
local search_line = PathOps.getSearchPath(state)
1399-
local prev_char = search_line:sub(#search_line, #search_line)
1400-
if prev_char == SEPARATOR then
1401-
local parent = vim.fs.dirname(state.current_path:gsub(SEPARATOR .. '$', '')) .. SEPARATOR
1402-
Actions.openDirectory(state, parent).run()
1403-
return
1404-
end
1405-
return api.nvim_feedkeys(api.nvim_replace_termcodes('<BS>', true, false, true), 'n', false)
1406-
end, { buffer = state.search_buf })
1407-
14081396
return state
14091397
end)
14101398
end

0 commit comments

Comments
 (0)