96 lines
1.8 KiB
Nix
96 lines
1.8 KiB
Nix
{ 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;
|
|
};
|
|
}
|
|
|
|
# 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";
|
|
};
|
|
}
|
|
];
|
|
}
|