From d2d7afd3679f3e9b1d2b4a166bf747321e3b3070 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Thu, 6 May 2021 20:54:55 +0200 Subject: [PATCH] Lazy-load telescope --- files/.config/nvim/fnl/init.fnl | 10 ++++++++-- files/.config/nvim/fnl/keybinds.fnl | 2 ++ files/.config/nvim/fnl/plugins/lsp.fnl | 22 +++++++++++++--------- files/.config/nvim/plugins.lua | 11 +++++++++-- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/files/.config/nvim/fnl/init.fnl b/files/.config/nvim/fnl/init.fnl index 37c6109..e155a9e 100644 --- a/files/.config/nvim/fnl/init.fnl +++ b/files/.config/nvim/fnl/init.fnl @@ -9,11 +9,17 @@ (macro make-errors-epic [f] `(xpcall #,f #(a.println (fennel.traceback $1)))) + (make-errors-epic (require "plugins.lsp")) (make-errors-epic (require "keybinds")) -(pkg telescope.nvim [] - (make-errors-epic (require "plugins.telescope"))) + +; called from packer config +(fn _G.load_telescope [] + (require "plugins.telescope")) +;(pkg telescope.nvim [] + ;(make-errors-epic (require "plugins.telescope")))) + (pkg galaxyline.nvim [] (make-errors-epic (require "plugins.galaxyline"))) (pkg nvim-bufferline.lua [] diff --git a/files/.config/nvim/fnl/keybinds.fnl b/files/.config/nvim/fnl/keybinds.fnl index 640789b..5bfba6f 100644 --- a/files/.config/nvim/fnl/keybinds.fnl +++ b/files/.config/nvim/fnl/keybinds.fnl @@ -13,6 +13,8 @@ (utils.keymap :i : "compe#close('')" {:expr true}) +(utils.keymap :n : "Telescope find_files") + (fn cmd [s desc] [(.. "" s "") desc]) diff --git a/files/.config/nvim/fnl/plugins/lsp.fnl b/files/.config/nvim/fnl/plugins/lsp.fnl index 73c4101..a297d59 100644 --- a/files/.config/nvim/fnl/plugins/lsp.fnl +++ b/files/.config/nvim/fnl/plugins/lsp.fnl @@ -48,16 +48,23 @@ ((. lsp lsp-name :setup) merged-opts))) + + (let [capabilities (vim.lsp.protocol.make_client_capabilities)] (set capabilities.textDocument.completion.completionItem.snippetSupport true) (set capabilities.textDocument.completion.completionItem.resolveSupport - { :properties ["documentation" "detail" "additionalTextEdits"]}) - (init-lsp :rust_analyzer { :capabilities capabilities})) + {:properties ["documentation" "detail" "additionalTextEdits"]}) + (lsp.rust_analyzer.setup + {:capabilities capabilities + :on_attach (fn [...] + (on_attach ...) + (pkg rust-tools.nvim [rust-tools (require "rust-tools")] + (rust-tools.setup { :tools { :inlay_hints { :show_parameter_hints false}}})))})) -(init-lsp :tsserver { :root_dir (lsp.util.root_pattern "package.json")}) -(init-lsp :jsonls { :commands { :Format [ #(vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0])]}}) -(init-lsp :denols { :root_dir (better_root_pattern [".git"] ["package.json"])}) -(init-lsp :hls { :settings { :languageServerHaskell { :formattingProvider "stylish-haskell"}}}) +(init-lsp :tsserver {:root_dir (lsp.util.root_pattern "package.json")}) +(init-lsp :jsonls {:commands {:Format [ #(vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0])]}}) +(init-lsp :denols {:root_dir (better_root_pattern [".git"] ["package.json"])}) +(init-lsp :hls {:settings {:languageServerHaskell {:formattingProvider "stylish-haskell"}}}) (init-lsp :ocamllsp) (init-lsp :vimls) (init-lsp :bashls) @@ -170,9 +177,6 @@ ; >>>>> -(pkg rust-tools.nvim [rust-tools (require "rust-tools")] - (rust-tools.setup { :tools { :inlay_hints { :show_parameter_hints false}}})) - (set vim.o.signcolumn "yes") diff --git a/files/.config/nvim/plugins.lua b/files/.config/nvim/plugins.lua index 57a439f..8718763 100644 --- a/files/.config/nvim/plugins.lua +++ b/files/.config/nvim/plugins.lua @@ -50,7 +50,7 @@ require("packer").startup(function(use) use { "Olical/aniseed", - tag = "v3.16.0" + --tag = "v3.16.0" } -- general purpose lua wrappers for nvim stuff @@ -151,7 +151,14 @@ require("packer").startup(function(use) use "nvim-lua/popup.nvim" use "nvim-lua/plenary.nvim" - use "nvim-telescope/telescope.nvim" + + use { + "nvim-telescope/telescope.nvim", + cmd = { "Telescope" }, + config = function() + _G.load_telescope() + end + } --use "RishabhRD/popfix" --use "RishabhRD/nvim-lsputils"