diff --git a/nvim/.config/nvim/lua/lupan/remap.lua b/nvim/.config/nvim/lua/lupan/remap.lua index 02ddb84..4a8bac1 100644 --- a/nvim/.config/nvim/lua/lupan/remap.lua +++ b/nvim/.config/nvim/lua/lupan/remap.lua @@ -45,6 +45,14 @@ key('n', 'tD', function() require('lupan.ui').tab_change_dir_newtab() end, { desc = '[T]ab change [D]irectory (new tab)' }) +key('n', 'tm', function() + require('telescope-tabs').list_tabs(require 'telescope.themes'.get_dropdown()) +end, { desc = '[T]ab change [D]irectory (new tab)' }) + +key('n', 'tt', function() + require('telescope-tabs').go_to_previous() +end, { desc = '[T]ab [t]oggle previous' }) + -- Diagnostic keymaps 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' }) diff --git a/nvim/.config/nvim/lua/plugins/telescope-tabs.lua b/nvim/.config/nvim/lua/plugins/telescope-tabs.lua new file mode 100644 index 0000000..f48a99a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/telescope-tabs.lua @@ -0,0 +1,14 @@ +return { + 'LukasPietzschmann/telescope-tabs', + dependencies = { 'nvim-telescope/telescope.nvim' }, + lazy = true, + config = function() + require 'telescope-tabs'.setup { + entry_formatter = function(tab_id, buffer_ids, file_names, file_paths, is_current) + local cwd = vim.fn.getcwd(-1, tab_id) + local entry_string = table.concat(file_names, ', ') + return string.format('%d: %s %s%s', tab_id, cwd, entry_string, is_current and ' <' or '') + end, + } + end +}