nixvim/config/keybindings.nix

97 lines
1.8 KiB
Nix
Raw Normal View History

2024-08-20 05:43:03 +00:00
{ helpers, ... }:
{
keymaps = [
# Window movement.
{
mode = [ "n" ];
key = "<c-h>";
action = "<c-w>h";
options = {
remap = true;
};
}
{
mode = [ "n" ];
key = "<c-h>";
action = helpers.mkRaw ''
function()
local cur_win = vim.api.nvim_get_current_win()
vim.cmd('wincmd h')
if cur_win == vim.api.nvim_get_current_win() then
require('neo-tree.command').execute({ toggle = true })
end
end
'';
options = {
remap = true;
};
}
{
mode = [ "n" ];
key = "<c-j>";
action = helpers.mkRaw ''
function()
local cur_win = vim.api.nvim_get_current_win()
vim.cmd('wincmd j')
if cur_win == vim.api.nvim_get_current_win() then
vim.cmd('ToggleTerm')
end
end
'';
options = {
remap = true;
};
}
{
mode = [ "n" ];
key = "<c-k>";
action = "<c-w>k";
options = {
remap = true;
};
}
{
mode = [ "n" ];
key = "<c-l>";
action = "<c-w>l";
options = {
remap = true;
};
2024-08-21 15:05:04 +00:00
}
2024-08-20 05:43:03 +00:00
# Use ESC to exit terminal mode
{
mode = [ "t" ];
key = "<Esc>";
action = "<C-\\><C-n>";
}
# Buffer movement
{
mode = [ "n" ];
key = "<s-h>";
action = "<cmd>bprevious<cr>";
options = {
desc = "Previous Buffer";
};
}
{
mode = [ "n" ];
key = "<s-l>";
action = "<cmd>bnext<cr>";
options = {
desc = "Next Buffer";
};
}
{
mode = [ "n" "i" ];
key = "<S-Tab>";
action = "<cmd>tabprevious<cr>";
options = {
desc = "Previous Tab";
};
}
];
}