about summary refs log tree commit diff stats
path: root/hm/soispha/conf/nvim/plugins/goto-preview/default.nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-26 23:42:21 +0200
committerSoispha <soispha@vhack.eu>2023-08-26 23:42:21 +0200
commit3f600ab07dbad3b6dd7655587ddea158b19aea71 (patch)
tree7164ccd965e1d14ade970aeb8eb188b1442a6c91 /hm/soispha/conf/nvim/plugins/goto-preview/default.nix
parentStyle(treewide): Format all lua-files makes lua ➛ nix easier (diff)
downloadnixos-config-3f600ab07dbad3b6dd7655587ddea158b19aea71.zip
Refactor(treewide): Abbreviate path names
Diffstat (limited to 'hm/soispha/conf/nvim/plugins/goto-preview/default.nix')
-rw-r--r--hm/soispha/conf/nvim/plugins/goto-preview/default.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/hm/soispha/conf/nvim/plugins/goto-preview/default.nix b/hm/soispha/conf/nvim/plugins/goto-preview/default.nix
new file mode 100644
index 00000000..740bb04c
--- /dev/null
+++ b/hm/soispha/conf/nvim/plugins/goto-preview/default.nix
@@ -0,0 +1,42 @@
+{
+  pkgs,
+  lib,
+  ...
+}: {
+  programs.nixvim = {
+    # TODO: package goto-preview though a module
+    extraConfigLuaPost = ''
+      ${lib.strings.fileContents ./lua/goto-preview.lua}
+    '';
+    extraPlugins = [
+      pkgs.vimExtraPlugins.goto-preview
+    ];
+    maps.normal = {
+      "<space>gd" = {
+        action = "require('goto-preview').goto_preview_definition";
+        lua = true;
+        desc = "[G]oto [D]efinition";
+      };
+      "<space>gtd" = {
+        action = "require('goto-preview').goto_preview_type_definition";
+        lua = true;
+        desc = "[G]oto the [t]ype [D]efinition";
+      };
+      "<space>gi" = {
+        action = "require('goto-preview').goto_preview_implementation";
+        lua = true;
+        desc = "[G]oto [I]mplementations";
+      };
+      "<space>gr" = {
+        action = "require('goto-preview').goto_preview_references";
+        lua = true;
+        desc = "[G]o to all [R]eferences of the symbol";
+      };
+      "\\<space>" = {
+        action = "require('goto-preview').close_all_win";
+        lua = true;
+        desc = "close all preview windows";
+      };
+    };
+  };
+}