Skip to content

Commit e5e4814

Browse files
committed
update
1 parent dfb2aaa commit e5e4814

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lua/dired/init.lua

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,6 @@ UI.Window = {
301301
vim.bo[search_buf].buftype = 'prompt'
302302
vim.bo[search_buf].bufhidden = 'wipe'
303303
vim.wo[search_win].wrap = false
304-
local cwd = vim.uv.cwd()
305-
vim.fn.prompt_setprompt(search_buf, cwd .. '/')
306-
api.nvim_buf_set_extmark(search_buf, ns_id, 0, 0, {
307-
line_hl_group = 'DiredPrompt',
308-
})
309304

310305
-- Create main window
311306
local buf = api.nvim_create_buf(false, false)
@@ -641,11 +636,6 @@ Browser.setup = function(state)
641636
local name = line:match('%s(%S+)$')
642637
local current = state.current_path
643638
local new_path = vim.fs.joinpath(current, name)
644-
vim.fn.prompt_setprompt(state.search_buf, new_path)
645-
local pos = api.nvim_win_get_cursor(state.search_win)
646-
api.nvim_buf_set_extmark(state.search_buf, ns_id, pos[1], 0, {
647-
line_hl_group = 'DiredPrompt',
648-
})
649639

650640
if vim.fn.isdirectory(new_path) == 1 then
651641
Browser.refresh(state, new_path).run()
@@ -923,6 +913,13 @@ Browser.refresh = function(state, path)
923913
updateHighlights()
924914
Browser.update_current_hl(state, 2)
925915

916+
local new_path = not state.current_path:find('/$') and state.current_path .. '/'
917+
or state.current_path
918+
vim.fn.prompt_setprompt(state.search_buf, new_path)
919+
local pos = api.nvim_win_get_cursor(state.search_win)
920+
api.nvim_buf_set_extmark(state.search_buf, ns_id, pos[1] == 1 and 0 or pos[1] - 1, 0, {
921+
line_hl_group = 'DiredPrompt',
922+
})
926923
-- Update state
927924
state.entries = collected_entries
928925
end)

0 commit comments

Comments
 (0)