From 38d010650f6373b30c3b34cb276ee84c21c976e4 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Tue, 27 Dec 2022 11:45:35 +0100 Subject: [PATCH] Improve nvim lsp hover popup, add difftastic --- git/.gitconfig | 8 ++++++- nixpkgs/.config/nixpkgs/modules/base.nix | 1 - nvim/.config/nvim/fnl/dots/plugins.fnl | 7 ++++++ nvim/.config/nvim/fnl/dots/plugins/lsp.fnl | 25 +++++++++++++++++----- zsh/.config/zsh/abbreviations | 1 + 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/git/.gitconfig b/git/.gitconfig index 1a08b97..e369a61 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -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 diff --git a/nixpkgs/.config/nixpkgs/modules/base.nix b/nixpkgs/.config/nixpkgs/modules/base.nix index f524485..197af8f 100644 --- a/nixpkgs/.config/nixpkgs/modules/base.nix +++ b/nixpkgs/.config/nixpkgs/modules/base.nix @@ -57,7 +57,6 @@ in ripgrep fd jq - nodejs nodePackages.bash-language-server nodePackages.dockerfile-language-server-nodejs cargo-outdated diff --git a/nvim/.config/nvim/fnl/dots/plugins.fnl b/nvim/.config/nvim/fnl/dots/plugins.fnl index 9043fde..006e493 100644 --- a/nvim/.config/nvim/fnl/dots/plugins.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins.fnl @@ -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")} diff --git a/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl b/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl index 88eff73..790ac34 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl @@ -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=<<<<<,>>>>> diff --git a/zsh/.config/zsh/abbreviations b/zsh/.config/zsh/abbreviations index 6348f7d..ed0cf9a 100644 --- a/zsh/.config/zsh/abbreviations +++ b/zsh/.config/zsh/abbreviations @@ -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"