Compare commits
2 Commits
c42f1f0370
...
01229cc7b0
Author | SHA1 | Date | |
---|---|---|---|
01229cc7b0 | |||
7ff5a6a634 |
@ -7,15 +7,6 @@ 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)
|
||||
@ -24,7 +15,7 @@ end
|
||||
|
||||
function M.tab_change_dir(opts)
|
||||
opts = opts or {}
|
||||
local action = opts.action or M.tcd
|
||||
local action = opts.action or vim.cmd.tc
|
||||
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();
|
||||
@ -41,4 +32,13 @@ 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
|
||||
|
@ -42,8 +42,7 @@ key('n', '<leader>td', function()
|
||||
end, { desc = '[T]ab change [d]irectory' })
|
||||
|
||||
key('n', '<leader>tD', function()
|
||||
local cd = require('lupan.cd')
|
||||
cd.tab_change_dir({ action = cd.tabnew_tcd, prompt_title = "Tab change directory (new tab)" })
|
||||
require('lupan.cd').tab_change_dir_newtab()
|
||||
end, { desc = '[T]ab change [D]irectory (new tab)' })
|
||||
|
||||
-- Diagnostic keymaps
|
||||
|
Loading…
x
Reference in New Issue
Block a user