nixos/home/common/core/nixvim/keymaps.nix

144 lines
2.7 KiB
Nix
Raw Normal View History

2024-06-03 11:05:46 +01:00
{
programs.nixvim.keymaps = [
2024-06-03 11:05:46 +01:00
# Switching buffers
{
mode = ["n"];
action = "<C-w>h";
2024-06-03 11:05:46 +01:00
key = "<S-h>";
options = {silent = true;};
2024-06-03 11:05:46 +01:00
}
{
mode = ["n"];
action = "<C-w>j";
2024-06-03 11:05:46 +01:00
key = "<S-j>";
options = {
silent = true;
};
}
{
mode = ["n"];
action = "<C-w>k";
2024-06-03 11:05:46 +01:00
key = "<S-k>";
options = {
silent = true;
};
}
{
mode = ["n"];
action = "<C-w>l";
2024-06-03 11:05:46 +01:00
key = "<S-l>";
options = {
silent = true;
};
}
# Toggle nvim-tree
{
mode = ["n"];
2024-06-03 11:05:46 +01:00
action = "<cmd>NvimTreeFindFileToggle<CR>";
key = "tt";
options = {
silent = true;
};
}
# Clear search highlighting
{
mode = ["n"];
2024-06-03 11:05:46 +01:00
key = "<space><space>";
action = "<cmd>nohlsearch<CR>";
options = {noremap = true;};
2024-06-03 11:05:46 +01:00
}
# Telescope Plugin
{
# find files
mode = ["n"];
2024-06-03 11:05:46 +01:00
key = "<Leader>ff";
action = "<cmd>Telescope find_files<CR>";
options = {noremap = true;};
2024-06-03 11:05:46 +01:00
}
{
# live grep
mode = ["n"];
2024-06-03 11:05:46 +01:00
key = "<Leader>fg";
action = "<cmd>Telescope live_grep<CR>";
options = {noremap = true;};
2024-06-03 11:05:46 +01:00
}
{
# buffers
mode = ["n"];
2024-06-03 11:05:46 +01:00
key = "<Leader>fb";
action = "<cmd>Telescope buffers<CR>";
options = {noremap = true;};
2024-06-03 11:05:46 +01:00
}
{
# help tags
mode = ["n"];
2024-06-03 11:05:46 +01:00
key = "<Leader>fh";
action = "<cmd>Telescope help_tags<CR>";
options = {noremap = true;};
2024-06-03 11:05:46 +01:00
}
# paste over selected text without yanking it
{
mode = ["v"];
key = "p";
action = "\"_dP";
options = {noremap = true;};
}
# resize window
{
mode = ["n"];
key = "<Right>";
action = ":vertical resize +1<CR>";
options = {noremap = true;};
}
{
mode = ["n"];
key = "<Left>";
action = ":vertical resize -1<CR>";
options = {noremap = true;};
}
{
mode = ["n"];
key = "<Down>";
action = ":resize -1<CR>";
options = {noremap = true;};
}
{
mode = ["n"];
key = "<Up>";
action = ": resize +1<CR>";
options = {noremap = true;};
}
# indent line in or out
{
mode = ["v"];
key = "<";
action = "<gv";
options = {noremap = true;};
}
{
mode = ["v"];
key = ">";
action = ">gv";
options = {noremap = true;};
}
# move selected line up or down
{
mode = ["v"];
key = "J";
action = ":m '>+1<CR>gv=gv";
options = {noremap = true;};
}
{
mode = ["v"];
key = "K";
action = ":m '<-2<CR>gv=gv";
options = {noremap = true;};
}
2024-06-03 11:05:46 +01:00
];
}