parent
6aa17892b1
commit
359c8534f9
6 changed files with 418 additions and 407 deletions
146
common/hm-modules/nvim/keybinds.nix
Normal file
146
common/hm-modules/nvim/keybinds.nix
Normal file
|
@ -0,0 +1,146 @@
|
|||
{ helpers, ... }:
|
||||
{
|
||||
keymaps = with helpers; [
|
||||
# General
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>";
|
||||
action = ":noh<CR>";
|
||||
}
|
||||
# Telescope
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ff";
|
||||
action = ":Telescope find_files<CR>";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fs";
|
||||
action = ":Telescope file_browser<CR>";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fg";
|
||||
action = mkRaw "require('telescope.builtin').live_grep";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fb";
|
||||
action = ":Telescope buffers<CR>";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fo";
|
||||
action = ":Telescope oldfiles<CR>";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fr";
|
||||
action = ":Telescope frecency<CR>";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ob";
|
||||
action = mkRaw "require('obsidian_picker').obsidian_picker";
|
||||
}
|
||||
# Commenting
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-/>";
|
||||
action = mkRaw "require('Comment.api').toggle.linewise.current";
|
||||
}
|
||||
{
|
||||
mode = "x";
|
||||
key = "<C-/>";
|
||||
action = mkRaw ''
|
||||
function()
|
||||
local esc = vim.api.nvim_replace_termcodes(
|
||||
'<ESC>', true, false, true
|
||||
)
|
||||
vim.api.nvim_feedkeys(esc, 'nx', false)
|
||||
require('Comment.api').toggle.linewise(vim.fn.visualmode())
|
||||
end
|
||||
'';
|
||||
}
|
||||
# Float Term
|
||||
{
|
||||
mode = "n";
|
||||
key = "t";
|
||||
action = ":FloatermToggle myfloat<CR>";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<ESC>";
|
||||
action = mkRaw "function() vim.cmd(':FloatermToggle myfloat') end";
|
||||
}
|
||||
# Switch buffers
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>q";
|
||||
action = ":bd<CR>"; # Delete buffer
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>s";
|
||||
action = ":bn<CR>"; # Buffer next
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>a";
|
||||
action = ":bp<CR>"; # Buffer previous
|
||||
}
|
||||
# Change Indenting
|
||||
{
|
||||
mode = "i";
|
||||
key = "<S-Tab>";
|
||||
action = "<C-o><<";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<S-Tab>";
|
||||
action = "<<_";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<Tab>";
|
||||
action = ">>_";
|
||||
}
|
||||
{
|
||||
mode = "v";
|
||||
key = "<Tab>";
|
||||
action = ">gv";
|
||||
}
|
||||
{
|
||||
mode = "v";
|
||||
key = "<S-Tab>";
|
||||
action = "<gv";
|
||||
}
|
||||
# Neotest
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>nr";
|
||||
action = mkRaw "require('neotest').run.run";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>no";
|
||||
action = mkRaw "require('neotest').output.open";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ns";
|
||||
action = mkRaw "require('neotest').run.stop";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>nf";
|
||||
action = mkRaw "function() require('neotest').run.run(vim.fn.expand('%')) end";
|
||||
}
|
||||
# LSP
|
||||
{
|
||||
mode = "n";
|
||||
key = "<M-CR>";
|
||||
action = ":Lspsaga code_action<CR>";
|
||||
}
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue