configuration.nix/nvim/mappings.nix

231 lines
4.9 KiB
Nix
Raw Permalink Normal View History

{
lib,
config,
helpers,
...
}:
let
[chore] flake.lock: update Also fix neovim errors Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/845a5c4c073f74105022533907703441e0464bc3?narHash=sha256-vWSkg6AMok1UUQiSYVdGMOXKD2cDFnajITiSi0Zjd1A%3D' (2024-06-04) → 'github:nix-community/home-manager/a1fddf0967c33754271761d91a3d921772b30d0e?narHash=sha256-BmO8d0r%2BBVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8%3D' (2024-06-16) • Updated input 'lix': 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/068576042b3b58f8180b24a36c07199a1a3fd380.tar.gz?narHash=sha256-/hsqsiw3p5qMpazedgFFZF2sQghbCJIoef7XCpegTXw%3D' (2024-06-13) → 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/e44dcd63c4d96807536cdcf2afb688a537cce9be.tar.gz?narHash=sha256-cAkgZoiP2eHB%2BV2cPJMcXACzdaWZIMgI5sg4vpH%2BDYo%3D' (2024-06-20) • Updated input 'lix-module': 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/4e25f1ab68f2270f9cff59216056c21073db0164.tar.gz?narHash=sha256-m8XYt8NU2T4gvkien7H7LFGXHhSA5z4tHOeuXQ3DJi4%3D' (2024-06-06) → 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/909e593ae9f5fe338ab19b4ed9d52bb0ea09bad8.tar.gz?narHash=sha256-DdcMvX9r29uHMlz7P1Shgs5xZw9WkZ4ObMGYzwROAiw%3D' (2024-06-19) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/ae5c8dcc4d0182d07d75df2dc97112de822cb9d6?narHash=sha256-SuPne4BMqh9/IkKIAG47Cu5qfmntAaqlHdX1yuFoDO0%3D' (2024-06-14) → 'github:NixOS/nixos-hardware/083823b7904e43a4fc1c7229781417e875359a42?narHash=sha256-hxQBUtDbFOCCW1CsFZTS9Q5Ov1ZKdJgbBZHSez1M6iA%3D' (2024-06-20) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/cc54fb41d13736e92229c21627ea4f22199fee6b?narHash=sha256-US1tAChvPxT52RV8GksWZS415tTS7PV42KTc2PNDBmc%3D' (2024-06-12) → 'github:NixOS/nixpkgs/dd457de7e08c6d06789b1f5b88fc9327f4d96309?narHash=sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4%3D' (2024-06-19) • Updated input 'nixvim': 'github:nix-community/nixvim/7a2a25af02be25987aa43cd681312f4b5ba12317?narHash=sha256-NIJZxmY2CWsqJK/9BQCRSHfcCY9K6thjq/1XtJobxmU%3D' (2024-06-14) → 'github:nix-community/nixvim/744dfea48bdd331e66b9e874822559fa6fae98af?narHash=sha256-artyEBzWUsNXtYj7jBr816wRJj2Y3DYDHw6ECrQotX0%3D' (2024-06-20) • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/1cb529bffa880746a1d0ec4e0f5076876af931f1?narHash=sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k%3D' (2024-06-11) → 'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81?narHash=sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls%3D' (2024-06-16) • Updated input 'unstable': 'github:NixOS/nixpkgs/e9ee548d90ff586a6471b4ae80ae9cfcbceb3420?narHash=sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY%3D' (2024-06-13) → 'github:NixOS/nixpkgs/c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e?narHash=sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak%3D' (2024-06-18)
2024-06-21 06:30:18 +02:00
inherit (helpers) mkRaw;
cfg = config.jhome.nvim;
dev = cfg.dev.enable;
in
{
config.keymaps =
[
# Quickfix
{
mode = "n";
key = "<leader>qo";
action = "<cmd>Copen<CR>";
options.desc = "Quickfix Open";
}
{
mode = "n";
key = "<leader>qq";
action = "<cmd>cclose<CR>";
options.desc = "Quickfix Quit";
}
{
mode = "n";
key = "<leader>qj";
action = "<cmd>cnext<CR>";
options.desc = "Quickfix next [J]";
}
{
mode = "n";
key = "<leader>qk";
action = "<cmd>cprev<CR>";
options.desc = "Quickfix previous [K]";
}
# Open or create file
{
mode = "n";
key = "<leader>gf";
action = "<cmd>e <cfile><CR>";
options.desc = "Go to File";
}
# Keep Selection when indenting
{
mode = "x";
key = ">";
action = ">gv";
options.desc = "Indent Selection";
}
{
mode = "x";
key = "<";
action = "<gv";
options.desc = "Deindent Selection";
}
# Diagnostics
{
mode = "n";
key = "<leader>dj";
action =
mkRaw
# lua
''
vim.diagnostic.goto_next
'';
options.desc = "Diagnostics next [J]";
}
{
mode = "n";
key = "<leader>dk";
action =
mkRaw
# lua
''
vim.diagnostic.goto_prev
'';
options.desc = "Diagnostics previous [K]";
}
{
mode = "n";
key = "<leader>xs";
action =
mkRaw
# lua
''
function() require('trouble').toggle_preview('symbols') end
'';
options.desc = "Toggle Diagnostics trouble";
}
{
mode = "n";
key = "<leader>xd";
action =
mkRaw
# lua
''
function() require('trouble').toggle_preview('diagnostics') end
'';
options.desc = "Toggle Diagnostics trouble";
}
{
mode = "n";
key = "<leader>xq";
action =
mkRaw
# lua
''
function() require('trouble').toggle_preview('quickfix') end
'';
options.desc = "Toggle Quickfix trouble";
}
{
mode = "n";
key = "<leader>xl";
action =
mkRaw
# lua
''
function() require('trouble').toggle_preview('loclist') end
'';
options.desc = "Toggle Loclist trouble";
}
{
mode = "n";
key = "gR";
action =
mkRaw
# lua
''
function() require('trouble').toggle_preview('lsp_references') end
'';
options.desc = "Toggle lsp References trouble";
}
# Telescope
{
mode = "n";
key = "<leader>ff";
action =
mkRaw
# lua
''
require('telescope.builtin').find_files
'';
options.desc = "Find Files";
}
{
mode = "n";
key = "<leader>fg";
action =
mkRaw
# lua
''
require('telescope.builtin').live_grep
'';
options.desc = "Find Grep";
}
{
mode = "n";
key = "<leader>fh";
action =
mkRaw
# lua
''
require('telescope.builtin').help_tags
'';
options.desc = "Find Help";
}
{
mode = "n";
key = "<leader>fb";
action =
mkRaw
# lua
''
require('telescope.builtin').buffers
'';
options.desc = "Find Buffer";
}
{
mode = "n";
key = "<leader>fd";
action =
mkRaw
# lua
''
require('telescope.builtin').diagnostics
'';
options.desc = "Find Diagnostics";
}
{
mode = "n";
key = "<leader>fq";
action =
mkRaw
# lua
''
require('telescope.builtin').quickfix
'';
options.desc = "Find Quickfix";
}
# Nvim Silicon
{
mode = "v";
key = "<leader>sc";
action =
mkRaw
# lua
''
require('nvim-silicon').clip
'';
options.desc = "Snap Code (to clipboard)";
}
]
++ lib.optional dev {
mode = "n";
key = "<leader>w";
action =
mkRaw
# lua
''
require('conform').format
'';
options.desc = "Format buffer";
};
}