Skip to content

Commit 6c3a071

Browse files
committed
fuck
1 parent b4e3921 commit 6c3a071

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Default config
1111
{
1212
show_hidden = true,
1313
normal_when_fits = true,
14+
file_dir_based = true,
1415
shortcuts = 'sdfhlwertyuopzxcvbnmSDFGHLQWERTYUOPZXCVBNM', -- make sure > 25
1516
keymaps = {
1617
open = { i = '<CR>', n = '<CR>' }, -- both on search and main buffer

lua/dired/init.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ int os_get_uname(uv_uid_t uid, char *s, size_t len);
2828
---@field shortcuts string
2929
---@field show_hidden boolean
3030
---@field normal_when_fits boolean
31+
---@field file_dir_based boolean
3132
---@field keymaps KeyMapConfig
3233

3334
---@type DiredConfig
@@ -36,6 +37,7 @@ local Config = setmetatable({}, {
3637
local default = {
3738
show_hidden = true,
3839
normal_when_fits = true,
40+
file_dir_based = true,
3941
shortcuts = 'sdfhlwertyuopzxcvbnmSDFGHLQWERTYUOPZXCVBNM',
4042
keymaps = {
4143
open = { i = '<CR>', n = '<CR>' }, -- both on search and main buffer
@@ -767,7 +769,7 @@ Browser.State = {
767769

768770
-- Set new timer for delayed search
769771
timer:start(
770-
200,
772+
50,
771773
0,
772774
vim.schedule_wrap(function()
773775
if
@@ -1432,6 +1434,12 @@ end
14321434

14331435
local function browse_directory(path)
14341436
path = path:find(SEPARATOR .. '$') and path or path .. SEPARATOR
1437+
if Config.file_dir_based then
1438+
local fname = api.nvim_buf_get_name(0)
1439+
if #fname > 0 then
1440+
path = vim.fs.dirname(fname) .. SEPARATOR
1441+
end
1442+
end
14351443
F.IO
14361444
.chain(Browser.State.create(path), function(state)
14371445
return F.IO.chain(Browser.setup(state), function(s)

0 commit comments

Comments
 (0)