bufdelete: delete buffer without messing up windows

This commit is contained in:
xinyangli 2024-12-10 12:40:33 +08:00
parent 493148c3b8
commit aea55dcd6c
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
6 changed files with 37 additions and 19 deletions

View file

@ -1,6 +1,6 @@
# Nixvim # Nixvim
## TODO ## TODO
[ ] Open last active buffer after :bd - [ ] Open last active buffer after :bd
[ ] Code action - [ ] Code action
[ ] DAP support - [ ] DAP support

View file

@ -0,0 +1,23 @@
{ helpers, ... }:
{
plugins = {
bufdelete = {
enable = true;
};
};
keymaps = [
{
mode = [ "n" ];
key = "<C-x>";
action = helpers.mkRaw ''
function()
require("bufdelete").bufdelete(0, false)
end
'';
options = {
desc = "Toggle terminal";
};
}
];
}

View file

@ -1,6 +1,7 @@
{ {
# Import all your configuration modules here # Import all your configuration modules here
imports = [ imports = [
./buffer/bufdelete.nix
./blink.nix ./blink.nix
./bufferline.nix ./bufferline.nix
./comment.nix ./comment.nix
@ -15,7 +16,6 @@
./lsp ./lsp
./lualine.nix ./lualine.nix
./neo-tree.nix ./neo-tree.nix
# ./nvim-cmp.nix
# ./project.nix # ./project.nix
./rainbow-delimiters.nix ./rainbow-delimiters.nix
./telescope.nix ./telescope.nix
@ -23,6 +23,5 @@
./treesitter.nix ./treesitter.nix
./which-key.nix ./which-key.nix
]; ];
plugins.web-devicons.enable = true; plugins.web-devicons.enable = true;
} }

View file

@ -83,14 +83,5 @@
desc = "Next Buffer"; desc = "Next Buffer";
}; };
} }
{
mode = [ "n" "i" ];
key = "<S-Tab>";
action = "<cmd>tabprevious<cr>";
options = {
desc = "Previous Tab";
};
}
]; ];
} }

View file

@ -6,7 +6,10 @@
}; };
keymaps = [ keymaps = [
{ {
mode = [ "n" "i" ]; mode = [
"n"
"i"
];
key = "<C-p>"; key = "<C-p>";
action = helpers.mkRaw '' action = helpers.mkRaw ''
function() function()
@ -18,11 +21,14 @@
}; };
} }
{ {
mode = [ "n" "i" ]; mode = [
"n"
"i"
];
key = "<C-S-p>"; key = "<C-S-p>";
action = helpers.mkRaw '' action = helpers.mkRaw ''
function() function()
require("telescope.builtin").help_tags() require("telescope.builtin").live_grep()
end end
''; '';
} }

View file

@ -4,8 +4,7 @@
}; };
keymaps = [ keymaps = [
{
{
mode = [ "n" ]; mode = [ "n" ];
key = "<leader>tt"; key = "<leader>tt";
action = "<cmd>ToggleTerm<cr>"; action = "<cmd>ToggleTerm<cr>";