nixvim-for-share/config/keymaps.nix
2025-07-26 12:43:01 +00:00

79 lines
1.6 KiB
Nix

{
keymaps = [
{
# vim.keymap.set({ "n", "v" }, "\\y", '"+y', {noremap=true, silent=true})
mode = [
"n"
"v"
];
key = "\\y";
action = "\"+y";
options = {
silent = true;
remap = false;
};
}
{
mode = [
"n"
"v"
];
key = "<leader>bp";
action = "<CMD>bprev<CR>";
options.desc = "Previous buffer";
}
{
mode = [
"n"
"v"
];
key = "<leader>bn";
action = "<CMD>bnext<CR>";
options.desc = "Next buffer";
}
{
mode = [
"n"
"v"
];
key = "<leader>bd";
action = "<CMD>bdelete<CR>";
options.desc = "Delete buffer";
}
{
mode = [
"n"
"v"
];
key = "<leader>bD";
action = "<CMD>bdelete!<CR>";
options.desc = "Delete buffer !";
}
# https://www.youtube.com/watch?v=w7i4amO_zaE
# keep search result in the middle of the screen
{
mode = [ "n" ];
key = "n";
action = "nzzzv";
}
# keep search result in the middle of the screen
{
mode = [ "n" ];
key = "N";
action = "Nzzzv";
}
# preserve previously copyed text when pasting when highlighting text
# otherwise, previously copyed text will be lost and clipboard will be filled with highlighted text
{
mode = [ "x" ];
key = "<leader>p";
action = "\"_dP";
}
];
extraConfigLua = ''
-- see ":help default-mapping"
-- vim.cmd[[unmap Y]]
vim.keymap.del( "n", "Y" )
'';
}