1
0
Fork 0

nvim: use hover.nvim
All checks were successful
Build / build-arm64-linux (push) Successful in 8m14s
Build / build-amd64-linux (push) Successful in 20m50s

This commit is contained in:
Daniel Kempkens 2024-07-10 00:45:24 +02:00
parent 7268195f13
commit e5e206a0c0
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
7 changed files with 64 additions and 70 deletions

View file

@ -14,11 +14,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1718371084, "lastModified": 1720546205,
"narHash": "sha256-abpBi61mg0g+lFFU0zY4C6oP6fBwPzbHPKBGw676xsA=", "narHash": "sha256-boCXsjYVxDviyzoEyAk624600f3ZBo/DKtUdvMTpbGY=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "3a56735779db467538fb2e577eda28a9daacaca6", "rev": "de96bd907d5fbc3b14fc33ad37d1b9a3cb15edc6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -38,11 +38,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1717279440, "lastModified": 1720542474,
"narHash": "sha256-kH04ReTjxOpQumgWnqy40vvQLSnLGxWP6RF3nq5Esrk=", "narHash": "sha256-aKjJ/4l2I9+wNGTaOGRsuS3M1+IoTibqgEMPDikXm04=",
"owner": "zhaofengli", "owner": "zhaofengli",
"repo": "attic", "repo": "attic",
"rev": "717cc95983cdc357bc347d70be20ced21f935843", "rev": "6139576a3ce6bb992e0f6c3022528ec233e45f00",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -492,11 +492,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1720429258, "lastModified": 1720515935,
"narHash": "sha256-d6JI5IgJ1xdrk7DvYVx7y8ijcYz5I1nhCwOiDP6cq00=", "narHash": "sha256-8b+fzR4W2hI5axwB+4nBwoA15awPKkck4ghhCt8v39M=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "72d3c007024ce47d838bb38693c8773812f54bf2", "rev": "a111ce6b537df12a39874aa9672caa87f8677eda",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -508,11 +508,11 @@
}, },
"nixos-unstable": { "nixos-unstable": {
"locked": { "locked": {
"lastModified": 1720459846, "lastModified": 1720501375,
"narHash": "sha256-3gf8pkyp/yjFdLJo7PSQ/Vmta9QBPWfKs5SFc/wh3h4=", "narHash": "sha256-+uhyVoqSWA3+dQAeeWwovRmoD9eeqCWaAnpOuuqalNk=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c030874db3ce4ff192aabf059988ed1be95d167a", "rev": "bb1588c3045cfdc18154cb45a2f2186122cbbad8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -524,11 +524,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1720368505, "lastModified": 1720498663,
"narHash": "sha256-5r0pInVo5d6Enti0YwUSQK4TebITypB42bWy5su3MrQ=", "narHash": "sha256-juqJkkdAt44mOfA43q1qUHn7iWoK++81lR8Mh7N/EF8=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ab82a9612aa45284d4adf69ee81871a389669a9e", "rev": "106e145e1d4583d1e2bb20e54947d15ad55e75e1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -568,16 +568,16 @@
}, },
"nixpkgs-stable_2": { "nixpkgs-stable_2": {
"locked": { "locked": {
"lastModified": 1718811006, "lastModified": 1720386169,
"narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=", "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "03d771e513ce90147b65fe922d87d3a0356fc125", "rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.11", "ref": "nixos-24.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -617,11 +617,11 @@
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
"lastModified": 1720450253, "lastModified": 1720524665,
"narHash": "sha256-1in42htN3g3MnE3/AO5Qgs6pMWUzmtPQ7s675brO8uw=", "narHash": "sha256-ni/87oHPZm6Gv0ECYxr1f6uxB0UKBWJ6HvS7lwLU6oY=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "2b6bd3c87d3a66fb0b8f2f06c985995e04b4fb96", "rev": "8d6a17d0cdf411c55f12602624df6368ad86fac1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -738,11 +738,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1720436211, "lastModified": 1720507012,
"narHash": "sha256-/cKXod0oGLl+vH4bKBZnTV3qxrw4jgOLnyQ8KXey5J8=", "narHash": "sha256-QIeZ43t9IVB4dLsFaWh2f4C7JSRfK7p+Y1U9dULsLXU=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "6fc8bded78715cdd43a3278a14ded226eb3a239e", "rev": "8b63fe8cf7892c59b3df27cbcab4d5644035d72f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -7,6 +7,7 @@
telescope-ivy (telescope-themes.get_ivy) telescope-ivy (telescope-themes.get_ivy)
telescope-dropdown (telescope-themes.get_dropdown) telescope-dropdown (telescope-themes.get_dropdown)
npairs (require :nvim-autopairs) npairs (require :nvim-autopairs)
hover (require :hover)
gitsigns (require :gitsigns) gitsigns (require :gitsigns)
neogit (require :neogit) neogit (require :neogit)
wk (require :which-key) wk (require :which-key)
@ -89,6 +90,9 @@
(keymap.set :n :y "<Plug>(YankyYank)") (keymap.set :n :y "<Plug>(YankyYank)")
(keymap.set :x :y "<Plug>(YankyYank)") (keymap.set :x :y "<Plug>(YankyYank)")
(keymap.set :n "-" :<cmd>Oil<CR> {:desc "Open Oil"}) (keymap.set :n "-" :<cmd>Oil<CR> {:desc "Open Oil"})
;; hover.nvim
(keymap.set :n :K hover.hover {:desc "Show Documentation"})
(keymap.set :n :gK hover.hover_select {:desc "hover.nvim selection"})
;; Label ;; Label
(wk.register {:<leader>v {:name :+vcs} (wk.register {:<leader>v {:name :+vcs}
:<leader>l {:name :+list/lsp} :<leader>l {:name :+list/lsp}
@ -116,9 +120,7 @@
{:buffer bufnr :desc "Find Definitions"}) {:buffer bufnr :desc "Find Definitions"})
(keymap.set :n :<leader>lfi (keymap.set :n :<leader>lfi
#(telescope-builtin.lsp_implementations telescope-dropdown) #(telescope-builtin.lsp_implementations telescope-dropdown)
{:buffer bufnr :desc "Find Implementations"}) {:buffer bufnr :desc "Find Implementations"}))
(keymap.set :n :K vim.lsp.buf.hover
{:buffer bufnr :desc "Show Documentation"}))
(fn mod.terminal-open [bufnr] (fn mod.terminal-open [bufnr]
(let [map-opts {:buffer bufnr}] (let [map-opts {:buffer bufnr}]

View file

@ -0,0 +1,8 @@
(let [hover (require :hover)]
(hover.setup {:init #(do
(require :hover.providers.lsp)
(require :hover.providers.diagnostic))
:preview_opts {:border :single}
:preview_window false
:title true
:mouse_providers []}))

View file

@ -100,38 +100,4 @@
(lsp.yamlls.setup (->> {:settings {:yaml {:schemaStore {:enable false (lsp.yamlls.setup (->> {:settings {:yaml {:schemaStore {:enable false
:url ""} :url ""}
:schemas (schemastore.yaml.schemas)}}} :schemas (schemastore.yaml.schemas)}}}
(vim.tbl_extend :force default-config)))) (vim.tbl_extend :force default-config)))))
;; Hacks
(fn add-inline-highlights [bufnr]
(let [lines (vim.api.nvim_buf_get_lines bufnr 0 -1 false)
mapping {"@%S+" "@parameter"
"^%s*(Parameters:)" "@text.title"
"^%s*(Return:)" "@text.title"
"^%s*(See also:)" "@text.title"
"{%S-}" "@parameter"
"|%S-|" "@text.reference"}]
(each [l line (ipairs lines)]
(each [pattern hl_group (pairs mapping)]
(var from 1)
(while from
(var to nil)
(set (from to) (line:find pattern from))
(when from
(vim.api.nvim_buf_set_extmark bufnr ns (- l 1) (- from 1)
{:end_col to : hl_group}))
(set from (if to (+ to 1) nil)))))))
;; https://github.com/MariaSolOs/dotfiles/blob/b4516aa30c2912011a7b9c9857f01dee1ba5b57f/.config/nvim/lua/lsp.lua#L260C1-L260C1
(set vim.lsp.util.stylize_markdown
(fn [bufnr raw-contents opts]
(var contents raw-contents)
(set contents
(vim.lsp.util._normalize_markdown contents
{:width (vim.lsp.util._make_floating_popup_size contents
opts)}))
(tset vim :bo bufnr :filetype :markdown)
(vim.treesitter.start bufnr)
(vim.api.nvim_buf_set_lines bufnr 0 -1 false contents)
(add-inline-highlights bufnr)
contents)))

View file

@ -270,6 +270,12 @@ in
type = "fennel"; type = "fennel";
} }
{
plugin = hover-nvim;
config = builtins.readFile ../../config/nvim/plugins/hover.fnl;
type = "fennel";
}
{ {
plugin = gitsigns-nvim; plugin = gitsigns-nvim;
config = builtins.readFile ../../config/nvim/plugins/gitsigns.fnl; config = builtins.readFile ../../config/nvim/plugins/gitsigns.fnl;

View file

@ -40,7 +40,7 @@ in
}; };
wezterm-nvim = buildVimPlugin { wezterm-nvim = buildVimPlugin {
pname = "wezterm.nvim"; pname = "wezterm.nvim";
version = "2024-06-01"; version = "2024-06-02";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "willothy"; owner = "willothy";
repo = "wezterm.nvim"; repo = "wezterm.nvim";
@ -121,8 +121,8 @@ in
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "nvim-treesitter"; owner = "nvim-treesitter";
repo = "nvim-treesitter"; repo = "nvim-treesitter";
rev = "53c79ddc28b0df3263d629f5e20c9283b05841ca"; rev = "c1ad655b6a0c83ab48e55240f367e2bc0c15af31";
sha256 = "110m9gpgzdqk5lgfcsybgxzka82lxjmkymdgwa1m5fw80hm6y6a9"; sha256 = "0qcl97gzxc0i0nz988nwhfjcphvajsmf50jdnd5glqf0ai1ghbpy";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -414,7 +414,7 @@ in
}; };
oil-nvim = buildVimPlugin { oil-nvim = buildVimPlugin {
pname = "oil.nvim"; pname = "oil.nvim";
version = "2024-07-06"; version = "2024-07-07";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "stevearc"; owner = "stevearc";
repo = "oil.nvim"; repo = "oil.nvim";
@ -467,14 +467,25 @@ in
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
hover-nvim = buildVimPlugin {
pname = "hover.nvim";
version = "2024-06-12";
src = fetchFromGitHub {
owner = "lewis6991";
repo = "hover.nvim";
rev = "4339cbbcb572b1934c53dcb66ad4bf6a0abb7918";
sha256 = "1nnhm8xhkdjvqal7016v22cljhpga8y0mydmvalz954cviskhna3";
fetchSubmodules = false;
};
};
gitsigns-nvim = buildVimPlugin { gitsigns-nvim = buildVimPlugin {
pname = "gitsigns.nvim"; pname = "gitsigns.nvim";
version = "2024-07-07"; version = "2024-07-09";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "lewis6991"; owner = "lewis6991";
repo = "gitsigns.nvim"; repo = "gitsigns.nvim";
rev = "220446c8c86a280180d852efac60991eaf1a21d4"; rev = "375c44bdfdde25585466a966f00c2e291db74f2d";
sha256 = "0mrslcm75mnds7jklhd7rn4h02sa8ifbqw04qahb7mqgylrzg07i"; sha256 = "18vi0ms8gz17vz6rq0pil7rybpjp6nx4jmf2ywhnh1xy08yn5zim";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };

View file

@ -54,6 +54,7 @@
- src: lukas-reineke/indent-blankline.nvim - src: lukas-reineke/indent-blankline.nvim
- src: lukas-reineke/virt-column.nvim - src: lukas-reineke/virt-column.nvim
- src: axieax/urlview.nvim - src: axieax/urlview.nvim
- src: lewis6991/hover.nvim
- src: lewis6991/gitsigns.nvim - src: lewis6991/gitsigns.nvim
- src: sindrets/diffview.nvim - src: sindrets/diffview.nvim
- src: NeogitOrg/neogit - src: NeogitOrg/neogit