move nixvim keybinds to their own file when possible

This commit is contained in:
Anthony Rodriguez 2024-08-29 14:42:51 +02:00
parent 01e8251286
commit 7209d0eb3b
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
5 changed files with 90 additions and 69 deletions

View file

@ -13,6 +13,7 @@
./plugins/which-key.nix
./plugins/project-nvim.nix
./plugins/smart-splits.nix
./plugins/telescope.nix
./plugins/misc.nix
];

View file

@ -2,69 +2,12 @@
{
programs.nixvim.keymaps = [
{
action = "<cmd>Telescope find_files<CR>";
key = "<leader>ff";
options = {
desc = "Find files";
};
}
{
action = "<cmd>Telescope projects<CR>";
key = "<leader>fp";
options = {
desc = "Find projects";
};
}
{
action = "<cmd>Telescope buffers<CR>";
key = "<leader>fb";
options = {
desc = "Find buffers";
};
}
{
action = "<cmd>Neotree toggle<CR>";
key = "<leader>ft";
key = "<leader>t";
options = {
desc = "Toggle neo-tree";
desc = "Neotree";
};
}
{
action = ''
<cmd>lua vim.lsp.buf.code_action({ apply = true })<CR>
'';
key = "<leader>lc";
options = {
desc = "Apply code actions";
};
}
{
action = ''
<cmd>lua vim.lsp.buf.format()<CR>
'';
key = "<leader>lf";
options = {
desc = "Format buffer";
};
}
{
action = ''
<cmd>Telescope lsp_definitions<CR>
'';
key = "gd";
options = {
desc = "Go to definitions";
};
}
{
action = ''
<cmd>Telescope lsp_references<CR>
'';
key = "gr";
options = {
desc = "Go to references";
};
}
];
}

View file

@ -11,15 +11,6 @@
custom_captures = { };
enable = true;
};
incremental_selection = {
enable = true;
keymaps = {
init_selection = false;
node_decremental = "grm";
node_incremental = "grn";
scope_incremental = "grc";
};
};
indent = {
enable = true;
};
@ -37,6 +28,53 @@
nixd.enable = true;
lua-ls.enable = true;
};
keymaps = {
lspBuf = {
K = "hover";
gr = {
action = "references";
desc = "Go to references";
};
gi = {
action = "implementation";
desc = "Go to implementation";
};
gt = {
action = "type_definition";
desc = "Go to type definition";
};
};
extra = [
{
action = "<CMD>LspStop<Enter>";
key = "<leader>lx";
options = {
desc = "Stop LSP";
};
}
{
action = "<CMD>LspStart<Enter>";
key = "<leader>ls";
options = {
desc = "Start LSP";
};
}
{
action = "<CMD>LspRestart<Enter>";
key = "<leader>lr";
options = {
desc = "Restart LSP";
};
}
{
action = "<CMD>Telescope lsp_definitions<Enter>";
key = "gd";
options = {
desc = "Go to definitions";
};
}
];
};
};
cmp = {
enable = true;

View file

@ -0,0 +1,39 @@
{ ... }:
{
programs.nixvim.plugins.telescope = {
enable = true;
keymaps = {
"<C-p>" = {
action = "git_files";
options = {
desc = "Telescope Git Files";
};
};
"<leader>fg" = {
action = "live_grep";
options = {
desc = "Live grep";
};
};
"<leader>ff" = {
action = "find_files";
options = {
desc = "Find files";
};
};
"<leader>fp" = {
action = "projects";
options = {
desc = "Find projects";
};
};
"<leader>fb" = {
action = "buffers";
options = {
desc = "Find buffers";
};
};
};
};
}

View file

@ -20,7 +20,7 @@
spec = [
{
__unkeyed = "<leader>f";
group = "Find";
group = "Telescope";
}
{
__unkeyed = "<leader>l";