diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/maps/find.lua | 8 | ||||
-rw-r--r-- | lua/utility/misc.lua | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lua/maps/find.lua b/lua/maps/find.lua index 5c1b244..9d10a51 100644 --- a/lua/maps/find.lua +++ b/lua/maps/find.lua @@ -1,3 +1,5 @@ +local utility_misc = require("utility.misc") + vim.keymap.set("n", "<leader>p", function() require("telescope.builtin").find_files() end) @@ -25,3 +27,9 @@ end) vim.keymap.set("n", "<leader>e", function() require("telescope").extensions.file_browser.file_browser() end) + +vim.keymap.set("n", "<leader>E", function() + local curr_buf_dir = utility_misc.dir_name(vim.api.nvim_buf_get_name(0)) + + require("telescope").extensions.file_browser.file_browser({ path = curr_buf_dir }) +end) diff --git a/lua/utility/misc.lua b/lua/utility/misc.lua index 04ec1fc..5e0b08c 100644 --- a/lua/utility/misc.lua +++ b/lua/utility/misc.lua @@ -1,8 +1,7 @@ -function GetCurrentFile() - return vim.fn.expand("%") -end +local misc = {} -function Dirname(file_path) +function misc.dir_name(file_path) return vim.fn.fnamemodify(file_path, ":p:h") end +return misc |