add telescope-tabs

This commit is contained in:
Łukasz Pankowski 2023-09-03 20:11:20 +02:00
parent c43275442a
commit 094420a2c6
2 changed files with 27 additions and 0 deletions

View File

@ -45,6 +45,14 @@ key('n', '<leader>tD', function()
require('lupan.ui').tab_change_dir_newtab() require('lupan.ui').tab_change_dir_newtab()
end, { desc = '[T]ab change [D]irectory (new tab)' }) end, { desc = '[T]ab change [D]irectory (new tab)' })
key('n', '<leader>tm', function()
require('telescope-tabs').list_tabs(require 'telescope.themes'.get_dropdown())
end, { desc = '[T]ab change [D]irectory (new tab)' })
key('n', '<leader>tt', function()
require('telescope-tabs').go_to_previous()
end, { desc = '[T]ab [t]oggle previous' })
-- 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' })

View File

@ -0,0 +1,19 @@
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,
entry_ordinal = 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('%s %s', cwd, entry_string)
end,
}
end
}