Compare commits
No commits in common. "c42f1f0370b11dea8fa2972198272e9907105a32" and "fd96da8aec9e4dddc83b305eec1e36a6b919e9fc" have entirely different histories.
c42f1f0370
...
fd96da8aec
@ -1,44 +0,0 @@
|
|||||||
local actions = require "telescope.actions"
|
|
||||||
local action_state = require "telescope.actions.state"
|
|
||||||
local finders = require "telescope.finders"
|
|
||||||
local pickers = require "telescope.pickers"
|
|
||||||
local sorters = require "telescope.sorters"
|
|
||||||
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)
|
|
||||||
action(selected[1])
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.tab_change_dir(opts)
|
|
||||||
opts = opts or {}
|
|
||||||
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();
|
|
||||||
local picker_opts = {
|
|
||||||
prompt_title = prompt_title,
|
|
||||||
finder = finders.new_oneshot_job(cmd, {}),
|
|
||||||
sorter = sorters.get_fuzzy_file({}),
|
|
||||||
attach_mappings = function(_, map)
|
|
||||||
map({ "i", "n" }, "<CR>", function(prompt_bufnr) enter(prompt_bufnr, action) end)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
}
|
|
||||||
local change_dir = pickers.new(dropdown, picker_opts)
|
|
||||||
change_dir:find()
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
@ -37,15 +37,6 @@ key('n', '<leader>fF', function()
|
|||||||
require('telescope.builtin').find_files { hidden = true }
|
require('telescope.builtin').find_files { hidden = true }
|
||||||
end, { desc = '[F]ind [F]iles (with hidden)' })
|
end, { desc = '[F]ind [F]iles (with hidden)' })
|
||||||
|
|
||||||
key('n', '<leader>td', function()
|
|
||||||
require('lupan.cd').tab_change_dir()
|
|
||||||
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)" })
|
|
||||||
end, { desc = '[T]ab change [D]irectory (new tab)' })
|
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
key('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
key('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
key('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
key('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||||
@ -135,13 +126,3 @@ for i = 1, 9, 1 do
|
|||||||
require("harpoon.term").gotoTerminal(i)
|
require("harpoon.term").gotoTerminal(i)
|
||||||
end, { desc = '[H]arpoon nav_file [' .. i .. ']' })
|
end, { desc = '[H]arpoon nav_file [' .. i .. ']' })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- colors
|
|
||||||
|
|
||||||
key('n', '<F6>', function()
|
|
||||||
if vim.o.background == "dark" then
|
|
||||||
vim.o.background = "light"
|
|
||||||
else
|
|
||||||
vim.o.background = "dark"
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user