about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-26 13:18:16 +0200
committerSoispha <soispha@vhack.eu>2023-08-26 13:18:47 +0200
commitfc10340dcb5e0e3ed77e0ca741df900fb5e9659b (patch)
treedbf6201ce49d6b08277014e104c3dc71b945b164
parentFix(hm/conf/neovim/plugins/lsp-progress): Disable as its quite distracting (diff)
downloadnixos-config-fc10340dcb5e0e3ed77e0ca741df900fb5e9659b.tar.gz
nixos-config-fc10340dcb5e0e3ed77e0ca741df900fb5e9659b.zip
Feat(hm/conf/neovim/plugins/goto-preview): Init
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/default.nix1
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/default.nix42
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/lua/goto-preview.lua21
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/telescope/keymaps/default.nix16
4 files changed, 64 insertions, 16 deletions
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/default.nix
index f92e11a8..d80c9d63 100644
--- a/home-manager/soispha/config/neovim/nixvim/plugins/default.nix
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/default.nix
@@ -2,6 +2,7 @@
   imports = [
     ./colorscheme
     ./femaco
+    ./goto-preview
     ./harpoon
     ./leap
     ./lf-nvim
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/default.nix
new file mode 100644
index 00000000..ea89b045
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/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";
+      };
+    };
+  };
+}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/lua/goto-preview.lua b/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/lua/goto-preview.lua
new file mode 100644
index 00000000..a3e55a5a
--- /dev/null
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/lua/goto-preview.lua
@@ -0,0 +1,21 @@
+require('goto-preview').setup {
+    width = 120, -- Width of the floating window
+    height = 15, -- Height of the floating window
+    border = { "↖", "─", "┐", "│", "┘", "─", "└", "│" }, -- Border characters of the floating window
+    default_mappings = false, -- Bind default mappings
+    debug = false, -- Print debug information
+    opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent.
+    resizing_mappings = false, -- Binds arrow keys to resizing the floating window.
+    post_open_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook.
+    post_close_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook.
+    references = { -- Configure the telescope UI for slowing the references cycling window.
+        telescope = {} -- require("telescope.themes").get_dropdown({ hide_preview = false })
+    },
+    -- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality.
+    focus_on_open = true,                                      -- Focus the floating window when opening it.
+    dismiss_on_move = false,                                   -- Dismiss the floating window when moving the cursor.
+    force_close = true,                                        -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close
+    bufhidden = "wipe",                                        -- the bufhidden option to set on the floating window. See :h bufhidden
+    stack_floating_preview_windows = true,                     -- Whether to nest floating windows
+    preview_window_title = { enable = true, position = "left" }, -- Whether to set the preview window title as the filename
+}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/telescope/keymaps/default.nix b/home-manager/soispha/config/neovim/nixvim/plugins/telescope/keymaps/default.nix
index f967a739..f0745f73 100644
--- a/home-manager/soispha/config/neovim/nixvim/plugins/telescope/keymaps/default.nix
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/telescope/keymaps/default.nix
@@ -4,21 +4,5 @@
       action = "live_grep";
       desc = "[rg] in a live session";
     };
-    "<space>gd" = {
-      action = "lsp_definitions";
-      desc = "[G]oto [D]efinition (Telescope)";
-    };
-    "<space>gtd" = {
-      action = "lsp_type_definitions";
-      desc = "[G]oto the [t]ype [D]efinition (Telescope)";
-    };
-    "<space>gi" = {
-      action = "lsp_implementations";
-      desc = "[G]oto [I]mplementations (Telescope)";
-    };
-    "<space>gr" = {
-      action = "lsp_references";
-      desc = "[G]o to all [R]eferences of the symbol (Telescope)";
-    };
   };
 }