From a309cf3fb3fe802064479394b8b0851a7a117ebf Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 21 Dec 2022 21:43:00 +1000 Subject: [PATCH] nicer lsp --- home/profiles/nvim/default.nix | 101 +++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 36 deletions(-) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 8ef77295..075e4e96 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -19,6 +19,15 @@ let sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4="; }; }; + my-lspsaga = pkgs.vimUtils.buildVimPluginFrom2Nix { + name = "lspsaga.nvim"; + src = pkgs.fetchFromGitHub { + owner = "glepnir"; + repo = "lspsaga.nvim"; + rev = "b7b4777369b441341b2dcd45c738ea4167c11c9e"; + sha256 = "sciX/fMxzY1YOxXxjj1+ymrdMi451avcFFu+14R+/pk="; + }; + }; nvim-luapad = pkgs.vimUtils.buildVimPluginFrom2Nix { name = "nvim-luapad"; src = pkgs.fetchFromGitHub { @@ -57,16 +66,6 @@ let }; meta.homepage = "https://github.com/folke/which-key.nvim/"; }; - my-conjure = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "conjure"; - version = "2022-05-04"; - src = pkgs.fetchFromGitHub { - owner = "olical"; - repo = "conjure"; - rev = "2e7f449d06753f2996e186954e96afc60edd5862"; - sha256 = "ZV0vPYiZI5/3Isw2l7rrLuiO+kA9G0vrA6OxHFkLTFw="; - }; - }; scnvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "scnvim"; version = "2022-06-04"; @@ -261,6 +260,8 @@ in " Sexp in Conjure (since it's fennel) let g:sexp_filetypes = "clojure,scheme,lisp,janet,fennel,yuck" let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" + " let g:conjure#extract#tree_sitter#enabled = true + map lt :ConjureLogToggle let g:rainbow_active = 0 autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll @@ -338,23 +339,25 @@ in let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } } " lsp commands - nnoremap vd :lua vim.lsp.buf.definition() + " nnoremap vd :lua vim.lsp.buf.definition() nnoremap vi :lua require('telescope.builtin').lsp_implementation() nnoremap vsh :lua vim.lsp.buf.signature_help() nnoremap vrr :lua require('telescope.builtin').lsp_references() - nnoremap vrn :lua vim.lsp.buf.rename() - nnoremap vh :lua vim.lsp.buf.hover() - nnoremap vca :lua vim.lsp.buf.code_action() - nnoremap vsd :lua vim.lsp.util.show_line_diagnostics() - nnoremap vn :lua vim.lsp.diagnostic.goto_next() - nnoremap va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor()) + " nnoremap vrn :lua vim.lsp.buf.rename() + " nnoremap vh :lua vim.lsp.buf.hover() + " nnoremap vca :lua vim.lsp.buf.code_action() + " nnoremap vsd :lua vim.lsp.util.show_line_diagnostics() + " nnoremap vn :lua vim.lsp.diagnostic.goto_next() + " nnoremap va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor()) " lspsaga stuff doesn't work - " nnoremap vd :call Lspsaga peek_definition - " nnoremap vrn :call Lspsaga rename - " nnoremap vh :call Lspsaga hover_doc - " nnoremap vca :call Lspsaga code_action - " nnoremap vsd :call Lspsaga show_line_diagnostics - " nnoremap vn :call Lspsaga diagnostic_jump_prev + nnoremap vd :Lspsaga peek_definition + nnoremap vrn :Lspsaga rename + nnoremap vh :Lspsaga hover_doc + nnoremap vca :Lspsaga code_action + nnoremap vsd :Lspsaga show_line_diagnostics + nnoremap vs :Dasht + nnoremap vn :Lspsaga diagnostic_jump_prev + nnoremap vo :LSoutlineToggle " dashboard let g:dashboard_custom_header = [ @@ -582,18 +585,37 @@ in local navic = require("nvim-navic") -- lspsaga, code_action lightbulb is annoying - -- local saga = require('lspsaga') - -- saga.init_lsp_saga({ - -- code_action_lightbulb = { - -- enable = true, - -- enable_in_insert = true, - -- cache_code_action = true, - -- sign = true, - -- update_time = 150, - -- sign_priority = 4, - -- virtual_text = false, - -- }, - -- }) + local saga = require('lspsaga') + saga.init_lsp_saga({ + border_style = "rounded", + code_action_icon = "", + code_action_num_shortcut = true, + code_action_lightbulb = { + enable = false, + enable_in_insert = false, + cache_code_action = true, + sign = true, + update_time = 150, + sign_priority = 20, + virtual_text = false, + }, + code_action_keys = { + quit = 'q', + exec = '', + }, + -- show outline + show_outline = { + win_position = 'right', + --set special filetype win that outline window split.like NvimTree neotree + -- defx, db_ui + auto_enter = true, + auto_preview = true, + virt_text = '┃', + jump_key = 'o', + -- auto refresh when change buffer + auto_refresh = true, + }, + }) local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) @@ -806,6 +828,11 @@ in } require('twilight').setup{} + -- hologram + require('hologram').setup{ + auto_display = true -- WIP automatic markdown image display, may be prone to breaking + } + EOF ''; @@ -855,7 +882,8 @@ in nvim-peekup zen-mode-nvim twilight-nvim - lspsaga-nvim + my-lspsaga + vim-dasht # language vim-nix @@ -870,6 +898,7 @@ in vimwiki taskwiki vim-zettel + hologram-nvim # lsp stuff # nvim-lint