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

View file

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

View file

@ -102,6 +102,13 @@
; >>> ; >>>
; git stuff <<< ; 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"] :sindrets/diffview.nvim {:cmd ["DiffviewOpen" "DiffviewToggleFiles"]
:config #(require "dots.plugins.diffview")} :config #(require "dots.plugins.diffview")}

View file

@ -54,7 +54,7 @@
(def default-capabilities (def default-capabilities
(let [capabilities (vim.lsp.protocol.make_client_capabilities)] (let [capabilities (vim.lsp.protocol.make_client_capabilities)]
(set capabilities.textDocument.completion.completionItem.snippetSupport true) (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] (fn init-lsp [lsp-name ?opts]
"initialize a language server with defaults" "initialize a language server with defaults"
@ -102,10 +102,10 @@
:less {:validate true} :less {:validate true}
:scss {:validate true}}}) :scss {:validate true}}})
;(lsp.tsserver.setup {:root_dir (lsp.util.root_pattern "package.json") (lsp.tsserver.setup {:root_dir (lsp.util.root_pattern "package.json")
;:on_attach (fn [client bufnr] :on_attach (fn [client bufnr]
;(set client.resolved_capabilities.document_formatting false) (set client.resolved_capabilities.document_formatting false)
;(on_attach client bufnr))}) (on_attach client bufnr))})
(let [rust-tools (require "rust-tools") (let [rust-tools (require "rust-tools")
@ -232,6 +232,21 @@
(set vim.opt.signcolumn "yes") (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=<<<<<,>>>>> ; vim:foldmarker=<<<<<,>>>>>

View file

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