diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..976c4ce0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Nix build symlink +result diff --git a/config/completion/codeium.nix b/config/completion/codeium.nix deleted file mode 100644 index ae073c79..00000000 --- a/config/completion/codeium.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, config, ... }: -{ - options = { - codeium.enable = lib.mkEnableOption "Enable codeium module"; - }; - config = lib.mkIf config.codeium.enable { - - plugins.codeium-vim = { - enable = true; - }; - }; -} diff --git a/config/completion/copilot.nix b/config/completion/copilot.nix index 6dce903e..00d6a63d 100644 --- a/config/completion/copilot.nix +++ b/config/completion/copilot.nix @@ -6,47 +6,48 @@ config = lib.mkIf config.copilot.enable { plugins.copilot-lua = { enable = true; - panel = { - enabled = false; - autoRefresh = true; - keymap = { - jumpPrev = "[["; - jumpNext = "]]"; - accept = ""; - refresh = "gr"; - open = ""; + settings = { + panel = { + enabled = false; + auto_refresh = true; + keymap = { + jump_prev = "[["; + jump_next = "]]"; + accept = ""; + refresh = "gr"; + open = ""; + }; + layout = { + position = "bottom"; # | top | left | right + ratio = 0.4; + }; }; - layout = { - position = "bottom"; # | top | left | right - ratio = 0.4; + suggestion = { + enabled = false; + auto_trigger = true; + debounce = 75; + keymap = { + accept = ""; + accept_word = false; + accept_line = false; + next = ""; + prev = ""; + dismiss = ""; + }; }; - }; - suggestion = { - enabled = false; - autoTrigger = true; - debounce = 75; - keymap = { - accept = ""; - acceptWord = false; - acceptLine = false; - next = ""; - prev = ""; - dismiss = ""; + filetypes = { + yaml = false; + markdown = false; + help = false; + gitcommit = false; + gitrebase = false; + hgcommit = false; + svn = false; + cvs = false; + "." = false; }; }; - filetypes = { - yaml = false; - markdown = false; - help = false; - gitcommit = false; - gitrebase = false; - hgcommit = false; - svn = false; - cvs = false; - "." = false; - }; - copilotNodeCommand = "node"; # Node.js version must be > 18.x - serverOptsOverrides = { }; + # copilot_node_command and server_opts_overrides use NixVim defaults ("node" and {}) }; }; } diff --git a/config/completion/default.nix b/config/completion/default.nix index 626f7aa8..be17c983 100644 --- a/config/completion/default.nix +++ b/config/completion/default.nix @@ -6,7 +6,7 @@ { imports = [ ./cmp.nix - ./codeium.nix + ./windsurf.nix ./copilot.nix ./lspkind.nix ]; @@ -16,7 +16,7 @@ }; config = lib.mkIf config.completion.enable { cmp.enable = lib.mkDefault true; - codeium.enable = lib.mkDefault false; + windsurf.enable = lib.mkDefault false; copilot.enable = lib.mkDefault false; lspkind.enable = lib.mkDefault true; }; diff --git a/config/completion/windsurf.nix b/config/completion/windsurf.nix new file mode 100644 index 00000000..04a2f256 --- /dev/null +++ b/config/completion/windsurf.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: +{ + options = { + windsurf.enable = lib.mkEnableOption "Enable windsurf module"; + }; + config = lib.mkIf config.windsurf.enable { + plugins.windsurf-vim = { + enable = true; + }; + }; +} diff --git a/config/default.nix b/config/default.nix index 8a9faa1f..af311dca 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,5 +1,17 @@ -{ lib, config, ... }: { + lib, + config, + pkgs, + ... +}: +{ + extraPackages = with pkgs; [ + fd + nixfmt + stylua + prettierd + ]; + # Import all your configuration modules here imports = [ ./bufferlines diff --git a/config/languages/jdtls.nix b/config/languages/jdtls.nix index f9ea4fa0..edaf0fbb 100644 --- a/config/languages/jdtls.nix +++ b/config/languages/jdtls.nix @@ -1,8 +1,4 @@ -{ lib, config, ... }: -let - javaTestPath = "/nix/store/j3nvmhvj2pmnykw5pbm51dn0bz4cv6j3-vscode-extension-vscjava-vscode-java-test-0.38.2023032402/share/vscode/extensions/vscjava.vscode-java-test/server/com.microsoft.java.test.plugin-0.38.2.jar - "; -in +{ lib, config, pkgs, ... }: { options = { jdtls.enable = lib.mkEnableOption "Enable jdtls module"; @@ -12,77 +8,17 @@ in enable = true; settings = { cmd = [ - "/nix/store/l7wd7xjnz95yxv225kix5gbq8k3vm7fl-jdt-language-server-1.48.0/bin/jdtls --data ~/.cache/jdtls/workspace" + "${pkgs.jdt-language-server}/bin/jdtls" + "--data" + "~/.cache/jdtls/workspace" ]; - # configuration = "/path/to/configuration"; settings = { java = { signatureHelp = true; completion = true; }; }; - initOptions = { - bundles = [ - "/nix/store/b9ib40q36wxjl4xs5lng263lflz1fsi7-vscode-extension-vscjava-vscode-java-debug-0.49.2023032407/share/vscode/extensions/vscjava.vscode-java-debug/server/com.microsoft.java.debug.plugin-0.44.0.jar" - "${javaTestPath}" - ]; - }; }; }; }; } -# -# extraConfigLua = '' -# local jdtls = require("jdtls") -# local cmp_nvim_lsp = require("cmp_nvim_lsp") -# -# local root_dir = require("jdtls.setup").find_root({ "packageInfo" }, "Config") -# local home = os.getenv("HOME") -# local eclipse_workspace = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t") -# -# local ws_folders_jdtls = {} -# if root_dir then -# local file = io.open(root_dir .. "/.bemol/ws_root_folders") -# if file then -# for line in file:lines() do -# table.insert(ws_folders_jdtls, "file://" .. line) -# end -# file:close() -# end -# end -# -# -- for completions -# local client_capabilities = vim.lsp.protocol.make_client_capabilities() -# local capabilities = cmp_nvim_lsp.default_capabilities(client_capabilities) -# -# local config = { -# capabilities = capabilities, -# cmd = { -# "${pkgs.jdt-language-server}/bin/jdt-language-server", -# "--jvm-arg=-javaagent:" .. home .. "/Developer/lombok.jar", -# "-data", -# eclipse_workspace, -# "--add-modules=ALL-SYSTEM", -# }, -# root_dir = root_dir, -# init_options = { -# workspaceFolders = ws_folders_jdtls, -# }, -# settings = { -# java = { -# signatureHelp = { enabled = true}, -# completion = { enabled = true }, -# }, -# }, -# on_attach = function(client, bufnr) -# local opts = { silent = true, buffer = bufnr } -# vim.keymap.set('n', "lo", jdtls.organize_imports, { desc = 'Organize imports', buffer = bufnr }) -# vim.keymap.set('n', "df", jdtls.test_class, opts) -# vim.keymap.set('n', "dn", jdtls.test_nearest_method, opts) -# vim.keymap.set('n', 'rv', jdtls.extract_variable_all, { desc = 'Extract variable', buffer = bufnr }) -# vim.keymap.set('n', 'rc', jdtls.extract_constant, { desc = 'Extract constant', buffer = bufnr }) -# end -# } -# -# jdtls.start_or_attach(config) -# ''; diff --git a/config/languages/treesitter-nvim.nix b/config/languages/treesitter-nvim.nix index 77412b15..2a02a670 100644 --- a/config/languages/treesitter-nvim.nix +++ b/config/languages/treesitter-nvim.nix @@ -61,49 +61,51 @@ plugins.treesitter-textobjects = { enable = true; - select = { - enable = true; - lookahead = true; - keymaps = { - "aa" = "@parameter.outer"; - "ia" = "@parameter.inner"; - "af" = "@function.outer"; - "if" = "@function.inner"; - "ac" = "@class.outer"; - "ic" = "@class.inner"; - "ii" = "@conditional.inner"; - "ai" = "@conditional.outer"; - "il" = "@loop.inner"; - "al" = "@loop.outer"; - "at" = "@comment.outer"; - }; - }; - move = { - enable = true; - gotoNextStart = { - "]m" = "@function.outer"; - "]]" = "@class.outer"; - }; - gotoNextEnd = { - "]M" = "@function.outer"; - "][" = "@class.outer"; - }; - gotoPreviousStart = { - "[m" = "@function.outer"; - "[[" = "@class.outer"; - }; - gotoPreviousEnd = { - "[M" = "@function.outer"; - "[]" = "@class.outer"; + settings = { + select = { + enable = true; + lookahead = true; + keymaps = { + "aa" = "@parameter.outer"; + "ia" = "@parameter.inner"; + "af" = "@function.outer"; + "if" = "@function.inner"; + "ac" = "@class.outer"; + "ic" = "@class.inner"; + "ii" = "@conditional.inner"; + "ai" = "@conditional.outer"; + "il" = "@loop.inner"; + "al" = "@loop.outer"; + "at" = "@comment.outer"; + }; }; - }; - swap = { - enable = true; - swapNext = { - "a" = "@parameters.inner"; + move = { + enable = true; + goto_next_start = { + "]m" = "@function.outer"; + "]]" = "@class.outer"; + }; + goto_next_end = { + "]M" = "@function.outer"; + "][" = "@class.outer"; + }; + goto_previous_start = { + "[m" = "@function.outer"; + "[[" = "@class.outer"; + }; + goto_previous_end = { + "[M" = "@function.outer"; + "[]" = "@class.outer"; + }; }; - swapPrevious = { - "A" = "@parameter.outer"; + swap = { + enable = true; + swap_next = { + "a" = "@parameters.inner"; + }; + swap_previous = { + "A" = "@parameter.outer"; + }; }; }; }; diff --git a/config/lsp/lsp-nvim.nix b/config/lsp/lsp-nvim.nix index e5777bea..0ccdf2db 100644 --- a/config/lsp/lsp-nvim.nix +++ b/config/lsp/lsp-nvim.nix @@ -5,9 +5,6 @@ }; config = lib.mkIf config.lsp-nvim.enable { plugins = { - lsp-format = { - enable = false; # Enable it if you want lsp-format integration for none-ls - }; lsp = { enable = true; capabilities = "offsetEncoding = 'utf-16'"; @@ -192,17 +189,15 @@ border = _border } - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( - vim.lsp.handlers.hover, { - border = _border - } - ) + vim.lsp.handlers["textDocument/hover"] = function(err, result, ctx, config) + config = vim.tbl_deep_extend("force", config or {}, { border = _border }) + return vim.lsp.handlers.hover(err, result, ctx, config) + end - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( - vim.lsp.handlers.signature_help, { - border = _border - } - ) + vim.lsp.handlers["textDocument/signatureHelp"] = function(err, result, ctx, config) + config = vim.tbl_deep_extend("force", config or {}, { border = _border }) + return vim.lsp.handlers.signature_help(err, result, ctx, config) + end vim.diagnostic.config({ float = { border = "rounded" }, diff --git a/config/pluginmanagers/lazy-nvim.nix b/config/pluginmanagers/lazy-nvim.nix index 32185918..dbb93bbf 100644 --- a/config/pluginmanagers/lazy-nvim.nix +++ b/config/pluginmanagers/lazy-nvim.nix @@ -1,6 +1,7 @@ { lib, config, + pkgs, ... }: { @@ -8,8 +9,35 @@ lazy-nvim.enable = lib.mkEnableOption "Enable lazy-nvim module"; }; config = lib.mkIf config.lazy-nvim.enable { + extraConfigLuaPost = '' + vim.go.loadplugins = true + ''; plugins.lazy = { enable = true; + # Add neocord to lazy.nvim's managed plugins so that settings.spec is + # non-empty. This makes lazy.nvim interpret the settings table as opts + # (2nd arg to setup()), preventing it from resetting the runtimepath + # and breaking Vimscript autoload functions (e.g. neocord#SetAutoCmds). + # + # Using `config = ""` (empty string) prevents lazy.nvim from running its + # auto-setup callback (which would call setup() without opts), since + # Nixvim handles neocord setup separately via its own require call. + plugins = [ + { + pkg = pkgs.vimPlugins.neocord; + name = "neocord"; + config = ""; + } + ]; + settings = { + performance = { + # Nixvim manages plugins via packpath; lazy.nvim must not reset it + reset_packpath = false; + rtp = { + reset = false; + }; + }; + }; }; }; } diff --git a/config/statusline/lualine.nix b/config/statusline/lualine.nix index 427b5c10..4b150487 100644 --- a/config/statusline/lualine.nix +++ b/config/statusline/lualine.nix @@ -36,77 +36,68 @@ }; }; extraConfigLua = '' - config = function() - local harpoon = require("harpoon.mark") + local harpoon = require("harpoon") - local function truncate_branch_name(branch) - if not branch or branch == "" then - return "" - end - - -- Match the branch name to the specified format - local user, team, ticket_number = string.find(branch, "(%w+)%/(%w+)%-(%d+)%-") - - -- If the branch name matches the format, display sko-{ticket_number}, otherwise display the full branch name - if ticket_number then - return user .. "/" .. team .. "-" .. ticket_number - else - return branch - end - end - - local function harpoon_component() - local total_marks = harpoon.get_length() - - if total_marks == 0 then - return "" - end - - local current_mark = "—" - - local mark_idx = harpoon.get_current_index() - if mark_idx ~= nil then - current_mark = tostring(mark_idx) - end + local function truncate_branch_name(branch) + if not branch or branch == "" then + return "" + end + local user, team, ticket_number = string.find(branch, "(%w+)%/(%w+)%-(%d+)%-") + if ticket_number then + return user .. "/" .. team .. "-" .. ticket_number + else + return branch + end + end - return string.format("󱡅 %s/%d", current_mark, total_marks) - end + local function harpoon_component() + local list = harpoon:list() + local total_marks = list:length() + if total_marks == 0 then + return "" + end + local current_mark = "\226\128\148" + -- harpoon2 tracks current index via internal _index field (1-based) + local mark_idx = list._index + if mark_idx ~= nil then + current_mark = tostring(mark_idx) + end + return string.format("\239\177\133\133 %s/%d", current_mark, total_marks) + end - local function get_lsp_client(_) - ---@type any?{} - local client_names = {} - local msg = "No Active Lsp" - local clients = vim.lsp.get_clients({ bufnr = 0 }) - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - table.insert(client_names, client.name) - end - return #client_names == 0 and msg or table.concat(client_names, " | ") - end - local function wordcount() - return tostring(vim.fn.wordcount().words) .. " words" - end - local function readingtime() - return tostring(math.ceil(vim.fn.wordcount().words / 200.0)) .. " min" - end - local function is_markdown() - return vim.bo.filetype == "markdown" or vim.bo.filetype == "asciidoc" - end - local function navic() - return require("nvim-navic").get_location() - end - local function navic_is_available() - return package.loaded["nvim-navic"] and require("nvim-navic").is_available() - end - local cmd_mode = function() - return require("noice").api.status.mode.get() - end - local show_mode = function() - return package.loaded["noice"] and require("noice").api.status.mode.has() or "" - end + local function get_lsp_client(_) + local client_names = {} + local msg = "No Active Lsp" + local clients = vim.lsp.get_clients({ bufnr = 0 }) + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + table.insert(client_names, client.name) end + return #client_names == 0 and msg or table.concat(client_names, " | ") + end + local function wordcount() + return tostring(vim.fn.wordcount().words) .. " words" + end + local function readingtime() + return tostring(math.ceil(vim.fn.wordcount().words / 200.0)) .. " min" + end + local function is_markdown() + return vim.bo.filetype == "markdown" or vim.bo.filetype == "asciidoc" + end + local function navic() + return require("nvim-navic").get_location() + end + local function navic_is_available() + return package.loaded["nvim-navic"] and require("nvim-navic").is_available() + end + local cmd_mode = function() + return require("noice").api.status.mode.get() + end + local show_mode = function() + return package.loaded["noice"] and require("noice").api.status.mode.has() or "" + end ''; }; } diff --git a/config/statusline/staline.nix b/config/statusline/staline.nix index de831128..3670b155 100644 --- a/config/statusline/staline.nix +++ b/config/statusline/staline.nix @@ -9,17 +9,8 @@ staline.enable = lib.mkEnableOption "Enable staline module"; }; config = lib.mkIf config.staline.enable { - extraPlugins = with pkgs.vimUtils; [ - (buildVimPlugin { - pname = "staline.nvim"; - version = "2024-02-05"; - src = pkgs.fetchFromGitHub { - owner = "tamton-aquib"; - repo = "staline.nvim"; - rev = "a53f869278b8b186a5afd6f21680cd103c381599"; - hash = "sha256-GDMKzxFDtQk5LL+rMsxTGTyLv69w5NUd+u19noeO5ws="; - }; - }) + extraPlugins = with pkgs.vimPlugins; [ + staline-nvim ]; extraConfigLua = '' require("staline").setup({ diff --git a/config/ui/alpha.nix b/config/ui/alpha.nix index 97d57516..15dcf3e9 100644 --- a/config/ui/alpha.nix +++ b/config/ui/alpha.nix @@ -7,205 +7,207 @@ plugins.alpha = { enable = true; theme = null; - layout = - let - padding = val: { - type = "padding"; - inherit val; - }; - in - [ - (padding 4) - { - opts = { - hl = "AlphaHeader"; - position = "center"; + settings = { + layout = + let + padding = val: { + type = "padding"; + inherit val; }; - type = "text"; - val = [ - " ███▄ █ ▓█████ ██▒ █▓▓█████ " - " ██ ▀█ █ ▓█ ▀▓██░ █▒▓█ ▀ " - " ▓██ ▀█ ██▒▒███ ▓██ █▒░▒███ " - " ▓██▒ ▐▌██▒▒▓█ ▄ ▒██ █░░▒▓█ ▄ " - " ▒██░ ▓██░░▒████▒ ▒▀█░ ░▒████▒ " - " ░ ▒░ ▒ ▒ ░░ ▒░ ░ ░ ▐░ ░░ ▒░ ░ " - " ░ ░░ ░ ▒░ ░ ░ ░ ░ ░░ ░ ░ ░ " - " ░ ░ ░ ░ ░░ ░ " - " ░ ░ ░ ░ ░ ░ " - " ░ " - " " - " git@github.com:redyf/neve " - ]; - } - (padding 2) - { - type = "button"; - val = " Find File"; - on_press = { - __raw = "function() require('telescope.builtin').find_files() end"; - }; - opts = { - # hl = "comment"; - keymap = [ - "n" - "f" - ":Telescope find_files " - { - noremap = true; - silent = true; - nowait = true; - } + in + [ + (padding 4) + { + opts = { + hl = "AlphaHeader"; + position = "center"; + }; + type = "text"; + val = [ + " ███▄ █ ▓█████ ██▒ █▓▓█████ " + " ██ ▀█ █ ▓█ ▀▓██░ █▒▓█ ▀ " + " ▓██ ▀█ ██▒▒███ ▓██ █▒░▒███ " + " ▓██▒ ▐▌██▒▒▓█ ▄ ▒██ █░░▒▓█ ▄ " + " ▒██░ ▓██░░▒████▒ ▒▀█░ ░▒████▒ " + " ░ ▒░ ▒ ▒ ░░ ▒░ ░ ░ ▐░ ░░ ▒░ ░ " + " ░ ░░ ░ ▒░ ░ ░ ░ ░ ░░ ░ ░ ░ " + " ░ ░ ░ ░ ░░ ░ " + " ░ ░ ░ ░ ░ ░ " + " ░ " + " " + " git@github.com:redyf/neve " ]; - shortcut = "f"; + } + (padding 2) + { + type = "button"; + val = " Find File"; + on_press = { + __raw = "function() require('telescope.builtin').find_files() end"; + }; + opts = { + # hl = "comment"; + keymap = [ + "n" + "f" + ":Telescope find_files " + { + noremap = true; + silent = true; + nowait = true; + } + ]; + shortcut = "f"; - position = "center"; - cursor = 3; - width = 38; - align_shortcut = "right"; - hl_shortcut = "Keyword"; - }; - } - (padding 1) - { - type = "button"; - val = " New File"; - on_press = { - __raw = "function() vim.cmd[[ene]] end"; - }; - opts = { - # hl = "comment"; - keymap = [ - "n" - "n" - ":ene startinsert " - { - noremap = true; - silent = true; - nowait = true; - } - ]; - shortcut = "n"; + position = "center"; + cursor = 3; + width = 38; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + (padding 1) + { + type = "button"; + val = " New File"; + on_press = { + __raw = "function() vim.cmd[[ene]] end"; + }; + opts = { + # hl = "comment"; + keymap = [ + "n" + "n" + ":ene startinsert " + { + noremap = true; + silent = true; + nowait = true; + } + ]; + shortcut = "n"; - position = "center"; - cursor = 3; - width = 38; - align_shortcut = "right"; - hl_shortcut = "Keyword"; - }; - } - (padding 1) - { - type = "button"; - val = "󰈚 Recent Files"; - on_press = { - __raw = "function() require('telescope.builtin').oldfiles() end"; - }; - opts = { - # hl = "comment"; - keymap = [ - "n" - "r" - ":Telescope oldfiles " - { - noremap = true; - silent = true; - nowait = true; - } - ]; - shortcut = "r"; + position = "center"; + cursor = 3; + width = 38; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + (padding 1) + { + type = "button"; + val = "󰈚 Recent Files"; + on_press = { + __raw = "function() require('telescope.builtin').oldfiles() end"; + }; + opts = { + # hl = "comment"; + keymap = [ + "n" + "r" + ":Telescope oldfiles " + { + noremap = true; + silent = true; + nowait = true; + } + ]; + shortcut = "r"; - position = "center"; - cursor = 3; - width = 38; - align_shortcut = "right"; - hl_shortcut = "Keyword"; - }; - } - (padding 1) - { - type = "button"; - val = "󰈭 Find Word"; - on_press = { - __raw = "function() require('telescope.builtin').live_grep() end"; - }; - opts = { - # hl = "comment"; - keymap = [ - "n" - "g" - ":Telescope live_grep " - { - noremap = true; - silent = true; - nowait = true; - } - ]; - shortcut = "g"; + position = "center"; + cursor = 3; + width = 38; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + (padding 1) + { + type = "button"; + val = "󰈭 Find Word"; + on_press = { + __raw = "function() require('telescope.builtin').live_grep() end"; + }; + opts = { + # hl = "comment"; + keymap = [ + "n" + "g" + ":Telescope live_grep " + { + noremap = true; + silent = true; + nowait = true; + } + ]; + shortcut = "g"; - position = "center"; - cursor = 3; - width = 38; - align_shortcut = "right"; - hl_shortcut = "Keyword"; - }; - } - (padding 1) - { - type = "button"; - val = " Restore Session"; - on_press = { - __raw = "function() require('persistence').load() end"; - }; - opts = { - # hl = "comment"; - keymap = [ - "n" - "s" - ":lua require('persistence').load()" - { - noremap = true; - silent = true; - nowait = true; - } - ]; - shortcut = "s"; + position = "center"; + cursor = 3; + width = 38; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + (padding 1) + { + type = "button"; + val = " Restore Session"; + on_press = { + __raw = "function() require('persistence').load() end"; + }; + opts = { + # hl = "comment"; + keymap = [ + "n" + "s" + ":lua require('persistence').load()" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + shortcut = "s"; - position = "center"; - cursor = 3; - width = 38; - align_shortcut = "right"; - hl_shortcut = "Keyword"; - }; - } - (padding 1) - { - type = "button"; - val = " Quit Neovim"; - on_press = { - __raw = "function() vim.cmd[[qa]] end"; - }; - opts = { - # hl = "comment"; - keymap = [ - "n" - "q" - ":qa" - { - noremap = true; - silent = true; - nowait = true; - } - ]; - shortcut = "q"; + position = "center"; + cursor = 3; + width = 38; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + (padding 1) + { + type = "button"; + val = " Quit Neovim"; + on_press = { + __raw = "function() vim.cmd[[qa]] end"; + }; + opts = { + # hl = "comment"; + keymap = [ + "n" + "q" + ":qa" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + shortcut = "q"; - position = "center"; - cursor = 3; - width = 38; - align_shortcut = "right"; - hl_shortcut = "Keyword"; - }; - } - ]; + position = "center"; + cursor = 3; + width = 38; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + ]; + }; }; }; } diff --git a/config/ui/dressing-nvim.nix b/config/ui/dressing-nvim.nix index fdf93bc5..075c8877 100644 --- a/config/ui/dressing-nvim.nix +++ b/config/ui/dressing-nvim.nix @@ -1,183 +1,89 @@ -{ - lib, - config, - pkgs, - ... -}: +{ lib, config, ... }: { options = { dressing-nvim.enable = lib.mkEnableOption "Enable dressing-nvim module"; }; config = lib.mkIf config.dressing-nvim.enable { - - extraPlugins = with pkgs.vimPlugins; [ - dressing-nvim - ]; - extraConfigLua = '' - require("dressing").setup({ + plugins.dressing = { + enable = true; + settings = { input = { - -- Set to false to disable the vim.ui.input implementation - enabled = true, - - -- Default prompt string - default_prompt = "Input", - - -- Trim trailing `:` from prompt - trim_prompt = true, - - -- Can be 'left', 'right', or 'center' - title_pos = "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 = {}, + enabled = true; + default_prompt = "Input"; + trim_prompt = true; + title_pos = "left"; + insert_only = true; + start_in_insert = true; + border = "rounded"; + relative = "cursor"; + prefer_width = 40; + width = null; + max_width = [ 140 0.9 ]; + min_width = [ 20 0.2 ]; win_options = { - -- Disable line wrapping - wrap = false, - -- Indicator for when text exceeds window - list = true, - listchars = "precedes:…,extends:…", - -- Increase this for more context when text scrolls off the window - sidescrolloff = 0, - }, - - -- Set to `false` to disable + wrap = false; + list = true; + listchars = "precedes:\226\128\166,extends:\226\128\166"; + sidescrolloff = 0; + }; mappings = { n = { - [""] = "Close", - [""] = "Confirm", - }, + "" = "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, - }, + "" = "Close"; + "" = "Confirm"; + "" = "HistoryPrev"; + "" = "HistoryNext"; + }; + }; + }; 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 + enabled = true; + backend = [ "telescope" "fzf_lua" "fzf" "builtin" "nui" ]; + trim_prompt = true; + telescope = null; fzf = { window = { - width = 0.5, - height = 0.4, - }, - }, - - -- Options for fzf-lua - fzf_lua = { - -- winopts = { - -- height = 0.5, - -- width = 0.5, - -- }, - }, - - -- Options for nui Menu + width = 0.5; + height = 0.4; + }; + }; nui = { - position = "50%", - size = nil, - relative = "editor", + position = "50%"; + size = null; + relative = "editor"; border = { - style = "rounded", - }, - buf_options = { - swapfile = false, - filetype = "DressingSelect", - }, - win_options = { - winblend = 0, - }, - max_width = 80, - max_height = 40, - min_width = 40, - min_height = 10, - }, - - -- Options for built-in selector + style = "rounded"; + }; + max_width = 80; + max_height = 40; + min_width = 40; + min_height = 10; + }; builtin = { - -- Display numbers for options and set up keymaps - show_numbers = true, - -- These are passed to nvim_open_win - border = "rounded", - -- 'editor' and 'win' will default to being centered - relative = "editor", - - buf_options = {}, + show_numbers = true; + border = "rounded"; + relative = "editor"; win_options = { - 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 + cursorline = true; + cursorlineopt = "both"; + }; + width = null; + max_width = [ 140 0.8 ]; + min_width = [ 40 0.2 ]; + height = null; + max_height = 0.9; + min_height = [ 10 0.2 ]; 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, - }, - }) ''; + "" = "Close"; + "" = "Close"; + "" = "Confirm"; + }; + }; + }; + }; + }; }; } diff --git a/config/utils/default.nix b/config/utils/default.nix index 3b9b1da4..dbfac458 100644 --- a/config/utils/default.nix +++ b/config/utils/default.nix @@ -10,6 +10,7 @@ ./colorizer.nix ./harpoon.nix ./markdown-preview.nix + ./peek.nix ./mini.nix ./neocord.nix ./neotest.nix @@ -20,7 +21,6 @@ ./persistence.nix ./plenary.nix ./project-nvim.nix - ./sidebar.nix ./tmux-navigator.nix ./todo-comments.nix ./ultimate-autopair.nix @@ -37,7 +37,8 @@ better-escape.enable = lib.mkDefault true; cloak.enable = lib.mkDefault true; harpoon.enable = lib.mkDefault true; - markdown-preview.enable = lib.mkDefault false; + markdown-preview.enable = lib.mkDefault true; + peek.enable = lib.mkDefault false; mini.enable = lib.mkDefault true; neocord.enable = lib.mkDefault true; neotest.enable = lib.mkDefault true; @@ -49,7 +50,6 @@ persistence.enable = lib.mkDefault true; plenary.enable = lib.mkDefault true; project-nvim.enable = lib.mkDefault true; - sidebar.enable = lib.mkDefault false; tmux-navigator.enable = lib.mkDefault true; todo-comments.enable = lib.mkDefault true; ultimate-autopair.enable = lib.mkDefault true; diff --git a/config/utils/markdown-preview.nix b/config/utils/markdown-preview.nix index d1bd2f72..d3ac17de 100644 --- a/config/utils/markdown-preview.nix +++ b/config/utils/markdown-preview.nix @@ -1,6 +1,5 @@ { lib, config, ... }: { - # TODO: Switch to peek.nvim options = { markdown-preview.enable = lib.mkEnableOption "Enable markdown-preview module"; }; diff --git a/config/utils/peek.nix b/config/utils/peek.nix new file mode 100644 index 00000000..c4a2b766 --- /dev/null +++ b/config/utils/peek.nix @@ -0,0 +1,50 @@ +{ + lib, + config, + pkgs, + ... +}: +{ + options = { + peek.enable = lib.mkEnableOption "Enable peek.nvim markdown preview module"; + }; + config = lib.mkIf config.peek.enable { + + extraPlugins = with pkgs.vimPlugins; [ peek-nvim ]; + extraPackages = with pkgs; [ deno ]; + + extraConfigLua = '' + require('peek').setup({ + auto_load = true, + close_on_bdelete = true, + theme = 'dark', + app = 'webview', + syntax = true, + update_on_change = true, + filetype = { 'markdown', 'html', 'pandoc', 'rmd', 'qmd', 'vimwiki', 'tex', 'latex' }, + }) + + vim.api.nvim_create_user_command('PeekOpen', require('peek').open, {}) + vim.api.nvim_create_user_command('PeekClose', require('peek').close, {}) + + _G.peek_toggle = function() + if require('peek').is_open() then + require('peek').close() + else + require('peek').open() + end + end + ''; + + keymaps = [ + { + mode = "n"; + key = "co"; + action = "lua _G.peek_toggle()"; + options = { + desc = "Toggle Markdown Preview"; + }; + } + ]; + }; +} diff --git a/config/utils/sidebar.nix b/config/utils/sidebar.nix deleted file mode 100644 index cae1145d..00000000 --- a/config/utils/sidebar.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -{ - options = { - sidebar.enable = lib.mkEnableOption "Enable sidebar module"; - }; - config = lib.mkIf config.sidebar.enable { - extraPlugins = with pkgs.vimUtils; [ - (buildVimPlugin { - pname = "sidebar.nvim"; - version = "2024-02-07"; - src = pkgs.fetchFromGitHub { - owner = "sidebar-nvim"; - repo = "sidebar.nvim"; - rev = "5695712eef6288fff667343c4ae77c54911bdb1b"; - sha256 = "1p12189367x0x26cys9wxipzwr3i0bmz4lb0s79ki0a49d6zja2c"; - }; - }) - ]; - extraConfigLua = '' - local sidebar = require("sidebar-nvim") - sidebar.setup({ - disable_default_keybindings = 0, - bindings = nil, - open = false, - side = "left", - initial_width = 32, - hide_statusline = false, - update_interval = 1000, - sections = { "git", "containers" }, - section_separator = {"", "-----", ""}, - section_title_separator = {""}, - containers = { - attach_shell = "/bin/sh", show_all = true, interval = 5000, - }, - datetime = { format = "%a %b %d, %H:%M", clocks = { { name = "local" } } }, - todos = { ignored_paths = {} }, - ["git"] = { - icon = "", --  - }, - }) - cmd = { - "SidebarNvimToggle", - "SidebarNvimOpen", - "SidebarNvimFocus", - "SidebarNvimUpdate", - }, - ''; - - keymaps = [ - { - mode = "n"; - key = "e"; - action = ":SidebarNvimToggle"; - options = { - desc = "Toggle Explorer"; - silent = true; - }; - } - ]; - }; -} diff --git a/config/utils/ultimate-autopair.nix b/config/utils/ultimate-autopair.nix index a89c7c56..2abb2fe0 100644 --- a/config/utils/ultimate-autopair.nix +++ b/config/utils/ultimate-autopair.nix @@ -10,17 +10,8 @@ }; config = lib.mkIf config.ultimate-autopair.enable { - extraPlugins = with pkgs.vimUtils; [ - (buildVimPlugin { - pname = "ultimate-autopair.nvim"; - version = "2024-02-05"; - src = pkgs.fetchFromGitHub { - owner = "altermo"; - repo = "ultimate-autopair.nvim"; - rev = "25c13e0ce167db0255456cac10158b27d2be30c0"; - sha256 = "0bsxfj6g8fii9nn92vl15hdhafx3fikgiz4srr7y10pxz01c5s4c"; - }; - }) + extraPlugins = with pkgs.vimPlugins; [ + ultimate-autopair-nvim ]; extraConfigLua = '' require('ultimate-autopair').setup() diff --git a/flake.lock b/flake.lock index 1a8c88a6..badac412 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1759362264, - "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", + "lastModified": 1778716662, + "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", "type": "github" }, "original": { @@ -39,65 +39,19 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "ixx": { - "inputs": { - "flake-utils": [ - "nixvim", - "nuschtosSearch", - "flake-utils" - ], - "nixpkgs": [ - "nixvim", - "nuschtosSearch", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1754860581, - "narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=", - "owner": "NuschtOS", - "repo": "ixx", - "rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "ref": "v0.1.1", - "repo": "ixx", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1759632233, - "narHash": "sha256-krgZxGAIIIKFJS+UB0l8do3sYUDWJc75M72tepmVMzE=", + "lastModified": 1780243769, + "narHash": "sha256-x5UQuRsH3MqI0U9afaXSNqzTPSeZlRLvFAav2Ux1pNw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10", + "rev": "331800de5053fcebacf6813adb5db9c9dca22a0c", "type": "github" }, "original": { "owner": "nixos", + "ref": "nixos-unstable", "repo": "nixpkgs", - "rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10", "type": "github" } }, @@ -107,15 +61,14 @@ "nixpkgs": [ "nixpkgs" ], - "nuschtosSearch": "nuschtosSearch", - "systems": "systems_3" + "systems": "systems_2" }, "locked": { - "lastModified": 1760861672, - "narHash": "sha256-TNBuBgesZcUO76dOi+xGFraT30umxQyfyogrWqiOJZE=", + "lastModified": 1780646548, + "narHash": "sha256-Ckyl/l1XBmEwnaHcHD8PvBZk1uph0NqwbJ//CAvB7iE=", "owner": "nix-community", "repo": "nixvim", - "rev": "b4852e4d359b89241497ee3cb29eaa83ef1510d4", + "rev": "816a15282e58678dde831477964987d0262d4293", "type": "github" }, "original": { @@ -124,29 +77,6 @@ "type": "github" } }, - "nuschtosSearch": { - "inputs": { - "flake-utils": "flake-utils_2", - "ixx": "ixx", - "nixpkgs": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1758662783, - "narHash": "sha256-igrxT+/MnmcftPOHEb+XDwAMq3Xg1Xy7kVYQaHhPlAg=", - "owner": "NuschtOS", - "repo": "search", - "rev": "7d4c0fc4ffe3bd64e5630417162e9e04e64b27a4", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "repo": "search", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", @@ -171,30 +101,16 @@ }, "systems_2": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1774449309, + "narHash": "sha256-brhZ8DmuGtzkCYHJg4HEd602amKm89Y9ytsFZ5uWD1w=", "owner": "nix-systems", "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "rev": "c29398b59d2048c4ab79345812849c9bd15e9150", "type": "github" }, "original": { "owner": "nix-systems", + "ref": "future-26.11", "repo": "default", "type": "github" } diff --git a/flake.nix b/flake.nix index 0e7b50f7..7c8c8a38 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Neve is a Neovim configuration built with Nixvim, which allows you to use Nix language to manage Neovim plugins/options"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/d7f52a7a640bc54c7bb414cca603835bf8dd4b10"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixvim.url = "github:nix-community/nixvim"; nixvim.inputs.nixpkgs.follows = "nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; @@ -18,7 +18,6 @@ }@inputs: let config = import ./config; # import the module directly - # Enable unfree packages nixpkgsConfig = { allowUnfree = true; }; @@ -47,10 +46,20 @@ { checks = { # Run `nix flake check .` to verify that your config is not broken - default = nixvimLib.check.mkTestDerivationFromNvim { - inherit nvim; - name = "Neve"; - }; + default = + (nixvimLib.check.mkTestDerivationFromNvim { + inherit nvim; + name = "Neve"; + }).overrideAttrs + (oldAttrs: { + # Neovim 0.12 requires $HOME/.local/share/nvim for stdpath('data'). + # The nixvim test harness only creates .cache/nvim. Pre-create the + # missing directory before running nvim. + buildCommand = '' + mkdir -p .local/share/nvim + '' + + oldAttrs.buildCommand; + }); }; packages = {