Skip to content

Commit 09f947b

Browse files
authored
Add mapping to manage tabs (#478)
1 parent bc9fbcd commit 09f947b

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

lua/mappings.lua

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ keymap.set("n", [[\x]], "<cmd>windo lclose <bar> cclose <cr>", {
3030
})
3131

3232
-- Delete a buffer, without closing the window, see https://stackoverflow.com/q/4465095/6064933
33-
keymap.set("n", [[\d]], "<cmd>bprevious <bar> bdelete #<cr>", {
33+
keymap.set("n", [[\db]], "<cmd>bprevious <bar> bdelete #<cr>", {
3434
silent = true,
35-
desc = "delete current buffer",
35+
desc = "Delete current buffer",
3636
})
3737

38-
keymap.set("n", [[\D]], function()
38+
keymap.set("n", [[\dB]], function()
3939
local buf_ids = vim.api.nvim_list_bufs()
4040
local cur_buf = vim.api.nvim_win_get_buf(0)
4141

@@ -46,7 +46,17 @@ keymap.set("n", [[\D]], function()
4646
end
4747
end
4848
end, {
49-
desc = "delete other buffers",
49+
desc = "Delete other buffers",
50+
})
51+
52+
keymap.set("n", [[\dt]], "<cmd>tabclose<CR>", {
53+
silent = true,
54+
desc = "Delete current tab",
55+
})
56+
57+
keymap.set("n", [[\dT]], "<cmd>tabonly<CR>", {
58+
silent = true,
59+
desc = "Delete other tabs",
5060
})
5161

5262
-- Move the cursor based on physical lines, not the actual lines.

0 commit comments

Comments
 (0)