From 4ecf95bcf1c387d1ede7bf8bf2b27132cb6ae982 Mon Sep 17 00:00:00 2001 From: spike Date: Fri, 9 Sep 2022 20:52:07 +0200 Subject: [PATCH] stable lsp colors + signature + misc updates --- .gitignore | 2 +- TODO | 19 ++- init.lua | 1 + lua/core/mappings.lua | 129 ++++++++++++++----- lua/core/options.lua | 7 +- lua/custom/chadrc.lua | 54 ++++++++ lua/custom/init.lua | 9 +- lua/custom/plugins/configs/lsp_signature.lua | 18 +++ lua/custom/plugins/configs/navigator.lua | 72 +++++++---- lua/custom/plugins/init.lua | 111 ++++++++++++++-- lua/custom/plugins/nvchadui.lua | 48 +++++++ lua/plugins/configs/cmp.lua | 1 - lua/plugins/configs/others.lua | 5 +- lua/sp4ke/lsp.lua | 14 ++ lua/sp4ke/utils.lua | 22 ++++ plugin/after/highlight.vim | 11 ++ plugin/after/info.vim | 16 +++ plugin/after/sneak.vim | 2 + 18 files changed, 458 insertions(+), 83 deletions(-) create mode 100644 lua/custom/plugins/configs/lsp_signature.lua create mode 100644 lua/custom/plugins/nvchadui.lua create mode 100644 lua/sp4ke/lsp.lua create mode 100644 lua/sp4ke/utils.lua create mode 100644 plugin/after/highlight.vim create mode 100644 plugin/after/info.vim create mode 100644 plugin/after/sneak.vim diff --git a/.gitignore b/.gitignore index 3e94254..d8cc673 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -plugin +plugin/*compiled.lua spell examples diff --git a/TODO b/TODO index e4b4855..c70ec04 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,18 @@ -- [navigator] sync icons between navigator and nvchad lspconfig +- set neovim shell to bash/sh for faster commands (fish is slow) + see https://www.reddit.com/r/neovim/comments/opipij/guide_tips_and_tricks_to_reduce_startup_and/ +- yank until end of line $ mapping +- remove registers from which-key plugin +- fix color/icon of status line diagnostics to match navigator +- pin all plugins +- autocommand move current directory when move to new window +- add/read language docs in vim +- vim.diagnostics.hide()/show() / + - create toggle diagnostics that overrides vim diagnostic show handler +- [navigator] use colors for codelens icons +- [navigator] remap C-k keymap +- [navigator] neovim diagnositc toggle (use hide() instead of disable) +- [navigator] check codelens icons - [navigator] disable diagnostic on startup -- [navigator] manually setup all keymaps - dynamic C-x: if number default or close window - load custom/init.lua (autocommands) as vimscript file ? - install neorg (neovim org mode) @@ -8,3 +20,6 @@ [x] [navigator] fix 'gi' keymap overriden by navigator (use space leader) - welcome screen (use mini) - incorporate changes in nvchad_ui to override + +- [x]nvim C-p should not work in ft=qf + diff --git a/init.lua b/init.lua index 1c19c3f..c3f394b 100644 --- a/init.lua +++ b/init.lua @@ -11,6 +11,7 @@ require("core.utils").load_mappings() local fn = vim.fn local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" + if fn.empty(fn.glob(install_path)) > 0 then vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) print "Cloning packer .." diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index dbec5db..92fc033 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: trailing-space -- vim: foldmethod=marker foldlevel=0 -- n, v, i, t, c = mode name.s @@ -8,7 +9,7 @@ end local M = {} M.general = { --{{{ - i = { + i = {--{{{ ["jk"] = { "", "escape" }, @@ -22,9 +23,9 @@ M.general = { --{{{ -- luasnip change choice [""] = { "luasnip-next-choice", "change luasnip choice" }, - }, + },--}}} - n = { + n = {--{{{ [""] = { " noh ", "no highlight" }, -- switch between windows @@ -35,8 +36,8 @@ M.general = { --{{{ -- Window resizing - [""] = { " vert res -2 ", "window width +" }, - [""] = { " vert res +2 ", "window width -" }, + [""] = { " vert res +2 ", "window width +" }, + [""] = { " vert res -2 ", "window width -" }, [""] = { "res +2 ", "window height +" }, [""] = { "res -2 ", "window height -" }, @@ -82,6 +83,42 @@ M.general = { --{{{ end , "packer snapshot"}, + ["pr"] = { function() + + -- require("plenary.reload").reload_module("plugins") + -- require("plenary.reload").reload_module("custom.plugins") + -- vim.cmd "LuaCacheClear" + -- package.loaded["plugins"] = nil + -- + -- package.loaded["custom.plugins"] = nil + -- dofile(vim.fn.stdpath("config") .. '/lua/plugins/init.lua') + -- dofile(vim.fn.stdpath("config") .. '/lua/custom/plugins/init.lua') + -- + require("sp4ke.utils").unload_lua_ns("plugins") + require("sp4ke.utils").unload_lua_ns("custom") + require("plugins") + -- require("sp4ke.utils").unload_lua_ns("custom") + vim.cmd "PackerCompile" + print("reloaded plugin config !") + end, + "packer reload/compile" + }, + + -- lua source current file + [".."] = {" :w | source %", "save and source script "}, + [".m"] = { function () + local ok, core = pcall(require, "core") + if not ok then + return + end + -- reload nvchad mappings + require("plenary.reload").reload_module("core.utils") + require("plenary.reload").reload_module("core.default_config") + require("plenary.reload").reload_module("core.mappings") + require("core.utils").load_mappings() + print("mappings reloaded !") + end, "config reload mappings"}, + ["ss"] = { " mks! ", "save session"}, ["sl"] = { " source Session.vim ", "load session"}, @@ -131,7 +168,7 @@ M.general = { --{{{ }, -- quick close window - [""] = {"c", "close window"}, + [""] = {"c", "close window"}, @@ -150,8 +187,14 @@ M.general = { --{{{ ["f8"] = { ":set foldlevel=8", "set fold level" }, ["f9"] = { ":set foldlevel=9", "set fold level" }, + ["tf"] = { " set foldmethod=expr | set \ + foldexpr=nvim_treesitter#foldexpr()", + "enable Treesitter folding"}, + ["en"] = { " cn ", "next error" }, + ["]e"] = { " cn ", "next error" }, ["ep"] = { " cp ", "previous error" }, + ["[e"] = { " cp ", "previous error" }, -- Tabularize mappings @@ -181,8 +224,11 @@ M.general = { --{{{ -- TODO: move to lspconfig section -- ["lsp"] = { " lua require('custom.plugins.configs.navigator').enable()", "lsp enable"}, ["lsp"] = { " LspStart", "lsp enable"}, + [""] = { " LspStart", "lsp enable"}, ["lst"] = { " LspStop", "lsp disable"}, + + --------------- -- Programming languages specifics --------------- @@ -199,11 +245,11 @@ M.general = { --{{{ -- config files ["ev"] = {" source ~/.config/nvim/Session.vim" , "edit vim config"}, - }, + },--}}} t = { [""] = { termcodes "", "escape terminal mode" } }, - v = { + v = {--{{{ -- ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, -- ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, ["j"] = { "gj" }, @@ -230,10 +276,10 @@ M.general = { --{{{ ["a,"] = { " Tabularize /," }, ["a"] = { " Tabularize /" }, - }, + },--}}} -- command line mappings - c = { + c = {--{{{ ["Tabe"] = { "tabe" }, -- Change Working Directory to that of the current file @@ -243,7 +289,11 @@ M.general = { --{{{ ["%%"] = { "=fnameescape(expand('%:h')).'/'", "alias to current working dir"}, ["Tab"] = { "Tabularize"}, - } + + + ["tsf"] = { "set foldmethod=expr | set foldexpr=nvim_treesitter#foldexpr()", + "enable Treesitter folding"} + }--}}} } --}}} M.tabufline = { --{{{ @@ -436,7 +486,21 @@ M.fzf_lua = { --{{{ n = { -- find - [""] = { " FzfLua files ", "FzfLua find files" }, + -- [""] = { " FzfLua files ", "FzfLua find files" }, + [""] = { function () + local ignored_bufs = { + "qf", + } + for _, ignored in ipairs(ignored_bufs) do + if vim.bo.filetype == ignored then + local default_keyseq = termcodes("") + vim.api.nvim_feedkeys(default_keyseq, 'n', false) + return + end + end + vim.cmd "FzfLua files" + end, "FzfLua find files" }, + ["fl"] = { " FzfLua lines ", "FzfLua grep open buffer lines" }, -- grep @@ -449,8 +513,9 @@ M.fzf_lua = { --{{{ ["fr"] = { " FzfLua resume ", "FzfLua resume last search" }, [";"] = { " FzfLua buffers ", "FzfLua find buffers" }, - ["fb"] = { " FzfLua builtins ", "FzfLua builtins" }, + ["fb"] = { " FzfLua builtin ", "FzfLua builtins" }, ["fh"] = { " FzfLua help_tags ", "FzfLua find help pages" }, + ["fm"] = { " FzfLua marks ", "FzfLua marks" }, ["fo"] = { " FzfLua oldfiles ", "FzfLua find oldfiles" }, ["tk"] = { " FzfLua keymaps ", "FzfLua show keymaps" }, @@ -568,25 +633,25 @@ M.whichkey = { --{{{ } --}}} M.blankline = { --{{{ - -- plugin = true, - -- - -- n = { - -- ["cc"] = { - -- function() - -- local ok, start = require("indent_blankline.utils").get_current_context( - -- vim.g.indent_blankline_context_patterns, - -- vim.g.indent_blankline_use_treesitter_scope - -- ) - -- - -- if ok then - -- vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) - -- vim.cmd [[normal! _]] - -- end - -- end, - -- - -- "Jump to current context", - -- }, - -- }, + plugin = true, + + n = { + ["cc"] = { + function() + local ok, start = require("indent_blankline.utils").get_current_context( + vim.g.indent_blankline_context_patterns, + vim.g.indent_blankline_use_treesitter_scope + ) + + if ok then + vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) + vim.cmd [[normal! _]] + end + end, + + "Jump to current context", + }, + }, } --}}} M.navigator = {--{{{ diff --git a/lua/core/options.lua b/lua/core/options.lua index a93f7d0..444f0c7 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -7,6 +7,7 @@ g.nvchad_theme = config.ui.theme g.toggle_theme_icon = "  " g.transparency = config.ui.transparency g.theme_switcher_loaded = false +-- g.fg_man_folding_enable = true -- enable folding for man pages -- use filetype.lua instead of filetype.vim. it's enabled by default in neovim 0.8 (nightly) if g.vim_version < 8 then @@ -32,7 +33,7 @@ opt.softtabstop = 2 -- Let backspace delete indent -- http://vim.wikia.com/wiki/Converting_tabs_to_spaces opt.tabpagemax = 10 -opt.fillchars = { eob = " " } +opt.fillchars = { eob = "∼" } opt.ignorecase = true opt.smartcase = true opt.mouse = "a" @@ -61,12 +62,12 @@ opt.iskeyword:remove("-") -- set foldmethod=expr -- set foldexpr=nvim_treesitter#foldexpr() -- -opt.foldminlines = 3 +opt.foldminlines = 2 opt.foldlevelstart = 0 opt.conceallevel=1 -- how to show text with :syn-conceal syntax opt.list = true -- show tabs,trailing spaces and non-breakable spaces -opt.listchars = "tab:› ,trail:•,extends:#,nbsp:." -- Highlight problematic whitespace +opt.listchars = "tab: ,trail:,extends:#,nbsp:⋅,eol:↴" -- Highlight problematic whitespace opt.diffopt:append("vertical") opt.completeopt = "menu,menuone,noselect" opt.wrap = false diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index 760e116..57b0bbb 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -8,11 +8,65 @@ local M = {} M.ui = { theme = "monekai", theme_toggle = { "monekai", "blossom" }, + hl_override = { + DiagnosticWarn = { + fg = "yellow", + italic = true, + }, + St_LspWarning = { + fg = "yello" + }, + DiagnosticHint = { + fg = "purple", + italic = true, + }, + St_LspHints = { + fg = "pruple", + }, + DiagnosticError = { + italic = true, + }, + St_LspInfo = { + fg = "teal" + }, + }, + hl_add = { + DiagnosticInfo = { -- nvchad uses DiagnosticInformation wrong hi group for lsp + fg = "teal", + italic = true, + }, + DiagnosticFloatingInfo = { + fg="white", + italic=true, + }, + -- Code Lens related colors + LspCodeLens = { + fg = "vibrant_green", + underline = true, + }, + LspDiagnosticsSignHint = { -- LspDiagnostics Code Action + fg = "vibrant_green", + italic = true, + }, + -- end of code lens colors + DiffText = { + bg = "vigrant_green" + } + }, -- hl_override = { -- CursorLine = { -- underline = 1 -- } -- }, + myicons = { + lsp = { + diagnostic_head = '', -- default diagnostic head on dialogs + diagnostic_err = '', -- severity 1 + diagnostic_warn = '', -- 2 + diagnostic_info = '', -- 3 + diagnostic_hint = '', -- 4 + } + }, } M.plugins = { diff --git a/lua/custom/init.lua b/lua/custom/init.lua index c093e7a..113c5d0 100644 --- a/lua/custom/init.lua +++ b/lua/custom/init.lua @@ -9,11 +9,14 @@ -- if character under cursor is number -- use normal C-x or close window +local vimscriptsfolder = vim.env.XDG_CONFIG_HOME .. "/nvim/myvimscript" -- relative to .config/nvim dir +vim.opt.runtimepath:prepend(vimscriptsfolder) + -- highlights { -vim.cmd [[ - hi CursorLine gui=underline -]] + -- handled in chadrc ui + -- see also plugin/after highlihght.vim + -- vim.cmd[[ runtime highlight.vim ]] --} -- Shift key typos{ diff --git a/lua/custom/plugins/configs/lsp_signature.lua b/lua/custom/plugins/configs/lsp_signature.lua new file mode 100644 index 0000000..6f2db91 --- /dev/null +++ b/lua/custom/plugins/configs/lsp_signature.lua @@ -0,0 +1,18 @@ +local present, signature = pcall(require, "lsp_signature") + +if not present then + return +end + +local config = { + floating_window = false, + hint_enable = true, + +} + +M = {} +M.setup = function() + signature.setup(config) +end + +return M diff --git a/lua/custom/plugins/configs/navigator.lua b/lua/custom/plugins/configs/navigator.lua index c14dd4d..a1f8916 100644 --- a/lua/custom/plugins/configs/navigator.lua +++ b/lua/custom/plugins/configs/navigator.lua @@ -9,9 +9,9 @@ M = {} local config = { - -- debug = true, + debug = false, transparency = 5, - lsp_signature_help = true, + lsp_signature_help = false, -- needs plugin lsp_signature default_mapping = false, keymaps = { { key = 'gr', func = require('navigator.reference').async_ref, desc = 'lsp async_ref' }, @@ -43,7 +43,8 @@ local config = { { key = 'D', func = vim.lsp.buf.type_definition, desc = 'lsp type_definition' }, { key = 'gL', func = require('navigator.diagnostics').show_diagnostics, desc = 'lsp show_diagnostics' }, { key = 'gG', func = require('navigator.diagnostics').show_buf_diagnostics, desc = 'lsp show_buf_diagnostics' }, - { key = 'dt', func = require('navigator.diagnostics').toggle_diagnostics, desc = 'lsp toggle_diagnostics' }, + -- { key = 'dt', func = require('navigator.diagnostics').toggle_diagnostics, desc = 'lsp toggle_diagnostics' }, + { key = 'dt', func = require('sp4ke.lsp').toggle_diagnostics, desc = 'lsp toggle_diagnostics' }, { key = ']d', func = vim.diagnostic.goto_next, desc = 'lsp next diagnostics' }, { key = '[d', func = vim.diagnostic.goto_prev, desc = 'lsp prev diagnostics' }, { key = ']O', func = vim.diagnostic.set_loclist, desc = 'lsp diagnostics set loclist' }, @@ -73,16 +74,16 @@ local config = { icons = { icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon) -- Code action - code_action_icon = ' ', -- "", + code_action_icon = ' ', -- "", -- code lens - code_lens_action_icon = '', + code_lens_action_icon = '', -- Diagnostics diagnostic_head = '', -- default diagnostic head on dialogs - diagnostic_err = '', -- severity 1 + diagnostic_err = '', -- severity 1 diagnostic_warn = '', -- 2 - diagnostic_info = '', -- 3 + diagnostic_info = '', -- 3 diagnostic_hint = '', -- 4 -- used in the diagnostics summary window @@ -124,7 +125,7 @@ local config = { document_highlight = false, mason = true, format_on_save = false, -- applies to all formatting feature of neovim - -- including auto-fold + -- including auto-fold diagnostic = { underline = true, virtual_text = { @@ -135,13 +136,34 @@ local config = { severity_sort = { reverse = true }, }, - -- disable_lsp = {"sqls"}, + diagnostic_scrollbar_sign = false, + + disable_lsp = {"clangd"}, -- disable auto start of lsp per language -- set global default on lspconfig (see lspconfig doc) - -- ["lua-dev"] = { -- only for lua-dev.nvim - -- autostart = false, - -- } + gopls = { + settings = { + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + } + }, + + ["lua-dev"] = { + library = { + enabled = true, + plugins = {"navigator.lua"}, + runtime = true, + types = true, + } + }, } } @@ -151,18 +173,18 @@ end -- make sure LSP is not started automatically -- TODO: how to it per project basis -M.enable = function() - local lspconfig = require("lspconfig") - lspconfig.util.default_config = vim.tbl_extend( - "force", - lspconfig.util.default_config, - { - autostart = true - } - ) - vim.cmd[[ - LspStart - ]] -end +-- M.enable = function() +-- local lspconfig = require("lspconfig") +-- lspconfig.util.default_config = vim.tbl_extend( +-- "force", +-- lspconfig.util.default_config, +-- { +-- autostart = true +-- } +-- ) +-- vim.cmd[[ +-- LspStart +-- ]] +-- end return M diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 2d61f52..2a0a50b 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,6 +2,33 @@ -- -- TODO: interesting plugins to install -- - neovim minisurround to replace vim-surround +-- +-- #### notes on Lua and requiring modules +-- https://github.com/wbthomason/packer.nvim/issues/955 +-- - when you require(...) a file in lua, it gets cached, so future require calls don't hit the filesystem. +-- This means reloading your lua config won't apply any changes because the old files are cached. +-- - Cached required modules are stored in `package.loaded` table +-- - for example if `require("foo.bar")` was issued it's cache would be in +-- `package.loaded["foo.bar"]` +-- +-- - to remove the cached module +-- +-- lua << EOF +-- +-- for k, v in pairs(package.loaded) do +-- if string.match(k, "^my_lua_config") then +-- package.loaded[k] = nil +-- end +-- end +-- +-- EOF +-- +-- #### Proper way to reload packer while picking up all changes from configs/setup +-- - Remove the cached module using package.loaded["foo.bar"] = nil +-- - Execute :PackerCompile +-- +-- This doesn't seem to work: +-- - XXX ~~Reload all lua modules with `"pleanery.reload".reload_module(mod)`~~ XXX return { ["nvim-treesitter/nvim-treesitter-textobjects"] = { @@ -12,9 +39,20 @@ return { end }, ["mfussenegger/nvim-dap"] = { + lock = true, module = "dap" }, - + ["rcarriga/nvim-dap-ui"] = { + lock = true, + after = "nvim-dap", + config = function () + require('dapui').setup() + end + }, + ["theHamsta/nvim-dap-virtual-text"] = { + lock = true, + after = "nvim-dap" + }, -- side panel with symbols (replaced by Navigator :LspSymbols cmd) -- ["liuchengxu/vista.vim"] = { -- cmd = "Vista", @@ -24,9 +62,11 @@ return { -- }, -- ["folke/which-key.nvim"] = { + lock = true, disable = false, }, ["nvim-telescope/telescope.nvim"] = { + lock = true, disable = true }, ["ibhagwan/fzf-lua"] = { @@ -42,6 +82,7 @@ return { }, -- Run async commands (make & errors) ["skywind3000/asyncrun.vim"] = { + lock = true, cmd = "AsyncRun", config = function() require("core.utils").load_mappings "asyncrun" @@ -49,11 +90,13 @@ return { end }, ["tpope/vim-fugitive"] = { + lock = true, cmd = {"G", "Git", "G*"} }, -- session and view ["vim-scripts/restore_view.vim"] = {}, + -- ["rmagatti/auto-session"] = { -- config = function () -- require("auto-session").setup { @@ -69,13 +112,10 @@ return { ["tpope/vim-repeat"] = { keys = {"."}, }, + ["justinmk/vim-sneak"] = { + lock = true, keys = {"s", "S"}, - setup = function() - vim.cmd[[ - let g:sneak#s_next=1 - ]] - end }, ["tpope/vim-surround"] = {}, ["godlygeek/tabular"] = { @@ -87,13 +127,11 @@ return { -- ["https://gitlab.com/HiPhish/info.vim.git"] = { cmd = "Info", - setup = function() - require("custom.plugins.info").set_mappings() - end }, -- snippets ["L3MON4D3/LuaSnip"] = { + lock = true, config = function() -- load default config first require("plugins.configs.others").luasnip() @@ -118,6 +156,7 @@ return { event = "InsertEnter", }, ["neovim/nvim-lspconfig"] = { + lock = true, config = function() local lspconfig = require("lspconfig") lspconfig.util.default_config = vim.tbl_extend( @@ -130,6 +169,7 @@ return { end-- disable lspconfig, handled by navigator }, ["williamboman/mason-lspconfig.nvim"] = { + lock = true, requires = {"williamboman/mason.nvim", "nvim-lspconfig"}, after = "mason.nvim", module = "mson-lspconfig.nvim", @@ -137,16 +177,16 @@ return { require("mason-lspconfig").setup({}) end, }, - ["hrsh7th/cmp-nvim-lsp-signature-help"] = { - after = "cmp-path" - }, ["ray-x/guihua.lua"] = { - module = "navigator", + lock = true, + module = {"navigator"}, run= "cd lua/fzy && make" }, -- ["https://git.sp4ke.xyz/sp4ke/navigator.lua"] = -- ["ray-x/navigator.lua"] = { + lock = true, + opt = true, after = { "nvim-lspconfig", "base46", "ui" }, requires = {"neovim/nvim-lspconfig", "ray-x/guihua.lua", "nvim-treesitter/nvim-treesitter"}, setup = function() @@ -161,10 +201,23 @@ return { end }, + ["ray-x/lsp_signature.nvim"] = { + after = {"navigator.lua"}, + config = function() + require("custom.plugins.configs.lsp_signature").setup() + end + + }, + -- per language plugins + -- ------- -- lua dev + -- ------- + + -- Eval Lua lines/selections ["bfredl/nvim-luadev"] = { + lock = true, cmd = "Luadev", keys = { "(Luadev-RunLine)", @@ -184,10 +237,13 @@ return { }) end }, + + -- REPL for Lua development ["ii14/neorepl.nvim"] = { + lock = true, cmd = "Repl", after = "nvim-cmp", - setup = function () + config = function () local autocmd = vim.api.nvim_create_autocmd autocmd("FileType",{ pattern = "neorepl", @@ -200,5 +256,32 @@ return { end }) end + }, + + -- Lua dev env + -- check setup in configs/navigator.lua + ["folke/lua-dev.nvim"] = { + module = "lua-dev", + before = {"navigator.lua"}, + }, + + -- golang dev + ["ray-x/go.nvim"] = { + lock = true, + -- after = {"nvim-lspconfig", "navigator.lua", "guihua.lua"}, + ft = {"go"}, + opt = true, + config = function() + require("go").setup({ + run_in_floaterm = true, + icons = false, + -- icons = { breakpoint = "🧘", currentpos = "🏃" }, -- set to false to disable + lsp_cfg = false, -- handled by navigator + -- lsp_keymaps = false, -- use navigator + -- lsp_diag_signs = false, + lsp_codelens = false, -- use navigator + textobjects = true, + }) + end } } diff --git a/lua/custom/plugins/nvchadui.lua b/lua/custom/plugins/nvchadui.lua new file mode 100644 index 0000000..8377052 --- /dev/null +++ b/lua/custom/plugins/nvchadui.lua @@ -0,0 +1,48 @@ +local fn = vim.fn +local sep_style = vim.g.statusline_sep_style +local separators = (type(sep_style) == "table" and sep_style) + or require("nvchad_ui.icons").statusline_separators[sep_style] +local sep_r = separators["right"] +local myicons = require("custom.chadrc").ui.myicons + +-- called in chadrc +-- +return { + fileInfo = function () + local icon = "  " + local filename = (fn.expand "%" == "" and "Empty ") or fn.expand "%:t" + local modified = (vim.bo[0].modified and "+ ") or "" + + if filename ~= "Empty " then + local devicons_present, devicons = pcall(require, "nvim-web-devicons") + + if devicons_present then + local ft_icon = devicons.get_icon(filename) + icon = (ft_icon ~= nil and " " .. ft_icon) or "" + end + + filename = " " .. filename .. " " + end + + return "%#St_file_info#" .. icon .. filename .. modified .. "%#St_file_sep#" .. sep_r + end, + + LSP_Diagnostics = function() + if not rawget(vim, "lsp") then + return "" + end + + local errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }) + local warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }) + local hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }) + local info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }) + + errors = (errors and errors > 0) and ("%#St_lspError#" .. myicons.lsp.diagnostic_err .. " " .. errors .. " ") or "" + warnings = (warnings and warnings > 0) and ("%#St_lspWarning#" .. myicons.lsp.diagnostic_warn .. " " .. warnings .. " ") or "" + hints = (hints and hints > 0) and ("%#St_lspHints#" .. myicons.lsp.diagnostic_hint .. " " .. hints .. " ") or "" + info = (info and info > 0) and ("%#St_lspInfo#" .. myicons.lsp.diagnostic_info .. " " .. info .. " ") or "" + + return errors .. warnings .. hints .. info + end +} + diff --git a/lua/plugins/configs/cmp.lua b/lua/plugins/configs/cmp.lua index 0880acf..99cd673 100644 --- a/lua/plugins/configs/cmp.lua +++ b/lua/plugins/configs/cmp.lua @@ -118,7 +118,6 @@ local options = { { name = "buffer" }, { name = "nvim_lua" }, { name = "path" }, - { name = "nvim_lsp_signature_help" }, }, } diff --git a/lua/plugins/configs/others.lua b/lua/plugins/configs/others.lua index 8ed91ab..ab7ad78 100644 --- a/lua/plugins/configs/others.lua +++ b/lua/plugins/configs/others.lua @@ -55,8 +55,9 @@ M.blankline = function() buftype_exclude = { "terminal" }, show_trailing_blankline_indent = false, show_first_indent_level = false, - show_current_context = false, - show_current_context_start = false, + show_current_context = true, + show_current_context_start = true, + show_end_of_line = true, } options = load_override(options, "lukas-reineke/indent-blankline.nvim") diff --git a/lua/sp4ke/lsp.lua b/lua/sp4ke/lsp.lua new file mode 100644 index 0000000..f7f2555 --- /dev/null +++ b/lua/sp4ke/lsp.lua @@ -0,0 +1,14 @@ +M = {} +M.shown = true + +-- toggle diagnostics with show/hide +M.toggle_diagnostics = function () + if M.shown then + M.shown = false + return vim.diagnostic.hide() + end + vim.diagnostic.show() + M.shown = true +end + +return M diff --git a/lua/sp4ke/utils.lua b/lua/sp4ke/utils.lua new file mode 100644 index 0000000..8af98b3 --- /dev/null +++ b/lua/sp4ke/utils.lua @@ -0,0 +1,22 @@ +local M = {} +M["unload_lua_ns"] = function (prefix) + local prefix_with_dot = prefix .. '.' + for key, _ in pairs(package.loaded) do + if key == prefix or key:sub(1, #prefix_with_dot) == prefix_with_dot then + print("removing: ", key) + package.loaded[key] = nil + end + end +end + +-- M.unload_lua_ns("core") +M.list_loaded_modules = function () + local loaded = {} + for k, _ in pairs(package.loaded) do + loaded[#loaded + 1] = k + end + vim.ui.select(loaded, {}, nil) + +end + +return M diff --git a/plugin/after/highlight.vim b/plugin/after/highlight.vim new file mode 100644 index 0000000..169c6a0 --- /dev/null +++ b/plugin/after/highlight.vim @@ -0,0 +1,11 @@ +" vim modeline +" vim: foldmarker={,} foldmethod=marker foldlevel=0 + +" example usage +" for NvChad highlihgts chould be handled in chadrc +" au BufEnter * hi CursorLine gui=underline +" au BufEnter * hi CursorLine guifg=red +" + +" GuiGua selected item (navigator etc ) +au BufEnter * hi GuihuaListSelHl gui=underline guibg=bg diff --git a/plugin/after/info.vim b/plugin/after/info.vim new file mode 100644 index 0000000..269e4f8 --- /dev/null +++ b/plugin/after/info.vim @@ -0,0 +1,16 @@ +nnoremap I :tab Info +augroup INFO + au! + au FileType info nnoremap i + au FileType info nmap (InfoUp) + au FileType info nmap iu (InfoUp) + au FileType info nmap (InfoMenu) + au FileType info nmap im (InfoMenu) + au FileType info nmap (InfoFollow) + au FileType info nmap if (InfoFollow) + au FileType info nmap (InfoNext) + au FileType info nmap in (InfoNext) + au FileType info nmap (InfoPrev) + au FileType info nmap ip (InfoPrev) + au FileType info nmap ig (InfoGoto) +augroup END diff --git a/plugin/after/sneak.vim b/plugin/after/sneak.vim new file mode 100644 index 0000000..7693933 --- /dev/null +++ b/plugin/after/sneak.vim @@ -0,0 +1,2 @@ +let g:sneak#s_next=1 +let g:sneak#use_ic_scs=1