Compare commits

..

2 Commits

2 changed files with 12 additions and 11 deletions

View File

@ -7,6 +7,15 @@ local themes = require "telescope.themes"
local M = {}
function M.tcd(dir)
vim.cmd('tcd ' .. dir)
end
function M.tabnew_tcd(dir)
vim.cmd('tabnew ' .. dir)
vim.cmd('tcd ' .. dir)
end
local function enter(prompt_bufnr, action)
local selected = action_state.get_selected_entry()
actions.close(prompt_bufnr)
@ -15,7 +24,7 @@ end
function M.tab_change_dir(opts)
opts = opts or {}
local action = opts.action or vim.cmd.tc
local action = opts.action or M.tcd
local prompt_title = opts.prompt_title or "Tab change directory"
local cmd = { 'find', os.getenv('HOME'), '-maxdepth', '5', '-type', 'd', '-not', '-path', '*/.git*' }
local dropdown = themes.get_dropdown();
@ -32,13 +41,4 @@ function M.tab_change_dir(opts)
change_dir:find()
end
local function tabnew_tcd(dir)
vim.cmd.tabnew(dir)
vim.cmd.tc(dir)
end
function M.tab_change_dir_newtab()
M.tab_change_dir({ action = tabnew_tcd, prompt_title = "Tab change directory (new tab)" })
end
return M

View File

@ -42,7 +42,8 @@ key('n', '<leader>td', function()
end, { desc = '[T]ab change [d]irectory' })
key('n', '<leader>tD', function()
require('lupan.cd').tab_change_dir_newtab()
local cd = require('lupan.cd')
cd.tab_change_dir({ action = cd.tabnew_tcd, prompt_title = "Tab change directory (new tab)" })
end, { desc = '[T]ab change [D]irectory (new tab)' })
-- Diagnostic keymaps