Improve nvim lsp hover popup, add difftastic

This commit is contained in:
elkowar 2022-12-27 11:45:35 +01:00
parent 1d20c25d24
commit 38d010650f
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
5 changed files with 35 additions and 7 deletions

View file

@ -6,12 +6,15 @@
helper = store
[core]
autocrlf = input
pager = delta
;pager = delta
[pull]
rebase = false
[github]
user = ElKowar
[diff]
external = "difft"
[delta]
syntax-theme = gruvbox
@ -37,3 +40,6 @@
dn = diff --numstat
ss = status
a = add
[push]
autoSetupRemote = true
default = current

View file

@ -57,7 +57,6 @@ in
ripgrep
fd
jq
nodejs
nodePackages.bash-language-server
nodePackages.dockerfile-language-server-nodejs
cargo-outdated

View file

@ -102,6 +102,13 @@
; >>>
; git stuff <<<
:ldelossa/gh.nvim {:config #(do ((. (require "litee.lib") :setup))
((. (require "litee.gh") :setup)))
:requires [:ldelossa/litee.nvim]}
:pwntester/octo.nvim {:requires [:nvim-lua/plenary.nvim
:nvim-telescope/telescope.nvim
:kyazdani42/nvim-web-devicons]
:config #((. (require "octo") :setup))}
:sindrets/diffview.nvim {:cmd ["DiffviewOpen" "DiffviewToggleFiles"]
:config #(require "dots.plugins.diffview")}

View file

@ -54,7 +54,7 @@
(def default-capabilities
(let [capabilities (vim.lsp.protocol.make_client_capabilities)]
(set capabilities.textDocument.completion.completionItem.snippetSupport true)
(cmp_nvim_lsp.update_capabilities capabilities)))
(cmp_nvim_lsp.default_capabilities capabilities)))
(fn init-lsp [lsp-name ?opts]
"initialize a language server with defaults"
@ -102,10 +102,10 @@
:less {:validate true}
:scss {:validate true}}})
;(lsp.tsserver.setup {:root_dir (lsp.util.root_pattern "package.json")
;:on_attach (fn [client bufnr]
;(set client.resolved_capabilities.document_formatting false)
;(on_attach client bufnr))})
(lsp.tsserver.setup {:root_dir (lsp.util.root_pattern "package.json")
:on_attach (fn [client bufnr]
(set client.resolved_capabilities.document_formatting false)
(on_attach client bufnr))})
(let [rust-tools (require "rust-tools")
@ -232,6 +232,21 @@
(set vim.opt.signcolumn "yes")
; Cleanup links in markdown documentation
(defn- cleanup-markdown [contents]
(if (= contents.kind "markdown")
(tset contents :value (string.gsub contents.value "%[([^%]]+)%]%(([^%)]+)%)" "[%1]")))
contents)
(let [previous-handler (. vim.lsp.handlers :textDocument/hover)]
(tset vim.lsp.handlers :textDocument/hover
(fn [a result b c]
(if (not (and result result.contents))
(previous-handler a result b c)
(let [new-contents (cleanup-markdown result.contents)]
(tset result :contents new-contents)
(previous-handler a result b c))))))
; vim:foldmarker=<<<<<,>>>>>

View file

@ -1,4 +1,5 @@
abbr cvim="cd ~/.config/nvim && nvim && cd -"
abbr cnt="cargo nextest run"
abbr cnix="cd ~/.config/nixpkgs && nvim && cd -"
abbr cxmonad="cd ~/.xmonad && nvim lib/Config.hs && cd -"
abbr ra="ranger"