From c55b301dc4debbdedb0c5ab94001e353ca3ec20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kmie=C4=87?= Date: Mon, 26 Feb 2024 12:51:21 +0100 Subject: [PATCH] Nvim: update most of the plugins --- .config/nvim/lua/core/config.lua | 41 +++- .config/nvim/lua/core/mappings.lua | 93 +-------- .config/nvim/lua/core/plugins.lua | 10 +- .config/nvim/lua/plugins/boole.lua | 1 - .config/nvim/lua/plugins/colorschemes.lua | 30 ++- .config/nvim/lua/plugins/csv.lua | 11 +- .config/nvim/lua/plugins/dap-ui.lua | 4 - .config/nvim/lua/plugins/dap-virtual-text.lua | 37 ---- .config/nvim/lua/plugins/dap.lua | 115 +++++++++++ .config/nvim/lua/plugins/devdocs.lua | 7 +- .config/nvim/lua/plugins/dressing.lua | 163 +-------------- .config/nvim/lua/plugins/femaco.lua | 5 +- .config/nvim/lua/plugins/fterm.lua | 18 +- .config/nvim/lua/plugins/icons.lua | 17 +- .config/nvim/lua/plugins/init.lua | 29 +-- .config/nvim/lua/plugins/jupyter.lua | 1 + .config/nvim/lua/plugins/leap.lua | 1 + .config/nvim/lua/plugins/lspconfig.lua | 191 +++++++----------- .config/nvim/lua/plugins/mini.lua | 19 -- .config/nvim/lua/plugins/minimap.lua | 4 +- .config/nvim/lua/plugins/mkdnflow.lua | 3 +- .config/nvim/lua/plugins/navbuddy.lua | 4 +- .config/nvim/lua/plugins/null.lua | 1 - .config/nvim/lua/plugins/nvim-cmp.lua | 15 +- .config/nvim/lua/plugins/nvim-tree.lua | 4 +- .config/nvim/lua/plugins/obs.lua | 31 --- .config/nvim/lua/plugins/quicknote.lua | 7 + .config/nvim/lua/plugins/search.lua | 3 +- .config/nvim/lua/plugins/specs.lua | 13 +- .config/nvim/lua/plugins/symbol-usage.lua | 52 ++++- .config/nvim/lua/plugins/symbols-outline.lua | 3 +- .config/nvim/lua/plugins/telescope.lua | 23 +++ .config/nvim/lua/plugins/treesitter.lua | 8 +- .config/nvim/lua/plugins/windows.lua | 6 + 34 files changed, 439 insertions(+), 531 deletions(-) delete mode 100644 .config/nvim/lua/plugins/dap-ui.lua delete mode 100644 .config/nvim/lua/plugins/dap-virtual-text.lua delete mode 100644 .config/nvim/lua/plugins/mini.lua delete mode 100644 .config/nvim/lua/plugins/obs.lua diff --git a/.config/nvim/lua/core/config.lua b/.config/nvim/lua/core/config.lua index 005e339..a3a5197 100644 --- a/.config/nvim/lua/core/config.lua +++ b/.config/nvim/lua/core/config.lua @@ -1,14 +1,20 @@ vim.g.loaded = 1 -vim.g.loaded_netrwPlugin = 1 +-- uncomment to disable netrw, but nvim scp://xx will not work: +-- vim.g.loaded_netrwPlugin = 1 vim.g.plug_install = 0 vim.opt.termguicolors = true vim.opt.startofline = true +vim.g.loaded_ruby_provider = 0 +vim.g.loaded_perl_provider = 0 + +vim.opt.conceallevel = 1 + vim.opt.shell = '/bin/bash' vim.opt.number = true --vim.o.relativenumber = 1 -vim.opt.numberwidth = 1 +vim.opt.numberwidth = 2 vim.opt.clipboard = "unnamedplus" vim.opt.showmode = true @@ -68,14 +74,14 @@ vim.opt.cmdheight = 1 vim.opt.shortmess:append('c') vim.opt.shortmess:remove('F') -vim.opt.signcolumn = "auto" +vim.opt.signcolumn = "yes" vim.opt.wildmode = { "longest", "list", "full" } vim.opt.completeopt = { "menu", "menuone", "noselect" } vim.opt.mouse = "" ---match Error /\s\+$\|DU\cPA/ +vim.cmd.match([[Error /\s\+$\|DU\cPA/]]) vim.opt.virtualedit = "block" vim.opt.shiftround = true @@ -96,3 +102,30 @@ vim.opt.wildignore = [[ */tmp/*,*.so,*.swp,*.zip,**/node_modules/**,**/target/**,**.terraform/**" ]] + +-- Only setup gnvim when it attaches. +vim.api.nvim_create_autocmd({'UIEnter'}, { + callback = function(event) + local chanid = vim.v.event['chan'] + local chan = vim.api.nvim_get_chan_info(chanid) + if chan.client and chan.client.name ~= 'gnvim' then + return + end + + -- Gnvim brings its own runtime files. + local gnvim = require('gnvim') + + -- Set the font + vim.opt.guifont = 'iM WritingMonoS Nerd Font' + + -- Increase/decrease font. + vim.keymap.set('n', '', function() gnvim.font_size(1) end) + vim.keymap.set('n', '', function() gnvim.font_size(-1) end) + + gnvim.setup({ + cursor = { + blink_transition = 300 + } + }) + end +}) diff --git a/.config/nvim/lua/core/mappings.lua b/.config/nvim/lua/core/mappings.lua index f93735e..56fc314 100644 --- a/.config/nvim/lua/core/mappings.lua +++ b/.config/nvim/lua/core/mappings.lua @@ -1,6 +1,6 @@ local map = vim.keymap.set local default_options = { noremap = true, silent = true } -local expr_options = { noremap = true, expr = true, silent = true } +--local expr_options = { noremap = true, expr = true, silent = true } -- space one line, home,end globally increase/decrease map('n', '', 'zc', default_options) @@ -26,94 +26,3 @@ map('v', 'P', '"_dP', default_options) map('n', '2', 'set tabstop=2 softtabstop=2 shiftwidth=2', default_options) map('n', '4', 'set tabstop=4 softtabstop=4 shiftwidth=4', default_options) map('n', '8', 'set tabstop=8 softtabstop=8 shiftwidth=8', default_options) - --- digraphs -map('i', 'd', 'lua require("better-digraphs").digraphs("i")', default_options) - --- femaco ---map('n', 'fe'. 'FeMaCo', expr_options) - --- fterm -map('n', 'i', 'lua require("FTerm").toggle()', default_options) -map('t', 'i', 'lua require("FTerm").toggle()', default_options) - --- icon picker --- map('n', 'i', 'IconPickerNormal', default_options) --- map('n', 'y', 'IconPickerYank', default_options) --- map('i', 'i', 'IconPickerInsert', default_options) - --- iswap -map('n', 'sw', 'ISwapWith', default_options) -map('n', 'ss', 'ISwap', default_options) - --- code window -require('codewindow').apply_default_keybinds() - --- nvim tree -map('n', 'tt', 'NvimTreeToggle', default_options) -map('n', 'tf', 'NvimTreeFindFile', default_options) - --- other --- map('n', 'oo', 'Other', default_options) --- map('n', 'os', 'OtherSplit', default_options) --- map('n', 'ov', 'OtherVSplit', default_options) --- map('n', 'oc', 'OtherClear', default_options) --- Context specific bindings --- map('n', 'ot', 'Other test', default_options) --- map('n', 'os', 'Other scss', default_options) - --- quicknote -map('n', 'qn', 'lua require("quicknote").NewNoteAtCurrentLine()', default_options) -map('n', 'qs', 'lua require("quicknote").ShowNoteSigns()', default_options) -map('n', 'qe', 'lua require("quicknote").OpenNoteAtCurrentLine()', default_options) -map('n', 'qd', 'lua require("quicknote").DeleteNoteAtCurrentLine()', default_options) - --- telescope -map('n', 'f', 'lua require("telescope").extensions.menufacture.find_files()', default_options) -map('n', 'a', 'lua require("telescope").extensions.menufacture.grep_string()', default_options) -map('n', 'A', 'lua require("telescope").extensions.menufacture.live_grep()', default_options) -map('n', 'b', 'lua require("telescope.builtin").buffers()', default_options) -map('n', 'r', 'lua require("telescope.builtin").resume()', default_options) --- map('n', 'fh', 'lua require('telescope.builtin').help_tags(), default_options) -map('n', 'tc', 'lua require("telescope.builtin").commands()', default_options) -map('n', 't:', 'lua require("telescope.builtin").command_history()', default_options) -map('n', 't/', 'lua require("telescope.builtin").search_history()', default_options) -map('n', 'tr', 'lua require("telescope.builtin").registers()', default_options) --- Neovim lsp pickers -map('n', 'tr', 'lua require("telescope.builtin").lsp_references()', default_options) -map('n', 'td', 'lua require("telescope.builtin").lsp_definitions()', default_options) --- git pickers -map('n', 'gc', 'lua require("telescope.builtin").git_commits()', default_options) -map('n', 'gC', 'lua require("telescope.builtin").git_bcommits()', default_options) -map('n', 'gb', 'lua require("telescope.builtin").git_branches()', default_options) --- map('n', 's', 'lua require('telescope').extensions.ultisnips.ultisnips(), default_options) -map('n', 'u', 'lua require("telescope").extensions.undo.undo()', default_options) - --- toggler not active ---vim.keymap.set({'n', 'v'}, 'gt', require('nvim-toggler').toggle) - --- windows -map('n', 'z', "WindowsMaximize", default_options) -map('n', '_', "WindowsMaximizeVertically", default_options) -map('n', '|', "WindowsMaximizeHorizontally", default_options) -map('n', '=', "WindowsEqualize", default_options) - --- specs -map('n', 'n', 'n:lua require("specs").show_specs()', default_options) -map('n', 'N', 'N:lua require("specs").show_specs()', default_options) -map('n', '', function() - vim.cmd.noh() - require("specs").show_specs({width = 97, winhl = "Search", delay_ms = 610, inc_ms = 21}) -end, default_options) - -vim.api.nvim_set_keymap('n', 'cb', ':lua require("nvim-navbuddy").open()', default_options) - --- dap -map('v', 'K', 'lua require("dapui").eval()', default_options) -map('n', 'dc', ':lua require("dap").continue()', default_options); -map('n', 'db', ':lua require("dap").toggle_breakpoint()', default_options); -map('n', 'dB', ':lua require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))', default_options); -map('n', 'dn', ':lua require("dap").step_over()', default_options); -map('n', 'di', ':lua require("dap").step_into()', default_options); -map('n', 'do', ':lua require("dap").step_out()', default_options); -map('n', 'dl', ':lua require("dap").run_last()', default_options); diff --git a/.config/nvim/lua/core/plugins.lua b/.config/nvim/lua/core/plugins.lua index 2d11d94..bbdd677 100644 --- a/.config/nvim/lua/core/plugins.lua +++ b/.config/nvim/lua/core/plugins.lua @@ -9,10 +9,14 @@ if not vim.loop.fs_stat(lazypath) then lazypath, }) end ---vim.opt.rtp:append(lazypath) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -vim.opt.rtp:append(lazypath) -require'lazy'.setup('plugins') +vim.opt.rtp:prepend(lazypath) +require'lazy'.setup('plugins', { + change_detection = { + enabled = true, + notify = false + } +}) diff --git a/.config/nvim/lua/plugins/boole.lua b/.config/nvim/lua/plugins/boole.lua index 0a554fe..4866162 100644 --- a/.config/nvim/lua/plugins/boole.lua +++ b/.config/nvim/lua/plugins/boole.lua @@ -8,7 +8,6 @@ return { }, -- User defined loops additions = { - {'tic', 'tac', 'toe'}, {'light', 'dark'}, {'phaseOne', 'phaseTwo', 'phaseThree'}, {'PhaseOne', 'PhaseTwo', 'PhaseThree'}, diff --git a/.config/nvim/lua/plugins/colorschemes.lua b/.config/nvim/lua/plugins/colorschemes.lua index 7779e01..18df0f3 100644 --- a/.config/nvim/lua/plugins/colorschemes.lua +++ b/.config/nvim/lua/plugins/colorschemes.lua @@ -87,7 +87,35 @@ return {{ "bluz71/vim-moonfly-colors", lazy = false, config = function() - vim.cmd.colorscheme('moonfly') + --vim.cmd.colorscheme('moonfly') end +}, +{ + "kuznetsss/meadow.nvim", + lazy = false, + config = function() + --require('meadow').setup() + --vim.cmd.colorscheme('meadow') + --vim.cmd [[ hi! Conceal guibg=black ]] + end +}, +{ + "kepano/flexoki-neovim", + lazy = false, + config = function() + --vim.cmd.colorscheme('flexoki-dark') + end +}, +{ + "https://gitlab.com/bartekjaszczak/distinct-nvim", + + priority = 1000, + config = function() + require("distinct").setup({ + doc_comments_different_color = true, -- Use different colour for documentation comments + }) + + vim.cmd.colorscheme('distinct') + end } } diff --git a/.config/nvim/lua/plugins/csv.lua b/.config/nvim/lua/plugins/csv.lua index b566c5e..4888580 100644 --- a/.config/nvim/lua/plugins/csv.lua +++ b/.config/nvim/lua/plugins/csv.lua @@ -1,4 +1,4 @@ -return { +return {{ -- :DataViewer -- :DataViewer [filepath] [filetype] -- :DataViewerNextTable @@ -8,5 +8,10 @@ return { opts = {}, dependencies = { "nvim-lua/plenary.nvim", - } -} + }, + ft = { "csv" } +}, +{ + "chrisbra/csv.vim", + ft = { "csv" } +}} diff --git a/.config/nvim/lua/plugins/dap-ui.lua b/.config/nvim/lua/plugins/dap-ui.lua deleted file mode 100644 index 80d539c..0000000 --- a/.config/nvim/lua/plugins/dap-ui.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - 'rcarriga/nvim-dap-ui', - config = true -} diff --git a/.config/nvim/lua/plugins/dap-virtual-text.lua b/.config/nvim/lua/plugins/dap-virtual-text.lua deleted file mode 100644 index 18ad53c..0000000 --- a/.config/nvim/lua/plugins/dap-virtual-text.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - 'theHamsta/nvim-dap-virtual-text', - config = function() - require("nvim-dap-virtual-text").setup{ - enabled = true, -- enable this plugin (the default) - enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination) - highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText - highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables) - show_stop_reason = true, -- show stop reason when stopped for exceptions - commented = false, -- prefix virtual text with comment string - only_first_definition = true, -- only show virtual text at first definition (if there are multiple) - all_references = false, -- show virtual text on all all references of the variable (not only definitions) - clear_on_continue = false, -- clear virtual text on "continue" (might cause flickering when stepping) - --- A callback that determines how a variable is displayed or whether it should be omitted - --- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable - --- @param buf number - --- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame - --- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`) - --- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text - --- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed - display_callback = function(variable, buf, stackframe, node, options) - if options.virt_text_pos == 'inline' then - return ' = ' .. variable.value - else - return variable.name .. ' = ' .. variable.value - end - end, - -- position of virtual text, see `:h nvim_buf_set_extmark()`, default tries to inline the virtual text. Use 'eol' to set to end of line - virt_text_pos = vim.fn.has 'nvim-0.10' == 1 and 'inline' or 'eol', - - -- experimental features: - all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine. - virt_lines = false, -- show virtual lines instead of virtual text (will flicker!) - virt_text_win_col = nil -- position the virtual text at a fixed window column (starting from the first text column) , - } - end -} diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua index e4aaab4..a8afa40 100644 --- a/.config/nvim/lua/plugins/dap.lua +++ b/.config/nvim/lua/plugins/dap.lua @@ -1,4 +1,5 @@ return { +{ 'mfussenegger/nvim-dap', config = function() local dap = require("dap") @@ -29,5 +30,119 @@ return { cwd = "${workspaceFolder}", }, } + dap.configurations.python = { + { + -- The first three options are required by nvim-dap + type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python` + request = 'launch'; + name = "Launch file"; + + -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options + + program = "${file}"; -- This configuration will launch the current file if used. + pythonPath = function() + -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself. + -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within. + -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable. + local cwd = vim.fn.getcwd() + if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then + return cwd .. '/venv/bin/python' + elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then + return cwd .. '/.venv/bin/python' + else + return '/usr/bin/python3' + end + end; + } + } + dap.adapters.python = function(cb, config) + if config.request == 'attach' then + ---@diagnostic disable-next-line: undefined-field + local port = (config.connect or config).port + ---@diagnostic disable-next-line: undefined-field + local host = (config.connect or config).host or '127.0.0.1' + cb({ + type = 'server', + port = assert(port, '`connect.port` is required for a python `attach` configuration'), + host = host, + options = { + source_filetype = 'python', + }, + }) + else + cb({ + type = 'executable', + command = '/home/kmcr/.virtualenvs/debugpy/bin/python', + args = { '-m', 'debugpy.adapter' }, + options = { + source_filetype = 'python', + }, + }) + end + end + + local def = { noremap = true, silent = true } + vim.keymap.set('n', '\\c', function() require("dap").continue() end, def); + vim.keymap.set('n', '\\b', function() require("dap").toggle_breakpoint() end, def); + vim.keymap.set('n', '\\B', function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, def); + vim.keymap.set('n', '\\n', function() require("dap").step_over() end, def); + vim.keymap.set('n', '\\s', function() require("dap").step_into() end, def); + vim.keymap.set('n', '\\u', function() require("dap").step_out() end, def); + vim.keymap.set('n', '\\l', function() require("dap").run_last() end, def); + end +}, +{ + 'rcarriga/nvim-dap-ui', + dependencies = { + 'mfussenegger/nvim-dap' + }, + config = function() + local ui = require('dapui') + local dap = require('dap') + local def = { noremap = true, silent = true } + vim.keymap.set('n', '\\d', function() + dap.continue() + ui.toggle({}) + end, def) + vim.keymap.set('v', 'K', function() require("dapui").eval() end, def) + ui.setup() + end +}, +{ + 'theHamsta/nvim-dap-virtual-text', + config = function() + require("nvim-dap-virtual-text").setup{ + enabled = true, -- enable this plugin (the default) + enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination) + highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText + highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables) + show_stop_reason = true, -- show stop reason when stopped for exceptions + commented = false, -- prefix virtual text with comment string + only_first_definition = true, -- only show virtual text at first definition (if there are multiple) + all_references = false, -- show virtual text on all all references of the variable (not only definitions) + clear_on_continue = false, -- clear virtual text on "continue" (might cause flickering when stepping) + --- A callback that determines how a variable is displayed or whether it should be omitted + --- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable + --- @param buf number + --- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame + --- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`) + --- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text + --- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed + display_callback = function(variable, buf, stackframe, node, options) + if options.virt_text_pos == 'inline' then + return ' = ' .. variable.value + else + return variable.name .. ' = ' .. variable.value + end + end, + -- position of virtual text, see `:h nvim_buf_set_extmark()`, default tries to inline the virtual text. Use 'eol' to set to end of line + virt_text_pos = vim.fn.has 'nvim-0.10' == 1 and 'inline' or 'eol', + + -- experimental features: + all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine. + virt_lines = false, -- show virtual lines instead of virtual text (will flicker!) + virt_text_win_col = nil -- position the virtual text at a fixed window column (starting from the first text column) , + } end } +} diff --git a/.config/nvim/lua/plugins/devdocs.lua b/.config/nvim/lua/plugins/devdocs.lua index 49923a6..698b3ea 100644 --- a/.config/nvim/lua/plugins/devdocs.lua +++ b/.config/nvim/lua/plugins/devdocs.lua @@ -14,13 +14,14 @@ return { width = 100, border = "rounded", }, - wrap = false, -- text wrap, only applies to floating window + wrap = true, -- text wrap, only applies to floating window previewer_cmd = nil, -- for example: "glow" cmd_args = {}, -- example using glow: { "-s", "dark", "-w", "80" } cmd_ignore = {}, -- ignore cmd rendering for the listed docs picker_cmd = false, -- use cmd previewer in picker preview picker_cmd_args = {}, -- example using glow: { "-p" } - ensure_installed = {}, -- get automatically installed + ensure_installed = nil, -- get automatically installed after_open = function(bufnr) end, -- callback that runs after the Devdocs window is opened. Devdocs buffer ID will be passed in - } + }, + event = "VeryLazy" } diff --git a/.config/nvim/lua/plugins/dressing.lua b/.config/nvim/lua/plugins/dressing.lua index e7e5bf1..387a945 100644 --- a/.config/nvim/lua/plugins/dressing.lua +++ b/.config/nvim/lua/plugins/dressing.lua @@ -1,167 +1,6 @@ return { 'stevearc/dressing.nvim', - enabled = false, + enabled = true, opts = { - input = { - -- Set to false to disable the vim.ui.input implementation - enabled = true, - - -- Default prompt string - default_prompt = "Input:", - - -- Can be 'left', 'right', or 'center' - prompt_align = "left", - - -- When true, will close the modal - insert_only = true, - - -- When true, input will start in insert mode. - start_in_insert = true, - - -- These are passed to nvim_open_win - border = "rounded", - -- 'editor' and 'win' will default to being centered - relative = "cursor", - - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - prefer_width = 40, - width = nil, - -- min_width and max_width can be a list of mixed types. - -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" - max_width = { 140, 0.9 }, - min_width = { 20, 0.2 }, - - buf_options = {}, - win_options = { - -- Window transparency (0-100) - winblend = 10, - -- Disable line wrapping - wrap = false, - list = true, - listchars = "precedes:…,extends:…", - -- Increase this for more context when text scrolls off the window - sidescrolloff = 0, - }, - - -- Set to `false` to disable - mappings = { - n = { - [""] = "Close", - [""] = "Confirm", - }, - i = { - [""] = "Close", - [""] = "Confirm", - [""] = "HistoryPrev", - [""] = "HistoryNext", - }, - }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - - -- see :help dressing_get_config - get_config = nil, - }, - select = { - -- Set to false to disable the vim.ui.select implementation - enabled = true, - - -- Priority list of preferred vim.select implementations - backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" }, - - -- Trim trailing `:` from prompt - trim_prompt = true, - - -- Options for telescope selector - -- These are passed into the telescope picker directly. Can be used like: - -- telescope = require('telescope.themes').get_ivy({...}) - telescope = nil, - - -- Options for fzf selector - fzf = { - window = { - width = 0.5, - height = 0.4, - }, - }, - - -- Options for fzf_lua selector - fzf_lua = { - winopts = { - width = 0.5, - height = 0.4, - }, - }, - - -- Options for nui Menu - nui = { - position = "50%", - size = nil, - relative = "editor", - border = { - style = "rounded", - }, - buf_options = { - swapfile = false, - filetype = "DressingSelect", - }, - win_options = { - winblend = 10, - }, - max_width = 80, - max_height = 40, - min_width = 40, - min_height = 10, - }, - - -- Options for built-in selector - builtin = { - -- These are passed to nvim_open_win - border = "rounded", - -- 'editor' and 'win' will default to being centered - relative = "editor", - - buf_options = {}, - win_options = { - -- Window transparency (0-100) - winblend = 10, - cursorline = true, - cursorlineopt = "both", - }, - - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- the min_ and max_ options can be a list of mixed types. - -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" - width = nil, - max_width = { 140, 0.8 }, - min_width = { 40, 0.2 }, - height = nil, - max_height = 0.9, - min_height = { 10, 0.2 }, - - -- Set to `false` to disable - mappings = { - [""] = "Close", - [""] = "Close", - [""] = "Confirm", - }, - - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - }, - - -- Used to override format_item. See :help dressing-format - format_item_override = {}, - - -- see :help dressing_get_config - get_config = nil, - }, } } diff --git a/.config/nvim/lua/plugins/femaco.lua b/.config/nvim/lua/plugins/femaco.lua index 52f758d..dab2a73 100644 --- a/.config/nvim/lua/plugins/femaco.lua +++ b/.config/nvim/lua/plugins/femaco.lua @@ -1,4 +1,7 @@ return { 'AckslD/nvim-FeMaco.lua', - config = true + config = function() + require('femaco').setup() + vim.keymap.set('n', '!', 'FeMaCo', { noremap = true, silent = true }) + end, } diff --git a/.config/nvim/lua/plugins/fterm.lua b/.config/nvim/lua/plugins/fterm.lua index bf6519a..c3be15d 100644 --- a/.config/nvim/lua/plugins/fterm.lua +++ b/.config/nvim/lua/plugins/fterm.lua @@ -1,6 +1,7 @@ return { 'numToStr/FTerm.nvim', - opts = { + config = function() + require('FTerm').setup({ -- Filetype of the terminal buffer ft = 'FTerm', @@ -23,10 +24,10 @@ return { -- Object containing the terminal window dimensions. -- The value for each field should be between `0` and `1` dimensions = { - height = 0.9, -- Height of the terminal window - width = 0.9, -- Width of the terminal window - x = 0.5, -- X axis of the terminal window - y = 0.5, -- Y axis of the terminal window + height = 0.9, -- Height of the terminal window + width = 0.9, -- Width of the terminal window + x = 0.5, -- X axis of the terminal window + y = 0.5, -- Y axis of the terminal window }, -- Callback invoked when the terminal exits. @@ -40,5 +41,10 @@ return { -- Callback invoked when the terminal emits stderr data. -- See `:h jobstart-options` on_stderr = nil, - } + }) + + vim.keymap.set('n', 'i', 'lua require("FTerm").toggle()', { noremap = true, silent = true }) + vim.keymap.set('t', 'i', 'lua require("FTerm").toggle()', { noremap = true, silent = true }) + end, + enabled = false } diff --git a/.config/nvim/lua/plugins/icons.lua b/.config/nvim/lua/plugins/icons.lua index c185f43..5648cc3 100644 --- a/.config/nvim/lua/plugins/icons.lua +++ b/.config/nvim/lua/plugins/icons.lua @@ -1,7 +1,20 @@ -return { +return {{ 'ziontee113/icon-picker.nvim', config = function() require("icon-picker").setup({disable_legacy_commands = true }) end, - enabled = false + -- icon picker + -- map('n', 'i', 'IconPickerNormal', default_options) + -- map('n', 'y', 'IconPickerYank', default_options) + -- map('i', 'i', 'IconPickerInsert', default_options) + enabled = false, +}, +{ + '2kabhishek/nerdy.nvim', + dependencies = { + 'stevearc/dressing.nvim', + 'nvim-telescope/telescope.nvim', + }, + cmd = 'Nerdy', +} } diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 3d64835..02286d8 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -1,33 +1,10 @@ return {{ ---"inside/vim-search-pulse", -"MunifTanjim/nui.nvim", -"nvim-lua/plenary.nvim", -"wellle/targets.vim", +-- "MunifTanjim/nui.nvim", +-- "nvim-lua/plenary.nvim", -"tpope/vim-fugitive", - -"chrisbra/csv.vim", --"iamcco/markdown-preview.nvim",, { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} +--"euclio/vim-markdown-composer",, {'do': ':!cargo build --release --locked'} --"vim-pandoc/vim-pandoc", ---"junegunn/goyo.vim", -"protex/better-digraphs.nvim", - --"RRethy/vim-hexokinase",, { 'do': 'make hexokinase' } ---"euclio/vim-markdown-composer",, {'do': ':!cargo build --release --locked'} - ---"https://git.sr.ht/~whynothugo/lsp_lines.nvim", ---require('lsp_lines').setup() - ---"rgroli/other.nvim", " Currently doesn't support C/C++ -"Pocco81/true-zen.nvim", -"nullchilly/fsread.nvim", -{ - "cbochs/grapple.nvim", - enabled = false -}, -{ - "shortcuts/no-neck-pain.nvim", - enabled = false, -}, }} diff --git a/.config/nvim/lua/plugins/jupyter.lua b/.config/nvim/lua/plugins/jupyter.lua index b5171a9..a3e9653 100644 --- a/.config/nvim/lua/plugins/jupyter.lua +++ b/.config/nvim/lua/plugins/jupyter.lua @@ -17,6 +17,7 @@ return { vim.keymap.set("v", "r", ":MoltenEvaluateVisualgv", { silent = true, noremap = true, desc = "evaluate visual selection" }) end, + ft = { 'markdown', 'jupyter' } }, { -- see the image.nvim readme for more information about configuring this plugin diff --git a/.config/nvim/lua/plugins/leap.lua b/.config/nvim/lua/plugins/leap.lua index 689addd..5a57c32 100644 --- a/.config/nvim/lua/plugins/leap.lua +++ b/.config/nvim/lua/plugins/leap.lua @@ -19,4 +19,5 @@ return { -- hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = false, hint_offset = 1 }) -- end, {remap=true}) end, + enabled = false } diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua index 21dcb8d..8937a85 100644 --- a/.config/nvim/lua/plugins/lspconfig.lua +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -1,10 +1,11 @@ return { + 'neovim/nvim-lspconfig', dependencies = { - "SmiteshP/nvim-navbuddy", + -- "SmiteshP/nvim-navbuddy", {url = "http://git.sr.ht/~p00f/clangd_extensions.nvim"}, "jubnzv/virtual-types.nvim", - "ray-x/lsp_signature.nvim", + --"ray-x/lsp_signature.nvim", "folke/neodev.nvim" }, config = function() @@ -93,118 +94,84 @@ return { } } }) - local lsp_signature = require('lsp_signature') + --local lsp_signature = require('lsp_signature') -- Mappings. - local opts = { noremap=true, silent=true } - vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) - vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) - vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) - vim.api.nvim_set_keymap('n', 'E', 'lua vim.diagnostic.set_loclist()', opts) - vim.api.nvim_set_keymap("n", "q", "lua vim.lsp.buf.format{ async = true }", opts) + vim.keymap.set('n', 'e', vim.diagnostic.open_float) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next) + vim.keymap.set('n', 'E', vim.diagnostic.setloclist) -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer - local on_attach = function(client, bufnr) - --Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' - ---- See `:help vim.lsp.*` for documentation on any of the below functions - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) - --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) - --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'ClangdSwitchSourceHeader', opts) + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + --vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + --vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + --vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + --vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', '', 'ClangdSwitchSourceHeader', opts) + vim.keymap.set("n", "q", function() vim.lsp.buf.format{ async = true } end, opts) - -- require'illuminate'.on_attach(client) - require'virtualtypes'.on_attach() - require'lsp_signature'.on_attach({ - floating_window = true, - floating_window_above_cur_line = false, - floating_window_off_x = 500, - floating_window_off_y = -5, - }) - require'nvim-navbuddy'.attach(client, bufnr) - require'nvim-navic'.attach(client, bufnr) - require("clangd_extensions.inlay_hints").setup_autocmd() - require("clangd_extensions.inlay_hints").set_inlay_hints() - end + require'virtualtypes'.on_attach() + -- require'lsp_signature'.on_attach({ + -- floating_window = true, + -- floating_window_above_cur_line = true, + -- floating_window_off_x = 10, + -- floating_window_off_y = 0, + -- }) + require("clangd_extensions.inlay_hints").setup_autocmd() + require("clangd_extensions.inlay_hints").set_inlay_hints() - local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, - } - - for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) - end - - vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - signs = { - active = signs, - --severity_limit = 'info', - }, - severity_sort = true, - underline = false, - update_in_insert = false, - --virtual_text = { - -- spacing = 40, - -- severity_limit = 'Warning', - --}, - virtual_text = false, + local signs = { + { name = "DiagnosticSignError", text = "" }, + { name = "DiagnosticSignWarn", text = "" }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = "" }, } - ) + + for _, sign in ipairs(signs) do + vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) + end + + vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + signs = false, + severity_sort = true, + underline = true, + update_in_insert = false, + virtual_text = { + spacing = 30, + }, + float = true + } + ) + end + }) local capabilities = require('cmp_nvim_lsp').default_capabilities() capabilities.offsetEncoding = { "utf-16" } nvim_lsp.groovyls.setup({ cmd = { "java", "-jar", "/home/kmcr/tools/groovy-language-server/build/libs/groovy-language-server-all.jar" }, - on_attach = on_attach, - --on_publish_diagnostics = diagnostic_handler, capabilities = capabilities }) - -- nvim_lsp.ccls.setup( - -- coq.lsp_ensure_capabilities({ - -- init_options = { - -- compilationDatabaseDirectory = "."; - -- index = { - -- threads = 0; - -- }, - -- clang = { - -- excludeArgs = { "-frounding-math"} ; - -- }, - -- }, - -- root_dir = nvim_lsp.util.root_pattern("compile_commands.json"), - -- on_attach = on_attach, - -- on_publish_diagnostics = diagnostic_handler, - -- flags = { - -- debounce_text_changes = 150, - -- }} - -- ) - -- ) - nvim_lsp.clangd.setup({ - settings = { - }, - on_attach = on_attach, - --on_publish_diagnostics = diagnostic_handler, capabilities = capabilities, - -- flags = { - -- debounce_text_changes = 150, - -- } }) nvim_lsp.pylsp.setup({ @@ -216,12 +183,7 @@ return { enabled = false, }, }, - -- flags = { - -- debounce_text_changes = 150, - -- }, - on_attach = on_attach, capabilities = capabilities - --on_publish_diagnostics = diagnostic_handler, }) nvim_lsp.lua_ls.setup({ @@ -237,23 +199,29 @@ return { nvim_lsp.matlab_ls.setup({ cmd = { "matlab-language-server", "--stdio"}, filetypes = { "matlab" }, - handlers = { [ "workspace/configuration"] = function(_, _, ctx) - local client = vim.lsp.get_client_by_id(ctx.client_id) - return {client.config.settings.matlab} - end - }, + -- handlers = { [ "workspace/configuration"] = function(_, _, ctx) + -- local client = vim.lsp.get_client_by_id(ctx.client_id) + -- return {client.config.settings.matlab} + -- end + -- }, root_dir = nvim_lsp.util.find_git_ancestor, - single_file_support = false, + single_file_support = true, settings = { matlab = { - indexWorkspace = true, + indexWorkspace = false, installPath = "/usr/local/MATLAB/R2022b", matlabConnectionTiming = "onStart", telemetry = true, }, - }, - on_attach = on_attach, - capabilities = capabilities + } + }) + + nvim_lsp.typos_lsp.setup({ + cmd = { 'typos-lsp' }, + filetypes = { '*' }, + root_dir = nvim_lsp.util.root_pattern('typos.toml', '_typos.toml', '.typos.toml'), + single_file_support = true, + settings = {}, }) -- Use a loop to conveniently call 'setup' on multiple servers and @@ -261,12 +229,7 @@ return { local servers = { "cmake", "rust_analyzer", "bashls", "marksman" } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup({ - on_attach = on_attach, - --on_publish_diagnostics = diagnostic_handler, capabilities = capabilities, - -- flags = { - -- debounce_text_changes = 150, - -- } }) end end diff --git a/.config/nvim/lua/plugins/mini.lua b/.config/nvim/lua/plugins/mini.lua deleted file mode 100644 index b630528..0000000 --- a/.config/nvim/lua/plugins/mini.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "echasnovski/mini.nvim", - version = false, - config = function() - local hipatterns = require('mini.hipatterns') - hipatterns.setup({ - highlighters = { - -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' - -- fixme = { pattern = '%f[%w]()EFMC 0()%f[%W]', group = 'MiniHipatternsFixme' }, - -- hack = { pattern = '%f[%w]()Vehicle 0()%f[%W]', group = 'MiniHipatternsHack' }, - -- todo = { pattern = '%f[%w]()CoCo 0()%f[%W]', group = 'MiniHipatternsTodo' }, - -- note = { pattern = '%f[%w]()EneM 0()%f[%W]', group = 'MiniHipatternsNote' }, - - -- Highlight hex color strings (`#rrggbb`) using that color - hex_color = hipatterns.gen_highlighter.hex_color(), - }, - }) - end -} diff --git a/.config/nvim/lua/plugins/minimap.lua b/.config/nvim/lua/plugins/minimap.lua index 74687aa..ae79bf8 100644 --- a/.config/nvim/lua/plugins/minimap.lua +++ b/.config/nvim/lua/plugins/minimap.lua @@ -1,5 +1,7 @@ return { -- mm 'gorbit99/codewindow.nvim', - config = true, + config = function() + require('codewindow').apply_default_keybinds() + end, } diff --git a/.config/nvim/lua/plugins/mkdnflow.lua b/.config/nvim/lua/plugins/mkdnflow.lua index 4033a41..dc213de 100644 --- a/.config/nvim/lua/plugins/mkdnflow.lua +++ b/.config/nvim/lua/plugins/mkdnflow.lua @@ -88,5 +88,6 @@ return { MkdnFoldSection = {'n', 'f'}, MkdnUnfoldSection = {'n', 'F'} } - } + }, + enabled = false } diff --git a/.config/nvim/lua/plugins/navbuddy.lua b/.config/nvim/lua/plugins/navbuddy.lua index d4abd00..99179c3 100644 --- a/.config/nvim/lua/plugins/navbuddy.lua +++ b/.config/nvim/lua/plugins/navbuddy.lua @@ -8,5 +8,7 @@ return { config = function() require'nvim-navic'.setup() require'nvim-navbuddy'.setup() - end + vim.keymap.set('n', 'cb', ':lua require("nvim-navbuddy").open()', {noremap = true, silent = true}) + end, + enabled = false } diff --git a/.config/nvim/lua/plugins/null.lua b/.config/nvim/lua/plugins/null.lua index 9fdf270..bfb8da2 100644 --- a/.config/nvim/lua/plugins/null.lua +++ b/.config/nvim/lua/plugins/null.lua @@ -13,7 +13,6 @@ return { --null_ls.builtins.diagnostics.misspell, null_ls.builtins.diagnostics.hadolint, null_ls.builtins.diagnostics.buf, - null_ls.builtins.diagnostics.typos, --null_ls.builtins.code_actions.proselint, --null_ls.builtins.diagnostics.proselint, null_ls.builtins.hover.dictionary, diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua index 557a346..dbe58d3 100644 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -7,6 +7,7 @@ return { 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-nvim-lsp-signature-help', 'hrsh7th/cmp-path', 'hrsh7th/cmp-calc', }, @@ -15,15 +16,18 @@ return { local cmp = require'cmp' cmp.setup({ - -- snippet = { - -- expand = function(args) - -- require('snippy').expand_snippet(args.body) - -- end, - -- }, + snippet = { + expand = function(args) + require('snippy').expand_snippet(args.body) + end, + }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, + experimental = { + ghost_text = true, + }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), @@ -33,6 +37,7 @@ return { }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, { name = 'path' }, { name = 'snippy' }, { name = 'calc' }, diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua index 9e0472a..9ecd6a2 100644 --- a/.config/nvim/lua/plugins/nvim-tree.lua +++ b/.config/nvim/lua/plugins/nvim-tree.lua @@ -9,7 +9,7 @@ return { -- following options are the default -- each of these are documented in `:help nvim-tree.OPTION_NAME` require'nvim-tree'.setup { - disable_netrw = true, + disable_netrw = false, hijack_netrw = true, open_on_tab = false, hijack_cursor = true, @@ -141,5 +141,7 @@ return { }, }, } + vim.keymap.set('n', 'tt', 'NvimTreeToggle', { noremap = true, silent = true}) + vim.keymap.set('n', 'tf', 'NvimTreeFindFile', { noremap = true, silent = true}) end } diff --git a/.config/nvim/lua/plugins/obs.lua b/.config/nvim/lua/plugins/obs.lua deleted file mode 100644 index 07ef579..0000000 --- a/.config/nvim/lua/plugins/obs.lua +++ /dev/null @@ -1,31 +0,0 @@ -return { - "IlyasYOY/obs.nvim", - dependencies = { - "IlyasYOY/coredor.nvim", - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - }, - --dev = true, - config = function() - local obs = require("obs") - - obs.setup({ - vault_home = "~/notes", - journal = { - template_name = "daily", - }, - }) - - vim.keymap.set("n", "nn", "ObsNvimFollowLink") - vim.keymap.set("n", "nr", "ObsNvimRandomNote") - vim.keymap.set("n", "nN", "ObsNvimNewNote") - vim.keymap.set("n", "nd", "ObsNvimDailyNote") - vim.keymap.set("n", "nrn", "ObsNvimRename") - vim.keymap.set("n", "nT", "ObsNvimTemplate") - vim.keymap.set("n", "nM", "ObsNvimMove") - vim.keymap.set("n", "nb", "ObsNvimBacklinks") - vim.keymap.set("n", "nfj", "ObsNvimFindInJournal") - vim.keymap.set("n", "nff", "ObsNvimFindNote") - vim.keymap.set("n", "nfg", "ObsNvimFindInNotes") - end, -} diff --git a/.config/nvim/lua/plugins/quicknote.lua b/.config/nvim/lua/plugins/quicknote.lua index 0ccc049..693c050 100644 --- a/.config/nvim/lua/plugins/quicknote.lua +++ b/.config/nvim/lua/plugins/quicknote.lua @@ -4,5 +4,12 @@ return { 'nvim-lua/plenary.nvim' }, config = true, + +-- -- quicknote +-- map('n', 'qn', 'lua require("quicknote").NewNoteAtCurrentLine()', default_options) +-- map('n', 'qs', 'lua require("quicknote").ShowNoteSigns()', default_options) +-- map('n', 'qe', 'lua require("quicknote").OpenNoteAtCurrentLine()', default_options) +-- map('n', 'qd', 'lua require("quicknote").DeleteNoteAtCurrentLine()', default_options) + enabled = false } diff --git a/.config/nvim/lua/plugins/search.lua b/.config/nvim/lua/plugins/search.lua index e04e563..ba40940 100644 --- a/.config/nvim/lua/plugins/search.lua +++ b/.config/nvim/lua/plugins/search.lua @@ -1,5 +1,6 @@ return { 'nvimdev/hlsearch.nvim', event = 'BufRead', - config = true + config = true, + enabled = false, } diff --git a/.config/nvim/lua/plugins/specs.lua b/.config/nvim/lua/plugins/specs.lua index e8f440e..98c2d53 100644 --- a/.config/nvim/lua/plugins/specs.lua +++ b/.config/nvim/lua/plugins/specs.lua @@ -6,7 +6,7 @@ return { min_jump = 30, popup = { delay_ms = 0, -- delay before popup displays - inc_ms = 10, -- time increments used for fade/resize effects + inc_ms = 10, -- time increments used for fade/resize effects blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend width = 10, winhl = "PMenu", @@ -18,5 +18,14 @@ return { nofile = true, }, } - end + local map = vim.keymap.set + local def = { noremap = true, silent = true } + map('n', 'n', 'nlua require("specs").show_specs()', def) + map('n', 'N', 'Nlua require("specs").show_specs()', def) + map('n', '', function() + vim.cmd.noh() + require("specs").show_specs({width = 97, winhl = "Search", delay_ms = 100, inc_ms = 21}) + end, def) + end, + enabled = false } diff --git a/.config/nvim/lua/plugins/symbol-usage.lua b/.config/nvim/lua/plugins/symbol-usage.lua index 5f60302..8733564 100644 --- a/.config/nvim/lua/plugins/symbol-usage.lua +++ b/.config/nvim/lua/plugins/symbol-usage.lua @@ -2,8 +2,58 @@ return { 'Wansmer/symbol-usage.nvim', event = 'BufReadPre', -- need run before LspAttach if you use nvim 0.9. On 0.10 use 'LspAttach' config = function() + local function h(name) return vim.api.nvim_get_hl(0, { name = name }) end + + -- hl-groups can have any name + vim.api.nvim_set_hl(0, 'SymbolUsageRounding', { fg = h('CursorLine').bg, italic = true }) + vim.api.nvim_set_hl(0, 'SymbolUsageContent', { bg = h('CursorLine').bg, fg = h('Comment').fg, italic = true }) + vim.api.nvim_set_hl(0, 'SymbolUsageRef', { fg = h('Function').fg, bg = h('CursorLine').bg, italic = true }) + vim.api.nvim_set_hl(0, 'SymbolUsageDef', { fg = h('Type').fg, bg = h('CursorLine').bg, italic = true }) + vim.api.nvim_set_hl(0, 'SymbolUsageImpl', { fg = h('@keyword').fg, bg = h('CursorLine').bg, italic = true }) + + local function text_format(symbol) + local res = {} + + -- local round_start = { '', 'SymbolUsageRounding' } + -- local round_end = { '', 'SymbolUsageRounding' } + + if symbol.references then + local usage = symbol.references <= 1 and 'usage' or 'usages' + local num = symbol.references == 0 and 'no' or symbol.references + --table.insert(res, round_start) + table.insert(res, { '󰌹 ', 'SymbolUsageRef' }) + table.insert(res, { ('%s %s'):format(num, usage), 'SymbolUsageContent' }) + --table.insert(res, round_end) + end + + if symbol.definition then + if #res > 0 then + table.insert(res, { ' ', 'NonText' }) + end + --table.insert(res, round_start) + table.insert(res, { '󰳽 ', 'SymbolUsageDef' }) + table.insert(res, { symbol.definition .. ' defs', 'SymbolUsageContent' }) + --table.insert(res, round_end) + end + + if symbol.implementation then + if #res > 0 then + table.insert(res, { ' ', 'NonText' }) + end + --table.insert(res, round_start) + table.insert(res, { '󰡱 ', 'SymbolUsageImpl' }) + table.insert(res, { symbol.implementation .. ' impls', 'SymbolUsageContent' }) + --table.insert(res, round_end) + end + + return res + end require('symbol-usage').setup({ - vt_position = "textwidth" + vt_position = "above", + references = { enabled = true, include_declaration = true }, + definition = { enabled = true }, + implementation = { enabled = true }, + text_format = text_format, }) end } diff --git a/.config/nvim/lua/plugins/symbols-outline.lua b/.config/nvim/lua/plugins/symbols-outline.lua index 80e0cc4..86c4eee 100644 --- a/.config/nvim/lua/plugins/symbols-outline.lua +++ b/.config/nvim/lua/plugins/symbols-outline.lua @@ -1,4 +1,5 @@ return { 'hedyhli/outline.nvim', - config = true + config = true, + cmd = { 'OutlineOpen' } } diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 38e491e..6e80cde 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -32,5 +32,28 @@ return { require('telescope').load_extension('undo') require('telescope').load_extension('menufacture') require("telescope").load_extension("emoji") + local def = { noremap = true, silent = true } + local map = vim.keymap.set + map('n', 'r', 'lua require("telescope.builtin").resume()', def) + map('n', 'f', 'lua require("telescope").extensions.menufacture.find_files()', def) + map('n', 'a', 'lua require("telescope").extensions.menufacture.grep_string()', def) + map('n', 's', 'lua require("telescope").extensions.menufacture.live_grep()', def) + map('n', 'b', 'lua require("telescope.builtin").buffers()', def) + -- map('n', 'fh', 'lua require('telescope.builtin').help_tags(), def) + map('n', 'tc', 'lua require("telescope.builtin").commands()', def) + map('n', 't:', 'lua require("telescope.builtin").command_history()', def) + map('n', 't/', 'lua require("telescope.builtin").search_history()', def) + map('n', 'tr', 'lua require("telescope.builtin").registers()', def) + -- Neovim lsp pickers + map('n', 'gr', 'lua require("telescope.builtin").lsp_references()', def) + map('n', 'gd', 'lua require("telescope.builtin").lsp_definitions()', def) + -- git pickers + -- map('n', 'gc', 'lua require("telescope.builtin").git_commits()', def) + -- map('n', 'gC', 'lua require("telescope.builtin").git_bcommits()', def) + -- map('n', 'gb', 'lua require("telescope.builtin").git_branches()', def) + -- other + -- map('n', 's', 'lua require('telescope').extensions.ultisnips.ultisnips(), def) + map('n', 'u', 'lua require("telescope").extensions.undo.undo()', def) + end } diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 6e7b5ed..14f3c03 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -3,7 +3,6 @@ return { dependencies = { 'mizlan/iswap.nvim', 'romgrk/nvim-treesitter-context', - 'Wansmer/sibling-swap.nvim', --"nvim-treesitter/nvim-treesitter-textobjects", --"nvim-treesitter/playground", }, @@ -17,11 +16,7 @@ return { highlight = { enable = true, disable = function(lang, buf) - local max_filesize = 100 * 1024 -- 100 KB - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then - return true - end + return vim.api.nvim_buf_line_count(buf) > 5000 end, additional_vim_regex_highlighting = false, }, @@ -86,6 +81,5 @@ return { } -- vim.opt.foldmethod = "expr" -- vim.opt.foldexpr = "nvim_treesitter#foldexpr()" - require('sibling-swap').setup({}) end } diff --git a/.config/nvim/lua/plugins/windows.lua b/.config/nvim/lua/plugins/windows.lua index ef4c5e6..e138681 100644 --- a/.config/nvim/lua/plugins/windows.lua +++ b/.config/nvim/lua/plugins/windows.lua @@ -8,5 +8,11 @@ return { vim.o.winwidth = 10 vim.o.winminwidth = 10 require("windows").setup() + local map = vim.keymap.set + local default_options = { noremap = true, silent = true } + map('n', 'z', "WindowsMaximize", default_options) + map('n', '_', "WindowsMaximizeVertically", default_options) + map('n', '|', "WindowsMaximizeHorizontally", default_options) + map('n', '=', "WindowsEqualize", default_options) end }