diff options
Diffstat (limited to 'modules/by-name/nv/nvim/plgs')
26 files changed, 268 insertions, 869 deletions
diff --git a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix index b404843e..68a88d32 100644 --- a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix @@ -26,6 +26,7 @@ in { }; }; }; + keymaps = [ { key = "gcc"; diff --git a/modules/by-name/nv/nvim/plgs/debugprint/default.nix b/modules/by-name/nv/nvim/plgs/debugprint/default.nix deleted file mode 100644 index 79e557bd..00000000 --- a/modules/by-name/nv/nvim/plgs/debugprint/default.nix +++ /dev/null @@ -1,82 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - # TODO: package debugprint though a module - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/debugprint.lua} - ''; - extraPlugins = [ - pkgs.vimExtraPlugins.debugprint-nvim - ]; - - keymaps = [ - { - key = "g?v"; - mode = ["v" "n"]; - action.__raw = '' - function() - return require('debugprint').debugprint({variable = true;}); - end - ''; - options.expr = true; - options.desc = '' - 'variable' debug line below the current line - ''; - } - { - key = "g?V"; - mode = ["v" "n"]; - action.__raw = '' - function() - return require('debugprint').debugprint({above = true; variable = true;}) ; - end - ''; - options.expr = true; - options.desc = '' - 'variable' debug line above the current line - ''; - } - { - key = "g?p"; - mode = "n"; - action.__raw = '' - function() - return require('debugprint').debugprint(); - end - ''; - options.expr = true; - options.desc = '' - 'plain' debug line below the current line - ''; - } - { - key = "g?P"; - mode = "n"; - action.__raw = '' - function() - return require('debugprint').debugprint({above = true;}); - end - ''; - options.expr = true; - options.desc = '' - 'plain' debug line above the current line - ''; - } - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua b/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua deleted file mode 100644 index b934d619..00000000 --- a/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua +++ /dev/null @@ -1,13 +0,0 @@ --- nixos-config - My current NixOS configuration --- --- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> --- SPDX-License-Identifier: GPL-3.0-or-later --- --- This file is part of my nixos-config. --- --- You should have received a copy of the License along with this program. --- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. - -require("debugprint").setup({ - create_keymaps = false, -}) diff --git a/modules/by-name/nv/nvim/plgs/default.nix b/modules/by-name/nv/nvim/plgs/default.nix deleted file mode 100644 index aaebb3b1..00000000 --- a/modules/by-name/nv/nvim/plgs/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{...}: { - imports = - [ - # Plugins not yet packaged in nixpkgs - # ./debugprint - ./lf-nvim - # ./lsp-progress-nvim - ] - ++ [ - # Already packaged in nixpkgs - ./colorscheme - ./comment-nvim - ./femaco - ./flatten-nvim - ./goto-preview - ./harpoon - ./leap - ./lsp - ./lspkind - ./ltex_extra - ./lualine - ./luasnip - ./neorg - ./nvim-cmp - ./nvim-lint - ./raw_plugins - ./telescope - ./todo-comments - ./treesitter - ./vim-tex - ./which-key - ]; -} diff --git a/modules/by-name/nv/nvim/plgs/femaco/default.nix b/modules/by-name/nv/nvim/plgs/femaco/default.nix index a30bb59f..eac6b393 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/default.nix +++ b/modules/by-name/nv/nvim/plgs/femaco/default.nix @@ -8,21 +8,22 @@ # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - pkgs, lib, config, ... }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - # TODO: package femaco through a module + # TODO: Re-active this plugin, when it does no longer depend on `treesitter-legacy` <2026-01-18> + home-manager.users.soispha.programs.nixvim = lib.mkIf false { + plugins.femaco = { + enable = true; + }; + extraConfigLuaPost = '' ${lib.strings.fileContents ./lua/femaco.lua} ''; - extraPlugins = [ - pkgs.vimPlugins.nvim-FeMaco-lua - ]; + keymaps = [ { key = "<leader>cc"; diff --git a/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua b/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua index 1371a825..4dc9ce97 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua +++ b/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua @@ -9,6 +9,7 @@ -- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. local clip_val = require("femaco.utils").clip_val + require("femaco").setup({ -- should prepare a new buffer and return the winid -- by default opens a floating window @@ -18,6 +19,7 @@ require("femaco").setup({ local buf = vim.api.nvim_create_buf(false, false) return vim.api.nvim_open_win(buf, true, opts) end, + -- should return options passed to nvim_open_win -- @param code_block: data about the code-block with the keys -- * range @@ -26,7 +28,7 @@ require("femaco").setup({ float_opts = function(code_block) return { relative = "cursor", - width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10), -- TODO: how to offset sign column etc? + width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10), -- TODO how to offset sign column etc? height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6), anchor = "NW", row = 0, @@ -36,19 +38,24 @@ require("femaco").setup({ zindex = 1, } end, + -- return filetype to use for a given lang -- lang can be nil ft_from_lang = function(lang) return lang end, + -- what to do after opening the float post_open_float = function(winnr) vim.wo.signcolumn = "no" end, + -- create the path to a temporary file create_tmp_filepath = function(filetype) return os.tmpname() end, + -- if a newline should always be used, useful for multiline injections -- which separators needs to be on separate lines such as markdown, neorg etc -- @param base_filetype: The filetype which FeMaco is called from, not the -- filetype of the injected language (this is the current buffer so you can -- get it from vim.bo.filetyp). - ensure_newline = function(base_filetype) return false end, + ensure_newline = function(base_filetype) return base_filetype == "nix" end, + -- Return true if the indentation should be normalized. Useful when the -- injected language inherits indentation from the construction scope (e.g. an -- inline multiline sql string). If true, the leading indentation is detected, @@ -57,5 +64,5 @@ require("femaco").setup({ -- @param base_filetype: The filetype which FeMaco is called from, not the -- filetype of the injected language (this is the current buffer, so you can -- get it from vim.bo.filetype). - normalize_indent = function(base_filetype) return false end, + normalize_indent = function(base_filetype) return base_filetype == "nix" end, }) diff --git a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix b/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix deleted file mode 100644 index 8d61d859..00000000 --- a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - # TODO: Get this plugin working again <2025-01-29> - home-manager.users.soispha.programs.nixvim = lib.mkIf false { - # TODO: package flatten-nvim though a module - - extraConfigLuaPre = '' - ${lib.strings.fileContents ./lua/flatten-nvim.lua} - if os.getenv("NVIM") ~= nil then - -- Avoid loading plugins because the host will take control of the instance anyways - return - end - ''; - extraPlugins = [ - pkgs.vimPlugins.flatten-nvim - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua b/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua deleted file mode 100644 index 0c86cd27..00000000 --- a/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua +++ /dev/null @@ -1,114 +0,0 @@ --- nixos-config - My current NixOS configuration --- --- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> --- SPDX-License-Identifier: GPL-3.0-or-later --- --- This file is part of my nixos-config. --- --- You should have received a copy of the License along with this program. --- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. - ----Types: --- --- Passed to callbacks that handle opening files ----@alias BufInfo { fname: string, bufnr: buffer } --- --- Needed aliases ----@alias buffer integer: Buffer id ----@alias window integer: Window id --- --- The first argument is a list of BufInfo tables representing the newly opened files. --- The third argument is a single BufInfo table, only provided when a buffer is created from stdin. --- --- IMPORTANT: For `block_for` to work, you need to return a buffer number OR a buffer number and a window number. --- The `winnr` return value is not required, `vim.fn.bufwinid(bufnr)` is used if it is not provided. --- The `filetype` of this buffer will determine whether block should happen or not. --- ----@alias OpenHandler fun(files: BufInfo[], argv: string[], stdin_buf: BufInfo, guest_cwd: string):window, buffer --- -require("flatten").setup({ - callbacks = { - ---Called to determine if a nested session should wait for the host to close the file. - ---param argv: a list of all the arguments in the nested session - ---@type fun(argv: table): boolean - should_block = require("flatten").default_should_block, - - ---If this returns true, the nested session will be opened. - ---If false, default behavior is used, and - ---config.nest_if_no_args is respected. - ---@type fun(host: channel):boolean - should_nest = require("flatten").default_should_nest, - - ---Called before a nested session is opened. - pre_open = function() end, - - ---Called after a nested session is opened. - ---@param bufnr buffer - ---@param winnr window - ---@param filetype string - ---@param is_blocking boolean - ---@param is_diff boolean - post_open = function(bufnr, winnr, filetype, is_blocking, is_diff) - -- If the file is a git commit, create one-shot autocmd to delete its buffer on write - if filetype == "gitcommit" or filetype == "gitrebase" then - vim.api.nvim_create_autocmd("BufWritePost", { - buffer = bufnr, - once = true, - callback = vim.schedule_wrap(function() vim.api.nvim_buf_delete(bufnr, {}) end), - }) - end - end, - - ---Called when a nested session is done waiting for the host. - ---@param filetype string - block_end = function(filetype) end, - }, - -- <String, Bool> dictionary of filetypes that should be blocking - block_for = { - gitcommit = true, - }, - -- Command passthrough - allow_cmd_passthrough = true, - -- Allow a nested session to open if Neovim is opened without arguments - nest_if_no_args = false, - -- Window options - window = { - -- Options: - -- current -> open in current window (default) - -- alternate -> open in alternate window (recommended) - -- tab -> open in new tab - -- split -> open in split - -- vsplit -> open in vsplit - -- smart -> smart open (avoids special buffers) - -- OpenHandler -> allows you to handle file opening yourself (see Types) - -- - -- TODO: Open gitcommit filetypes in the current buffer, everything else in a new tab <2023-08-29> - open = "split", - - -- Options: - -- vsplit -> opens files in diff vsplits - -- split -> opens files in diff splits - -- tab_vsplit -> creates a new tabpage, and opens diff vsplits - -- tab_split -> creates a new tabpage, and opens diff splits - -- OpenHandler -> allows you to handle file opening yourself (see Types) - diff = "tab_vsplit", - - -- Affects which file gets focused when opening multiple at once - -- Options: - -- "first" -> open first file of new files (default) - -- "last" -> open last file of new files - focus = "first", - }, - -- Override this function to use a different socket to connect to the host - -- On the host side this can return nil or the socket address. - -- On the guest side this should return the socket address - -- or a non-zero channel id from `sockconnect` - -- flatten.nvim will detect if the address refers to this instance of nvim, to determine if this is a host or a guest - pipe_path = require("flatten").default_pipe_path, - -- The `default_pipe_path` will treat the first nvim instance within a single kitty/wezterm session as the host - -- You can configure this behaviour using the following: - one_per = { - kitty = true, -- Flatten all instance in the current Kitty session - wezterm = true, -- Flatten all instance in the current Wezterm session - }, -}) diff --git a/modules/by-name/nv/nvim/plgs/leap/default.nix b/modules/by-name/nv/nvim/plgs/leap/default.nix deleted file mode 100644 index e5c42d2f..00000000 --- a/modules/by-name/nv/nvim/plgs/leap/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.leap = { - enable = true; - addDefaultMappings = false; # They don't work with dvorak. - safeLabels = [ - "f" - "j" - "k" - "l" - "/" - "z" - "S" - "F" - "J" - "K" - "L" - "H" - "W" - "E" - "M" - "B" - "U" - "X" - "?" - "Z" - ]; - }; - keymaps = [ - { - key = "j"; - action = "<Plug>(leap-forward-to)"; - options.desc = "jump forward to"; - } - { - key = "J"; - action = "<Plug>(leap-backward-to)"; - options.desc = "jump backward to"; - } - { - key = "gj"; - action = "<Plug>(leap-from-window)"; - options.desc = "jump to enterable windows"; - } - /* - {key= "x"; - mode = "v"; - action = "<Plug>(leap-forward-till)"; - options.desc = "leap forward till"; - } - {key= "X"; - mode = "v"; - action = "<Plug>(leap-backward-till)"; - options.desc = "leap backward till"; - } - */ - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix index 3a1c6bf9..e652a60d 100644 --- a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix @@ -8,21 +8,88 @@ # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - pkgs, lib, config, ... }: let cfg = config.soispha.programs.nvim; in { - # TODO: package lf-nvim though a module # TODO: change the nvim path, when I change the path with lf home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/lf-nvim.lua} - ''; - extraPlugins = [ - pkgs.vimPlugins.lf-nvim - ]; + plugins.lf = { + enable = true; + + settings = { + default_actions = { + "<C-o>" = "tab drop"; + "<C-t>" = "tabedit"; + "<C-v>" = "vsplit"; + "<C-x>" = "split"; + }; + + default_action = "drop"; + + winblend = 10; + dir = ""; + direction = "float"; + border = "rounded"; + height.__raw = "vim.fn.float2nr(vim.fn.round(0.75 * vim.o.lines))"; + width.__raw = "vim.fn.float2nr(vim.fn.round(0.75 * vim.o.columns))"; + escape_quit = true; + focus_on_open = true; + mappings = true; + tmux = false; + default_file_manager = true; + disable_netrw_warning = true; + highlights = { + Normal = {link = "Normal";}; + NormalFloat = {link = "Normal";}; + FloatBorder = { + guifg = "#cdcbe0"; + guibg = "#191726"; + }; + }; + + layout_mapping = "<M-u>"; + views = [ + { + width = 0.800; + height = 0.800; + } + { + width = 0.600; + height = 0.600; + } + { + width = 0.950; + height = 0.950; + } + { + width = 0.500; + height = 0.500; + col = 0; + row = 0; + } + { + width = 0.500; + height = 0.500; + col = 0; + row = 0.5; + } + { + width = 0.500; + height = 0.500; + col = 0.5; + row = 0; + } + { + width = 0.500; + height = 0.500; + col = 0.5; + row = 0.5; + } + ]; + }; + }; }; } diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua b/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua deleted file mode 100644 index 8c40ab50..00000000 --- a/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua +++ /dev/null @@ -1,53 +0,0 @@ --- nixos-config - My current NixOS configuration --- --- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> --- SPDX-License-Identifier: GPL-3.0-or-later --- --- This file is part of my nixos-config. --- --- You should have received a copy of the License along with this program. --- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. - -local fn = vim.fn - --- Defaults -require("lf").setup({ - default_action = "drop", -- default action when `Lf` opens a file - -- TODO: what do these mappings do? - default_actions = { -- default action keybindings - ["<C-t>"] = "tabedit", - ["<C-x>"] = "split", - ["<C-v>"] = "vsplit", - ["<C-o>"] = "tab drop", - }, - - winblend = 10, -- psuedotransparency level - dir = "", -- directory where `lf` starts ('gwd' is git-working-directory, ""/nil is CWD) - direction = "float", -- window type: float horizontal vertical - border = "rounded", -- border kind: single double shadow curved - height = fn.float2nr(fn.round(0.75 * vim.o.lines)), -- height of the *floating* window - width = fn.float2nr(fn.round(0.75 * vim.o.columns)), -- width of the *floating* window - escape_quit = true, -- map escape to the quit command (so it doesn't go into a meta normal mode) - focus_on_open = true, -- focus the current file when opening Lf (experimental) - mappings = true, -- whether terminal buffer mapping is enabled - tmux = false, -- tmux statusline can be disabled on opening of Lf - default_file_manager = true, -- make lf default file manager - disable_netrw_warning = true, -- don't display a message when opening a directory with `default_file_manager` as true - highlights = { -- highlights passed to toggleterm - Normal = { link = "Normal" }, - NormalFloat = { link = "Normal" }, - FloatBorder = { guifg = "#cdcbe0", guibg = "#191726" }, - }, - - -- Layout configurations - layout_mapping = "<M-u>", -- resize window with this key - views = { -- window dimensions to rotate through - { width = 0.800, height = 0.800 }, - { width = 0.600, height = 0.600 }, - { width = 0.950, height = 0.950 }, - { width = 0.500, height = 0.500, col = 0, row = 0 }, - { width = 0.500, height = 0.500, col = 0, row = 0.5 }, - { width = 0.500, height = 0.500, col = 0.5, row = 0 }, - { width = 0.500, height = 0.500, col = 0.5, row = 0.5 }, - }, -}) diff --git a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix deleted file mode 100644 index 85458310..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix +++ /dev/null @@ -1,62 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - # TODO: package lsp-progress-nvim though a module - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/lsp-progress-nvim.lua} - ''; - extraPlugins = [ - pkgs.vimExtraPlugins.lsp-progress-nvim - ]; - - # Status line setup - autoGroups.lsp_refresh.clear = true; - autoCmd = [ - { - event = ["User LspProgressStatusUpdated"]; - pattern = ["*"]; - callback = - /* - lua - */ - { - __raw = '' - require("lualine").refresh - ''; - }; - group = "lsp_refresh"; - description = "Refresh the statusbar when the lsp status was updated."; - } - ]; - plugins.lualine = let - get_lsp_progress = { - __raw = - /* - lua - */ - '' - require('lsp-progress').progress - ''; - }; - in { - sections = { - lualine_c = [{name = get_lsp_progress;}]; - }; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua deleted file mode 100644 index 2886d821..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua +++ /dev/null @@ -1,156 +0,0 @@ --- nixos-config - My current NixOS configuration --- --- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> --- SPDX-License-Identifier: GPL-3.0-or-later --- --- This file is part of my nixos-config. --- --- You should have received a copy of the License along with this program. --- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. - ---- @type table<string, any> -require("lsp-progress").setup({ - -- Spinning icons. - -- - --- @type string[] - spinner = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }, - - -- Spinning update time in milliseconds. - -- - --- @type integer - spin_update_time = 200, - - -- Last message cached decay time in milliseconds. - -- - -- Message could be really fast(appear and disappear in an - -- instant) that user cannot even see it, thus we cache the last message - -- for a while for user view. - -- - --- @type integer - decay = 700, - - -- User event name. - -- - --- @type string - event = "LspProgressStatusUpdated", - - -- Event update time limit in milliseconds. - -- - -- Sometimes progress handler could emit many events in an instant, while - -- refreshing statusline cause too heavy synchronized IO, so we limit the - -- event rate to reduce this cost. - -- - --- @type integer - event_update_time_limit = 100, - - -- Max progress string length, by default -1 is unlimited. - -- - --- @type integer - max_size = -1, - - -- Regular internal update time. - -- - -- Emit user event to update the lsp progress status, even there's no new - -- message. - -- - --- @type integer - regular_internal_update_time = 500, - - -- Disable emitting events on specific mode/filetype. - -- User events would interrupt insert mode, thus break which-key like plugins behaviour. - -- See: - -- * https://github.com/linrongbin16/lsp-progress.nvim/issues/50 - -- * https://neovim.io/doc/user/builtin.html#mode() - -- - --- @type table[] - disable_events_opts = { { mode = "i", filetype = "TelescopePrompt" } }, - - -- Format series message. - -- - -- By default it looks like: `formatting isort (100%) - done`. - -- - --- @param title string|nil - --- Message title. - --- @param message string|nil - --- Message body. - --- @param percentage number|nil - --- Progress in percentage numbers: 0-100. - --- @param done boolean - --- Indicate whether this series is the last one in progress. - --- @return string|nil messages - --- The returned value will be passed to function `client_format` as - --- one of the `series_messages` array, or ignored if return nil. - series_format = function(title, message, percentage, done) - local builder = {} - local has_title = false - local has_message = false - if title and title ~= "" then - table.insert(builder, title) - has_title = true - end - if message and message ~= "" then - table.insert(builder, message) - has_message = true - end - if percentage and (has_title or has_message) then table.insert(builder, string.format("(%.0f%%%%)", percentage)) end - if done and (has_title or has_message) then table.insert(builder, "- done") end - return table.concat(builder, " ") - end, - - -- Format client message. - -- - -- By default it looks like: - -- `[null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)`. - -- - --- @param client_name string - --- Client name. - --- @param spinner string - --- Spinner icon. - --- @param series_messages string[]|table[] - --- Messages array. - --- @return string|nil messages - --- The returned value will be passed to function `format` as one of the - --- `client_messages` array, or ignored if return nil. - client_format = function(client_name, spinner, series_messages) - return #series_messages > 0 - and ("[" .. client_name .. "] " .. spinner .. " " .. table.concat(series_messages, ", ")) - or nil - end, - - -- Format (final) message. - -- - -- By default it looks like: - -- ` LSP [null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)` - -- - --- @param client_messages string[]|table[] - --- Client messages array. - --- @return nil|string message - --- The returned value will be returned from `progress` API. - format = function(client_messages) - local sign = " LSP" -- nf-fa-gear \uf013 - return #client_messages > 0 and (sign .. " " .. table.concat(client_messages, " ")) or sign - end, - - -- Enable debug. - -- - --- @type boolean - debug = false, - - -- Print log to console(command line). - -- - --- @type boolean - console_log = false, - - -- Print log to file. - -- - --- @type boolean - file_log = true, - - -- Log file to write, work with `file_log=true`. - -- - -- For Windows: `$env:USERPROFILE\AppData\Local\nvim-data\lsp-progress.log`. - -- For *NIX: `~/.local/share/nvim/lsp-progress.log`. - -- - --- @type string - file_log_name = "lsp-progress.log", -}) diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix index 8ff130fe..0e7be6e8 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix @@ -9,16 +9,16 @@ # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { imports = [ - # ./servers/pylyzer.nix ./servers/bashls.nix ./servers/ccls.nix - ./servers/quick-lint-js.nix ./servers/ltex.nix ./servers/lua-ls.nix ./servers/nil-ls.nix ./servers/openscad.nix + ./servers/quick-lint-js.nix ./servers/ruff-lsp.nix ./servers/rust-analyzer.nix ./servers/texlab.nix + ./servers/zls.nix ]; } diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix index fba1113f..1d516c9d 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix @@ -21,13 +21,28 @@ in { lua */ '' - require('lspconfig').openscad_lsp.setup{ - cmd = {"openscad-lsp", "--stdio", "--fmt-style", "WebKit"}, + vim.lsp.config['openscad_lsp'] = { + cmd = {"openscad-lsp", "--stdio", "--fmt-style", "WebKit"}, } + vim.lsp.enable("openscad_lsp") ''; - extraPackages = with pkgs; [ - openscad-lsp - clang-tools # Need to satisfy `clang-format` (which is used by openscad-lsp) + + autoCmd = [ + { + command = "set filetype=openscad"; + event = [ + "BufRead" + "BufNewFile" + ]; + pattern = [ + "*.scad" + ]; + } + ]; + + extraPackages = [ + pkgs.openscad-lsp + pkgs.clang-tools # Need to satisfy `clang-format` (which is used by openscad-lsp) ]; }; } diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix index 82d3b5a9..097abfbe 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix @@ -21,11 +21,11 @@ in { lua */ '' - require('lspconfig').quick_lint_js.setup{ - } + vim.lsp.enable('quick_lint_js') ''; - extraPackages = with pkgs; [ - quick-lint-js + + extraPackages = [ + pkgs.quick-lint-js ]; }; } diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix index 4f9834ee..3ad3ad8f 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix @@ -21,6 +21,6 @@ in { enable = true; }; }; - extraPackages = with pkgs; [ruff]; + extraPackages = [pkgs.ruff]; }; } diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls.nix index 47e8de7a..aab7a135 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls.nix @@ -8,8 +8,8 @@ # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - config, lib, + config, pkgs, ... }: let @@ -21,8 +21,10 @@ in { lua */ '' - require('lspconfig').pylyzer.setup{} + vim.lsp.enable("zls") ''; - extraPackages = with pkgs; [pylyzer]; + extraPackages = [ + pkgs.zls + ]; }; } diff --git a/modules/by-name/nv/nvim/plgs/lspkind/default.nix b/modules/by-name/nv/nvim/plgs/lspkind/default.nix index 6e966ad1..3846fa32 100644 --- a/modules/by-name/nv/nvim/plgs/lspkind/default.nix +++ b/modules/by-name/nv/nvim/plgs/lspkind/default.nix @@ -16,6 +16,6 @@ in { home-manager.users.soispha.programs.nixvim.plugins.lspkind = lib.mkIf cfg.enable { enable = true; - preset = "default"; # "codicons" is only for a font patched with vscode-codeicons. + settings.preset = "default"; # "codicons" is only for a font patched with vscode-codeicons. }; } diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua index 371f5539..8c30063e 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua @@ -20,21 +20,20 @@ local get_comment_string = function(comment_type) local utils = require("Comment.utils") -- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`) - local cstring = - calculate_comment_string({ ctype = comment_type; range = utils.get_region(); }) + local cstring = calculate_comment_string({ ctype = comment_type, range = utils.get_region() }) if cstring == nil then -- TODO: Use `vim.bo.commentstring` <2025-05-02> -- Use some useful default values. - return { ["begin"] = "#"; ["end"] = ""; } + return { ["begin"] = "#", ["end"] = "" } end -- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side local left, right = utils.unwrap_cstr(cstring) -- create a `{left, right}` table for it - return { ["begin"] = left; ["end"] = right; } + return { ["begin"] = left, ["end"] = right } end --- Wraps a table of snippet nodes in two comment function nodes. @@ -45,18 +44,13 @@ end local wrap_snippet_in_comments = function(comment_type, nodes) local output = {} - table.insert(output, ls.function_node(function() - return get_comment_string(comment_type)["begin"] - end)) - + table.insert(output, ls.function_node(function() return get_comment_string(comment_type)["begin"] end)) for _, v in ipairs(nodes) do table.insert(output, v) end - table.insert(output, ls.function_node(function() - return get_comment_string(comment_type)["end"] - end)) + table.insert(output, ls.function_node(function() return get_comment_string(comment_type)["end"] end)) return output end @@ -91,42 +85,36 @@ local function pair(pair_begin, pair_end, file_types, condition_function) -- It would be nice, if it would support both an empty array (`{}`) and nil <2023-08-27> -- file_types = file_types or {}; - return ls.snippet( - { - trig = pair_begin; - wordTrig = false; - snippetType = "autosnippet"; - }, - { - ls.text_node({ pair_begin; }); - ls.dynamic_node(1, get_visual); - ls.text_node({ pair_end; }); - }, - { - condition = function() - local filetype_check = true + return ls.snippet({ + trig = pair_begin, + wordTrig = false, + snippetType = "autosnippet", + }, { + ls.text_node({ pair_begin }), + ls.dynamic_node(1, get_visual), + ls.text_node({ pair_end }), + }, { + condition = function() + local filetype_check = true - if file_types ~= nil then - filetype_check = file_types[vim.bo.filetype] or false - end + if file_types ~= nil then filetype_check = file_types[vim.bo.filetype] or false end - return (not condition_function(pair_begin, pair_end)) and filetype_check - end; - } - ) + return (not condition_function(pair_begin, pair_end)) and filetype_check + end, + }) end local auto_pairs = { - pair("(", ")", nil, char_count_same); - pair("{", "}", nil, char_count_same); - pair("[", "]", nil, char_count_same); - pair("<", ">", { ["rust"] = true; ["tex"] = true; }, char_count_same); - pair("'", "'", nil, even_count); - pair("\"", "\"", nil, even_count); - pair("`", "`", nil, even_count); + pair("(", ")", nil, char_count_same), + pair("{", "}", nil, char_count_same), + pair("[", "]", nil, char_count_same), + pair("<", ">", { ["rust"] = true, ["tex"] = true }, char_count_same), + pair("'", "'", nil, even_count), + pair("\"", "\"", nil, even_count), + pair("`", "`", nil, even_count), } -ls.add_snippets("all", auto_pairs, { type = "snippets"; key = "auto_pairs"; }) +ls.add_snippets("all", auto_pairs, { type = "snippets", key = "auto_pairs" }) -- }}} -- todo_comments {{{ @@ -134,9 +122,7 @@ local read_git_config = function(config_value) local command = string.format("git config \"%s\"", config_value) local handle = io.popen(command) - if handle == nil then - return error(string.format("Failed to call `%s`.", command)) - end + if handle == nil then return error(string.format("Failed to call `%s`.", command)) end local result = handle:read("*a") handle:close() @@ -199,14 +185,17 @@ local todo_snippet = function(trig, name, comment_type, mark_function) local date_node, signature_node = mark_function() - local nodes = fmt("{} {}{}: {} {} {}", wrap_snippet_in_comments(comment_type, { - ls.text_node(name); - signature_node; - ls.insert_node(1, "content"); - date_node; - })) + local nodes = fmt( + "{} {}{}: {} {} {}", + wrap_snippet_in_comments(comment_type, { + ls.text_node(name), + signature_node, + ls.insert_node(1, "content"), + date_node, + }) + ) - return ls.snippet(context, nodes, { ctype = comment_type; }) + return ls.snippet(context, nodes, { ctype = comment_type }) end ---@param trigger string: The luasnip trigger @@ -214,26 +203,18 @@ end ---@param name string: All aliases for a name ---@return table: All possible snippets build from the marks local process_marks = function(trigger, name, comment_type) - local username = function() - return handle_from_name(read_git_config("user.name")) - end + local username = function() return handle_from_name(read_git_config("user.name")) end local marks = { - signature = function() - return ls.text_node("(" .. username() .. ")"), ls.text_node("") - end; + signature = function() return ls.text_node("(" .. username() .. ")"), ls.text_node("") end, date_signature = function() return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("(" .. username() .. ")") - end; + end, - date = function() - return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("") - end; + date = function() return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("") end, - empty = function() - return ls.text_node(""), ls.text_node("") - end; + empty = function() return ls.text_node(""), ls.text_node("") end, } local output = {} @@ -247,20 +228,20 @@ local process_marks = function(trigger, name, comment_type) end local todo_snippet_specs = { - { { trig = "todo"; }; { "TODO"; }; { ctype = 1; }; }; - { { trig = "fix"; }; { "FIXME"; "ISSUE"; }; { ctype = 1; }; }; - { { trig = "hack"; }; { "HACK"; }; { ctype = 1; }; }; - { { trig = "warn"; }; { "WARNING"; }; { ctype = 1; }; }; - { { trig = "perf"; }; { "PERFORMANCE"; "OPTIMIZE"; }; { ctype = 1; }; }; - { { trig = "note"; }; { "NOTE"; "INFO"; }; { ctype = 1; }; }; + { { trig = "todo" }, { "TODO" }, { ctype = 1 } }, + { { trig = "fix" }, { "FIXME", "ISSUE" }, { ctype = 1 } }, + { { trig = "hack" }, { "HACK" }, { ctype = 1 } }, + { { trig = "warn" }, { "WARNING" }, { ctype = 1 } }, + { { trig = "perf" }, { "PERFORMANCE", "OPTIMIZE" }, { ctype = 1 } }, + { { trig = "note" }, { "NOTE", "INFO" }, { ctype = 1 } }, -- NOTE: Block commented todo-comments - { { trig = "todob"; }; { "TODO"; }; { ctype = 2; }; }; - { { trig = "fixb"; }; { "FIXME"; "ISSUE"; }; { ctype = 2; }; }; - { { trig = "hackb"; }; { "HACK"; }; { ctype = 2; }; }; - { { trig = "warnb"; }; { "WARNING"; }; { ctype = 2; }; }; - { { trig = "perfb"; }; { "PERF"; "PERFORMANCE"; "OPTIM"; "OPTIMIZE"; }; { ctype = 2; }; }; - { { trig = "noteb"; }; { "NOTE"; "INFO"; }; { ctype = 2; }; }; + { { trig = "todob" }, { "TODO" }, { ctype = 2 } }, + { { trig = "fixb" }, { "FIXME", "ISSUE" }, { ctype = 2 } }, + { { trig = "hackb" }, { "HACK" }, { ctype = 2 } }, + { { trig = "warnb" }, { "WARNING" }, { ctype = 2 } }, + { { trig = "perfb" }, { "PERF", "PERFORMANCE", "OPTIM", "OPTIMIZE" }, { ctype = 2 } }, + { { trig = "noteb" }, { "NOTE", "INFO" }, { ctype = 2 } }, } local todo_comment_snippets = {} @@ -271,7 +252,7 @@ for _, v in ipairs(todo_snippet_specs) do end end -ls.add_snippets("all", todo_comment_snippets, { type = "snippets"; key = "todo_comments"; }) +ls.add_snippets("all", todo_comment_snippets, { type = "snippets", key = "todo_comments" }) -- }}} -- spdx snippets {{{ @@ -283,27 +264,30 @@ local generate_spdx_snippet = function(comment_type, spdx_license_expr, trigger) context.name = trigger .. " spdx snippet expr" context.trig = trigger - local nodes = { - fmt("{} SPDX-SnippetBegin {}", wrap_snippet_in_comments(comment_type, {})); + fmt("{} SPDX-SnippetBegin {}", wrap_snippet_in_comments(comment_type, {})), - fmt("{} SPDX-SnippetCopyrightText: {} {} <{}> {}", - wrap_snippet_in_comments(comment_type, { - ls.insert_node(1, "year"); - ls.insert_node(2, "author"); - ls.insert_node(3, "email"); - }) - ); + fmt( + "{} SPDX-SnippetCopyrightText: {} {} <{}> {}", + wrap_snippet_in_comments(comment_type, { + ls.insert_node(1, "year"), + ls.insert_node(2, "author"), + ls.insert_node(3, "email"), + }) + ), - fmt("{} SPDX-License-Identifier: {} {}", wrap_snippet_in_comments(comment_type, { - ls.text_node(spdx_license_expr); - })); + fmt( + "{} SPDX-License-Identifier: {} {}", + wrap_snippet_in_comments(comment_type, { + ls.text_node(spdx_license_expr), + }) + ), - { ls.insert_node(4, "content"); }; + { ls.insert_node(4, "content") }, - fmt("{} SPDX-SnippetEnd {}", wrap_snippet_in_comments(comment_type, {})); + fmt("{} SPDX-SnippetEnd {}", wrap_snippet_in_comments(comment_type, {})), - { ls.insert_node(0); }; + { ls.insert_node(0) }, } local newline_nodes = {} @@ -313,16 +297,16 @@ local generate_spdx_snippet = function(comment_type, spdx_license_expr, trigger) end -- luasnip requires newlines to be encoded like this: - table.insert(newline_nodes, ls.text_node({ ""; ""; })) + table.insert(newline_nodes, ls.text_node({ "", "" })) end - return ls.snippet(context, newline_nodes, { ctype = comment_type; }) + return ls.snippet(context, newline_nodes, { ctype = comment_type }) end local spdx = { - { trigger = "spdx-AGPL3+"; license = "AGPL-3.0-or-later"; }; - { trigger = "spdx-GPL3+"; license = "GPL-3.0-or-later"; }; - { trigger = "spdx-MIT"; license = "MIT"; }; + { trigger = "spdx-AGPL3+", license = "AGPL-3.0-or-later" }, + { trigger = "spdx-GPL3+", license = "GPL-3.0-or-later" }, + { trigger = "spdx-MIT", license = "MIT" }, } local spdx_snippets = {} @@ -334,5 +318,5 @@ for _, value in ipairs(spdx) do table.insert(spdx_snippets, snippet) end -ls.add_snippets("all", spdx_snippets, { type = "snippets"; key = "spdx_snippets"; }) +ls.add_snippets("all", spdx_snippets, { type = "snippets", key = "spdx_snippets" }) -- }}} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua index bcd128f7..02d285b7 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua @@ -19,23 +19,23 @@ local get_visual = function(_, parent) end end -local translation_table = { ["("] = ")"; ["{"] = "}"; ["["] = "]"; } +local translation_table = { ["("] = ")", ["{"] = "}", ["["] = "]" } -- Return snippet tables return { -- LEFT/RIGHT ALL BRACES ls.snippet( { - trig = "([^%a])l([%(%[%{])"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "([^%a])l([%(%[%{])", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmt("{}\\left{}{}\\right{}", { - ls.function_node(function(_, snip) return snip.captures[1] end); - ls.function_node(function(_, snip) return snip.captures[2] end); - ls.dynamic_node(1, get_visual); - ls.function_node(function(_, snip) return translation_table[snip.captures[2]] end); + ls.function_node(function(_, snip) return snip.captures[1] end), + ls.function_node(function(_, snip) return snip.captures[2] end), + ls.dynamic_node(1, get_visual), + ls.function_node(function(_, snip) return translation_table[snip.captures[2]] end), }) - ); + ), } diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua index 21aa7414..a98f6e8c 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua @@ -12,38 +12,38 @@ local ls = require("luasnip") -- Return snippet tables return { - ls.snippet({ trig = ";a"; snippetType = "autosnippet"; }, { ls.text_node("\\alpha"); }); - ls.snippet({ trig = ";b"; snippetType = "autosnippet"; }, { ls.text_node("\\beta"); }); - ls.snippet({ trig = ";g"; snippetType = "autosnippet"; }, { ls.text_node("\\gamma"); }); - ls.snippet({ trig = ";G"; snippetType = "autosnippet"; }, { ls.text_node("\\Gamma"); }); - ls.snippet({ trig = ";d"; snippetType = "autosnippet"; }, { ls.text_node("\\delta"); }); - ls.snippet({ trig = ";D"; snippetType = "autosnippet"; }, { ls.text_node("\\Delta"); }); - ls.snippet({ trig = ";e"; snippetType = "autosnippet"; }, { ls.text_node("\\epsilon"); }); - ls.snippet({ trig = ";ve"; snippetType = "autosnippet"; }, { ls.text_node("\\varepsilon"); }); - ls.snippet({ trig = ";z"; snippetType = "autosnippet"; }, { ls.text_node("\\zeta"); }); - ls.snippet({ trig = ";h"; snippetType = "autosnippet"; }, { ls.text_node("\\eta"); }); - ls.snippet({ trig = ";o"; snippetType = "autosnippet"; }, { ls.text_node("\\theta"); }); - ls.snippet({ trig = ";vo"; snippetType = "autosnippet"; }, { ls.text_node("\\vartheta"); }); - ls.snippet({ trig = ";O"; snippetType = "autosnippet"; }, { ls.text_node("\\Theta"); }); - ls.snippet({ trig = ";k"; snippetType = "autosnippet"; }, { ls.text_node("\\kappa"); }); - ls.snippet({ trig = ";l"; snippetType = "autosnippet"; }, { ls.text_node("\\lambda"); }); - ls.snippet({ trig = ";L"; snippetType = "autosnippet"; }, { ls.text_node("\\Lambda"); }); - ls.snippet({ trig = ";m"; snippetType = "autosnippet"; }, { ls.text_node("\\mu"); }); - ls.snippet({ trig = ";n"; snippetType = "autosnippet"; }, { ls.text_node("\\nu"); }); - ls.snippet({ trig = ";x"; snippetType = "autosnippet"; }, { ls.text_node("\\xi"); }); - ls.snippet({ trig = ";X"; snippetType = "autosnippet"; }, { ls.text_node("\\Xi"); }); - ls.snippet({ trig = ";i"; snippetType = "autosnippet"; }, { ls.text_node("\\pi"); }); - ls.snippet({ trig = ";I"; snippetType = "autosnippet"; }, { ls.text_node("\\Pi"); }); - ls.snippet({ trig = ";r"; snippetType = "autosnippet"; }, { ls.text_node("\\rho"); }); - ls.snippet({ trig = ";s"; snippetType = "autosnippet"; }, { ls.text_node("\\sigma"); }); - ls.snippet({ trig = ";S"; snippetType = "autosnippet"; }, { ls.text_node("\\Sigma"); }); - ls.snippet({ trig = ";t"; snippetType = "autosnippet"; }, { ls.text_node("\\tau"); }); - ls.snippet({ trig = ";f"; snippetType = "autosnippet"; }, { ls.text_node("\\phi"); }); - ls.snippet({ trig = ";vf"; snippetType = "autosnippet"; }, { ls.text_node("\\varphi"); }); - ls.snippet({ trig = ";F"; snippetType = "autosnippet"; }, { ls.text_node("\\Phi"); }); - ls.snippet({ trig = ";c"; snippetType = "autosnippet"; }, { ls.text_node("\\chi"); }); - ls.snippet({ trig = ";p"; snippetType = "autosnippet"; }, { ls.text_node("\\psi"); }); - ls.snippet({ trig = ";P"; snippetType = "autosnippet"; }, { ls.text_node("\\Psi"); }); - ls.snippet({ trig = ";w"; snippetType = "autosnippet"; }, { ls.text_node("\\omega"); }); - ls.snippet({ trig = ";W"; snippetType = "autosnippet"; }, { ls.text_node("\\Omega"); }); + ls.snippet({ trig = ";a", snippetType = "autosnippet" }, { ls.text_node("\\alpha") }), + ls.snippet({ trig = ";b", snippetType = "autosnippet" }, { ls.text_node("\\beta") }), + ls.snippet({ trig = ";g", snippetType = "autosnippet" }, { ls.text_node("\\gamma") }), + ls.snippet({ trig = ";G", snippetType = "autosnippet" }, { ls.text_node("\\Gamma") }), + ls.snippet({ trig = ";d", snippetType = "autosnippet" }, { ls.text_node("\\delta") }), + ls.snippet({ trig = ";D", snippetType = "autosnippet" }, { ls.text_node("\\Delta") }), + ls.snippet({ trig = ";e", snippetType = "autosnippet" }, { ls.text_node("\\epsilon") }), + ls.snippet({ trig = ";ve", snippetType = "autosnippet" }, { ls.text_node("\\varepsilon") }), + ls.snippet({ trig = ";z", snippetType = "autosnippet" }, { ls.text_node("\\zeta") }), + ls.snippet({ trig = ";h", snippetType = "autosnippet" }, { ls.text_node("\\eta") }), + ls.snippet({ trig = ";o", snippetType = "autosnippet" }, { ls.text_node("\\theta") }), + ls.snippet({ trig = ";vo", snippetType = "autosnippet" }, { ls.text_node("\\vartheta") }), + ls.snippet({ trig = ";O", snippetType = "autosnippet" }, { ls.text_node("\\Theta") }), + ls.snippet({ trig = ";k", snippetType = "autosnippet" }, { ls.text_node("\\kappa") }), + ls.snippet({ trig = ";l", snippetType = "autosnippet" }, { ls.text_node("\\lambda") }), + ls.snippet({ trig = ";L", snippetType = "autosnippet" }, { ls.text_node("\\Lambda") }), + ls.snippet({ trig = ";m", snippetType = "autosnippet" }, { ls.text_node("\\mu") }), + ls.snippet({ trig = ";n", snippetType = "autosnippet" }, { ls.text_node("\\nu") }), + ls.snippet({ trig = ";x", snippetType = "autosnippet" }, { ls.text_node("\\xi") }), + ls.snippet({ trig = ";X", snippetType = "autosnippet" }, { ls.text_node("\\Xi") }), + ls.snippet({ trig = ";i", snippetType = "autosnippet" }, { ls.text_node("\\pi") }), + ls.snippet({ trig = ";I", snippetType = "autosnippet" }, { ls.text_node("\\Pi") }), + ls.snippet({ trig = ";r", snippetType = "autosnippet" }, { ls.text_node("\\rho") }), + ls.snippet({ trig = ";s", snippetType = "autosnippet" }, { ls.text_node("\\sigma") }), + ls.snippet({ trig = ";S", snippetType = "autosnippet" }, { ls.text_node("\\Sigma") }), + ls.snippet({ trig = ";t", snippetType = "autosnippet" }, { ls.text_node("\\tau") }), + ls.snippet({ trig = ";f", snippetType = "autosnippet" }, { ls.text_node("\\phi") }), + ls.snippet({ trig = ";vf", snippetType = "autosnippet" }, { ls.text_node("\\varphi") }), + ls.snippet({ trig = ";F", snippetType = "autosnippet" }, { ls.text_node("\\Phi") }), + ls.snippet({ trig = ";c", snippetType = "autosnippet" }, { ls.text_node("\\chi") }), + ls.snippet({ trig = ";p", snippetType = "autosnippet" }, { ls.text_node("\\psi") }), + ls.snippet({ trig = ";P", snippetType = "autosnippet" }, { ls.text_node("\\Psi") }), + ls.snippet({ trig = ";w", snippetType = "autosnippet" }, { ls.text_node("\\omega") }), + ls.snippet({ trig = ";W", snippetType = "autosnippet" }, { ls.text_node("\\Omega") }), } diff --git a/modules/by-name/nv/nvim/plgs/neorg/default.nix b/modules/by-name/nv/nvim/plgs/neorg/default.nix index eafc161f..b69f5a58 100644 --- a/modules/by-name/nv/nvim/plgs/neorg/default.nix +++ b/modules/by-name/nv/nvim/plgs/neorg/default.nix @@ -14,7 +14,9 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # TODO: Re-active, whence neorg actually builds with all the treesitter grammars + # activated <2026-01-18> + home-manager.users.soispha.programs.nixvim = lib.mkIf false { extraFiles = { "ftplugin/norg.lua".text = '' ${lib.strings.fileContents ./key_mappings.lua} @@ -53,11 +55,7 @@ in { __empty = null; }; "core.dirman".config = { - workspaces = { - general = "~/repos/notes/general"; - journal = "~/repos/notes/journal"; - projects = "~/repos/notes/projects"; - }; + workspaces = {}; }; "core.export".config = { __empty = null; diff --git a/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix b/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix deleted file mode 100644 index c981ee08..00000000 --- a/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - # Not all plugins have own modules - # You can add missing plugins here - # `pkgs.vimExtraPlugins` is added by the overlay you added at the beginning - # For a list of available plugins, look here: - # https://github.com/jooooscha/nixpkgs-vim-extra-plugins/blob/main/plugins.md - extraPlugins = [ - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/treesitter/default.nix b/modules/by-name/nv/nvim/plgs/treesitter/default.nix index c8b48cd1..1377cb8a 100644 --- a/modules/by-name/nv/nvim/plgs/treesitter/default.nix +++ b/modules/by-name/nv/nvim/plgs/treesitter/default.nix @@ -26,45 +26,23 @@ in { plugins.treesitter = { enable = true; + highlight.enable = true; + indent.enable = true; + folding.enable = false; + # inject nixvim specific highlighting (eg in extraConfigLua). nixvimInjections = true; - nixGrammars = true; - grammarPackages = - # Append the `tree-sitter-yts` grammar to all the other grammars. - # TODO: Find a better way to do this. <2024-11-08> - config.home-manager.users.soispha.programs.nixvim.plugins.treesitter.package.passthru.allGrammars - ++ [pkgs.tree-sitter-yts]; - - settings = { - auto_install = false; - ensureInstalled = "all"; - indent.enable = true; - disabledLanguages = []; + grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars ++ [pkgs.tree-sitter-yts]; - highlight = { - enable = true; - disable = []; + # Register the parser to filetype + languageRegister.yts = "yts"; + }; - # Setting this to true will run `:h syntax` and tree-sitter at the same time. - # Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - # Using this option may slow down your editor; and you may see some duplicate highlights. - # Instead of true it can also be a list of languages - additionalVimRegexHighlighting = ["latex"]; - }; + # TODO: Is that necessary? <2026-01-18> + # extraPlugins = [pkgs.tree-sitter-yts]; - incrementalSelection = { - enable = true; - keymaps = { - # TODO: include these in the which-key description - initSelection = "gnn"; # set to `false` to disable one of the mappings - nodeIncremental = "grn"; - scopeIncremental = "grc"; - nodeDecremental = "grm"; - }; - }; - }; - }; + # TODO: Remove this by moving the queries in the package to `queries/<lang>/...`' <2026-01-18> extraFiles = { "queries/yts/highlights.scm".text = '' ${lib.strings.fileContents "${pkgs.tree-sitter-yts}/queries/highlights.scm"} diff --git a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix index 739b69d9..71422f94 100644 --- a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix +++ b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix @@ -14,7 +14,8 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # TODO: Do I still need this module at all? <2026-01-18> + home-manager.users.soispha.programs.nixvim = lib.mkIf false { opts.conceallevel = 0; plugins.vimtex = { |
