mirror of
https://github.com/hazemKrimi/config-minimal.nvim.git
synced 2026-05-01 18:20:27 +00:00
chore: remove tab options and keymaps
This commit is contained in:
@@ -42,74 +42,6 @@ vim.keymap.set("n", "<leader>bp", ":bprevious<CR>", { desc = "Previous buffer" }
|
||||
vim.keymap.set("n", "<leader>e", ":Explore<CR>", { desc = "Open file explorer" })
|
||||
vim.keymap.set("n", "<leader>ff", ":find ", { desc = "Find file" })
|
||||
|
||||
-- Tab Navigation
|
||||
|
||||
vim.keymap.set('n', '<leader>tn', ':tabnew<CR>', { desc = 'New tab' })
|
||||
vim.keymap.set('n', '<leader>tx', ':tabclose<CR>', { desc = 'Close tab' })
|
||||
vim.keymap.set('n', '<leader>tm', ':tabmove<CR>', { desc = 'Move tab' })
|
||||
vim.keymap.set('n', '<leader>t>', ':tabmove +1<CR>', { desc = 'Move tab right' })
|
||||
vim.keymap.set('n', '<leader>t<', ':tabmove -1<CR>', { desc = 'Move tab left' })
|
||||
|
||||
-- Function to open file in new tab
|
||||
|
||||
local function open_file_in_tab()
|
||||
vim.ui.input({ prompt = 'File to open in new tab: ', completion = 'file' }, function(input)
|
||||
if input and input ~= '' then
|
||||
vim.cmd('tabnew ' .. input)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Function to duplicate current tab
|
||||
|
||||
local function duplicate_tab()
|
||||
local current_file = vim.fn.expand('%:p')
|
||||
if current_file ~= '' then
|
||||
vim.cmd('tabnew ' .. current_file)
|
||||
else
|
||||
vim.cmd('tabnew')
|
||||
end
|
||||
end
|
||||
|
||||
-- Function to close tabs to the right
|
||||
|
||||
local function close_tabs_right()
|
||||
local current_tab = vim.fn.tabpagenr()
|
||||
local last_tab = vim.fn.tabpagenr('$')
|
||||
|
||||
for i = last_tab, current_tab + 1, -1 do
|
||||
vim.cmd(i .. 'tabclose')
|
||||
end
|
||||
end
|
||||
|
||||
-- Function to close tabs to the left
|
||||
|
||||
local function close_tabs_left()
|
||||
local current_tab = vim.fn.tabpagenr()
|
||||
|
||||
for i = current_tab - 1, 1, -1 do
|
||||
vim.cmd('1tabclose')
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>tO', open_file_in_tab, { desc = 'Open file in new tab' })
|
||||
vim.keymap.set('n', '<leader>td', duplicate_tab, { desc = 'Duplicate current tab' })
|
||||
vim.keymap.set('n', '<leader>tr', close_tabs_right, { desc = 'Close tabs to the right' })
|
||||
vim.keymap.set('n', '<leader>tL', close_tabs_left, { desc = 'Close tabs to the left' })
|
||||
|
||||
-- Function to close buffer but keep tab if it's the only buffer in tab
|
||||
|
||||
local function smart_close_buffer()
|
||||
local buffers_in_tab = #vim.fn.tabpagebuflist()
|
||||
if buffers_in_tab > 1 then
|
||||
vim.cmd('bdelete')
|
||||
else
|
||||
-- If it's the only buffer in tab, close the tab
|
||||
vim.cmd('tabclose')
|
||||
end
|
||||
end
|
||||
vim.keymap.set('n', '<leader>bd', smart_close_buffer, { desc = 'Smart close buffer/tab' })
|
||||
|
||||
-- Diagnostic keymaps
|
||||
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||
|
||||
Reference in New Issue
Block a user