diff --git a/files/config/nvim/init.lua b/files/config/nvim/init.lua deleted file mode 100644 index 2514f9e..0000000 --- a/files/config/nvim/init.lua +++ /dev/null @@ -1,2 +0,0 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") diff --git a/files/config/nvim/lua/config/autocmds.lua b/files/config/nvim/lua/config/autocmds.lua deleted file mode 100644 index b5f7062..0000000 --- a/files/config/nvim/lua/config/autocmds.lua +++ /dev/null @@ -1,16 +0,0 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- Add any additional autocmds here - -local function augroup(name) - return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true }) -end - --- Set comment string for CUE files -vim.api.nvim_create_autocmd("FileType", { - group = augroup("cue"), - pattern = { "cue" }, - callback = function(ev) - vim.bo[ev.buf].commentstring = "// %s" - end, -}) diff --git a/files/config/nvim/lua/config/keymaps.lua b/files/config/nvim/lua/config/keymaps.lua deleted file mode 100644 index 5fc7f2d..0000000 --- a/files/config/nvim/lua/config/keymaps.lua +++ /dev/null @@ -1,19 +0,0 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here - --- C-/ should be comment instead of lazyterm -vim.keymap.del("n", "") -vim.keymap.set({ "n" }, "", "gcc", { remap = true }) -vim.keymap.set({ "v" }, "", "gc", { remap = true }) -vim.keymap.set({ "n" }, "", "gcgc", { remap = true }) -vim.keymap.del({ "n" }, "") -vim.keymap.set({ "n" }, "", "gcc", { remap = true }) -vim.keymap.set({ "v" }, "", "gc", { remap = true }) -vim.keymap.set({ "n" }, "", "gcgc", { remap = true }) - -vim.keymap.set("n", "", ",", { remap = true }) -vim.keymap.set("n", "zz", "zt", { remap = true }) - -vim.keymap.set("n", "[d", ":lua vim.diagnostic.goto_prev { float = false }", { remap = true }) -vim.keymap.set("n", "]d", ":lua vim.diagnostic.goto_next { float = false }", { remap = true }) diff --git a/files/config/nvim/lua/config/lazy.lua b/files/config/nvim/lua/config/lazy.lua deleted file mode 100644 index 7d70096..0000000 --- a/files/config/nvim/lua/config/lazy.lua +++ /dev/null @@ -1,60 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - -- bootstrap lazy.nvim - -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) -end -vim.opt.rtp:prepend(vim.env.LAZY or lazypath) - -require("lazy").setup({ - spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- extras - { import = "lazyvim.plugins.extras.dap.core" }, - { import = "lazyvim.plugins.extras.editor.overseer" }, - { import = "lazyvim.plugins.extras.editor.telescope" }, - { import = "lazyvim.plugins.extras.formatting.prettier" }, - { import = "lazyvim.plugins.extras.lang.go" }, - { import = "lazyvim.plugins.extras.lang.json" }, - { import = "lazyvim.plugins.extras.lang.markdown" }, - { import = "lazyvim.plugins.extras.lang.nix" }, - { import = "lazyvim.plugins.extras.lang.rust" }, - { import = "lazyvim.plugins.extras.lang.toml" }, - { import = "lazyvim.plugins.extras.lang.typescript" }, - { import = "lazyvim.plugins.extras.lang.yaml" }, - { import = "lazyvim.plugins.extras.lsp.none-ls" }, - { import = "lazyvim.plugins.extras.test.core" }, - { import = "lazyvim.plugins.extras.ui.edgy" }, - { import = "lazyvim.plugins.extras.ui.treesitter-context" }, - { import = "lazyvim.plugins.extras.util.gitui" }, - { import = "lazyvim.plugins.extras.util.project" }, - -- plugins - { import = "plugins" }, - }, - defaults = { - -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. - -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, - -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, - -- have outdated releases, which may break your Neovim install. - version = false, -- always use the latest git commit - -- version = "*", -- try installing the latest stable version for plugins that support semver - }, - checker = { enabled = false }, -- automatically check for plugin updates - performance = { - rtp = { - -- disable some rtp plugins - disabled_plugins = { - "gzip", - -- "matchit", - -- "matchparen", - "netrwPlugin", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", - }, - }, - }, -}) diff --git a/files/config/nvim/lua/config/options.lua b/files/config/nvim/lua/config/options.lua deleted file mode 100644 index 75e6b54..0000000 --- a/files/config/nvim/lua/config/options.lua +++ /dev/null @@ -1,36 +0,0 @@ -vim.opt.number = true -vim.opt.relativenumber = false - -vim.g.do_filetype_lua = 1 -vim.g.root_spec = { { ".git", "lua" }, "lsp", "cwd" } - -vim.o.autochdir = true -vim.o.fillchars = "stl: ,stlnc: ,eob:░" -vim.o.list = false -vim.o.scrolloff = 7 -vim.o.splitkeep = "screen" -vim.o.updatetime = 500 -vim.o.timeout = true -vim.o.timeoutlen = 0 - --- additional filetypes -vim.filetype.add({ - extension = { - templ = "templ", - }, -}) - --- AutoCommand OSC7 workaround for tmux --- see https://github.com/neovim/neovim/issues/21771 -vim.api.nvim_create_autocmd("dirchanged", { - pattern = "*", - command = 'call chansend(v:stderr, printf("\\033]7;%s\\033", v:event.cwd))', -}) - --- (No) Statusline - -vim.opt.laststatus = 0 -vim.api.nvim_set_hl(0, "Statusline", { link = "Normal" }) -vim.api.nvim_set_hl(0, "StatuslineNC", { link = "Normal" }) -local line = string.rep("▔", vim.api.nvim_win_get_width(0)) -vim.opt.statusline = "%#WinSeparator#" .. line .. "%*" diff --git a/files/config/nvim/lua/plugins/coding.lua b/files/config/nvim/lua/plugins/coding.lua deleted file mode 100644 index b2af23a..0000000 --- a/files/config/nvim/lua/plugins/coding.lua +++ /dev/null @@ -1,69 +0,0 @@ -return { - - { - "echasnovski/mini.pairs", - enabled = false, - }, - - { - "nvim-cmp", - dependencies = { "hrsh7th/cmp-emoji" }, - opts = function(_, opts) - local cmp = require("cmp") - table.insert(opts.sources, { name = "emoji" }) - - opts.view = { docs = { auto_open = false }, entries = { follow_cursor = true } } - opts.completion = { - autocomplete = false, - } - - local winhighlight = - "Normal:NoiceCmdlinePopupTitle,FloatBorder:NoiceCmdlinePopupBorder,CursorLine:PMenuSel,Search:Search" - - opts.window = { - completion = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }), - documentation = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }), - preview = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }), - } - - -- lua sorting = { comparators = { cmp.config.compare.sort_text, -- this needs to be 1st cmp.config.compare.offset, cmp.config.compare.exact, cmp.config.compare.score, cmp.config.compare.kind, cmp.config.compare.length, cmp.config.compare.order, } } - - opts.sorting = { - priority_weight = 2, - comparators = { - cmp.config.compare.exact, - cmp.config.compare.recently_used, - cmp.config.compare.locality, - cmp.config.compare.offset, - -- cmp.config.compare.scopes, - cmp.config.compare.score, - cmp.config.compare.kind, - -- cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - }, - } - - return opts - end, - }, - - { - "Exafunction/codeium.nvim", - opts = { - enable_chat = false, - }, - }, - - { - "monkoose/neocodeium", - event = "VeryLazy", - config = function() - local neocodeium = require("neocodeium") - neocodeium.setup() - vim.keymap.set("i", "", neocodeium.accept) - vim.keymap.set("i", "", neocodeium.accept) - vim.keymap.set("i", "", neocodeium.cycle_or_complete) - end, - }, -} diff --git a/files/config/nvim/lua/plugins/colorscheme.lua b/files/config/nvim/lua/plugins/colorscheme.lua deleted file mode 100644 index 738a94e..0000000 --- a/files/config/nvim/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - { - "https://patagia.dev/patagia/dieter.nvim.git", - lazy = false, - priority = 1000, - }, - - { - "LazyVim/LazyVim", - opts = { - colorscheme = "dieter", - }, - }, -} diff --git a/files/config/nvim/lua/plugins/editor.lua b/files/config/nvim/lua/plugins/editor.lua deleted file mode 100644 index eaf6f32..0000000 --- a/files/config/nvim/lua/plugins/editor.lua +++ /dev/null @@ -1,100 +0,0 @@ -return { - { - "folke/flash.nvim", - enabled = false, - }, - - { - "telescope.nvim", - keys = { - { - "", - function() - local telescope = require("telescope") - local jj_pick_status, jj_res = pcall(telescope.extensions.jj.files, opts) - if jj_pick_status then - return - end - local git_files_status, git_res = pcall(telescope.builtin.git_files, opts) - if not git_files_status then - error("Could not launch jj/git files: \n" .. jj_res .. "\n" .. git_res) - end - end, - desc = "VCS Files", - }, - { - "", - "Telescope projects", - desc = "Projects", - }, - }, - opts = function(_, opts) - local actions = require("telescope.actions") - opts.defaults = { - layout_strategy = "horizontal", - layout_config = { - anchor = "top", - horizontal = { - prompt_position = "top", - mirror = false, - preview_width = 0.49, - -- preview_height = 0.5, - }, - width = 0.99, - height = 0.9, - preview_cutoff = 10, - }, - mappings = { - i = { - [""] = actions.close, -- close popup - [""] = false, -- clear prompt - [""] = false, -- clear prompt - }, - }, - path_display = { "filename_first" }, - -- previewer = false, - preview = { - -- hide_on_startup = true, - }, - sorting_strategy = "ascending", - winblend = 0, - wrap_results = true, - } - end, - }, - - { "avm99963/vim-jjdescription", lazy = false }, - - { - "zschreur/telescope-jj.nvim", - keys = { - { - "jc", - function() - require("telescope").extensions.jj.conflicts() - end, - desc = "jj conflicts", - }, - { - "jd", - function() - require("telescope").extensions.jj.diff() - end, - desc = "jj diffs", - }, - { - "jf", - function() - require("telescope").extensions.jj.files() - end, - desc = "jj files", - }, - }, - config = function() - LazyVim.on_load("telescope.nvim", function() - local telescope = require("telescope") - telescope.load_extension("jj") - end) - end, - }, -} diff --git a/files/config/nvim/lua/plugins/extras.lua b/files/config/nvim/lua/plugins/extras.lua deleted file mode 100644 index 79d1a52..0000000 --- a/files/config/nvim/lua/plugins/extras.lua +++ /dev/null @@ -1,99 +0,0 @@ -return { - { - "direnv/direnv.vim", - lazy = false, - priority = 900, - config = function() - vim.g.direnv_silent_load = 1 - end, - }, - - { - "nvimtools/none-ls.nvim", - opts = function(_, opts) - local nls = require("null-ls") - opts.root_dir = opts.root_dir - or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git") - opts.sources = vim.list_extend(opts.sources or {}, { - nls.builtins.formatting.mdformat, - nls.builtins.formatting.stylua, - nls.builtins.formatting.shfmt, - nls.builtins.formatting.buf, - nls.builtins.formatting.buildifier, - nls.builtins.diagnostics.buildifier, - nls.builtins.diagnostics.buf.with({ - args = { "lint", "--disable-symlinks", "--path", "$FILENAME" }, - cwd = function() - local file_dir = vim.fn.expand("%:p:h") .. ";" - local buf_yaml = vim.fn.findfile("buf.yaml", file_dir) - if buf_yaml then - return vim.fn.fnamemodify(buf_yaml, ":h") - end - end, - }), - }) - end, - }, - - { - "nvim-neo-tree/neo-tree.nvim", - opts = { - window = { - width = 30, - position = "right", - }, - }, - }, - - { - "simrat39/rust-tools.nvim", - enabled = false, - }, - - { - "mrcjkb/rustaceanvim", - version = "^4", -- Recommended - ft = { "rust" }, - opts = { - server = { - on_attach = function(_, bufnr) - vim.keymap.set("n", "cR", function() - vim.cmd.RustLsp("codeAction") - end, { desc = "Code Action", buffer = bufnr }) - vim.keymap.set("n", "dr", function() - vim.cmd.RustLsp("debuggables") - end, { desc = "Rust debuggables", buffer = bufnr }) - vim.keymap.set("n", "cD", function() - vim.cmd.RustLsp("externalDocs") - end, { desc = "Rust external documentation", buffer = bufnr }) - end, - }, - - settings = { - -- rust-analyzer language server configuration - ["rust-analyzer"] = { - cargo = { - allFeatures = true, - loadOutDirsFromCheck = true, - runBuildScripts = true, - targetDir = true, - }, - -- Add clippy lints for Rust. - checkOnSave = { - allFeatures = true, - command = "clippy", - extraArgs = { "--no-deps" }, - }, - procMacro = { - enable = true, - ignored = { - ["async-trait"] = { "async_trait" }, - ["napi-derive"] = { "napi" }, - ["async-recursion"] = { "async_recursion" }, - }, - }, - }, - }, - }, - }, -} diff --git a/files/config/nvim/lua/plugins/formatting.lua b/files/config/nvim/lua/plugins/formatting.lua deleted file mode 100644 index f1272ab..0000000 --- a/files/config/nvim/lua/plugins/formatting.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - ["cue"] = { { "cue_fmt" } }, - ["html"] = { { "prettierd", "prettier" } }, - ["nix"] = { "nixfmt" }, - ["sass"] = { { "prettierd", "prettier" } }, - ["proto"] = { { "buf" } }, - ["terraform"] = { { "terraform_fmt" } }, - }, - }, - }, -} diff --git a/files/config/nvim/lua/plugins/incline.lua b/files/config/nvim/lua/plugins/incline.lua deleted file mode 100644 index c594785..0000000 --- a/files/config/nvim/lua/plugins/incline.lua +++ /dev/null @@ -1,72 +0,0 @@ -return { - "b0o/incline.nvim", - config = function() - local devicons = require("nvim-web-devicons") - require("incline").setup({ - window = { - margin = { - horizontal = 0, - vertical = 0, - }, - padding = 0, - placement = { - horizontal = "right", - vertical = "bottom", - }, - }, - render = function(props) - local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t") - if filename == "" then - filename = "[No Name]" - end - local ft_icon, ft_color = devicons.get_icon_color(filename) - - local function get_git_diff() - local icons = { removed = " ", changed = " ", added = " " } - local signs = vim.b[props.buf].gitsigns_status_dict - local labels = {} - if signs == nil then - return labels - end - for name, icon in pairs(icons) do - if tonumber(signs[name]) and signs[name] > 0 then - table.insert(labels, { icon .. signs[name] .. " ", group = "Diff" .. name }) - end - end - if #labels > 0 then - table.insert(labels, { "│ " }) - end - return labels - end - - local function get_diagnostic_label() - local icons = { error = " ", warn = " ", info = " ", hint = " " } - local label = {} - - for severity, icon in pairs(icons) do - local n = #vim.diagnostic.get( - props.buf, - { severity = vim.diagnostic.severity[string.upper(severity)] } - ) - if n > 0 then - table.insert(label, { icon .. n .. " ", group = "DiagnosticSign" .. severity }) - end - end - if #label > 0 then - table.insert(label, { "│ " }) - end - return label - end - - return { - { " " }, - { get_diagnostic_label() }, - { get_git_diff() }, - { filename, group = "Label" }, - { " " }, - } - end, - }) - end, - event = "VeryLazy", -} diff --git a/files/config/nvim/lua/plugins/lsp.lua b/files/config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index f317693..0000000 --- a/files/config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,35 +0,0 @@ -return { - { - "neovim/nvim-lspconfig", - opts = { - diagnostics = { - virtual_text = false, - }, - inlay_hints = { enabled = false }, - -- codelens = { - -- enabled = true, - -- }, - servers = { - nil_ls = {}, - nixd = {}, - starpls = {}, - yamlls = { - settings = { - yaml = { - schemas = { - -- kubernetes = "*.yaml", - ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*", - ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}", - ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}", - ["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}", - ["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}", - ["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}", - ["https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.29.1/all.json"] = "/*.yaml", - }, - }, - }, - }, - }, - }, - }, -} diff --git a/files/config/nvim/lua/plugins/treesitter.lua b/files/config/nvim/lua/plugins/treesitter.lua deleted file mode 100644 index 0aea1c4..0000000 --- a/files/config/nvim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,41 +0,0 @@ -return { - { - "nvim-treesitter/nvim-treesitter-context", - opts = { - enable = false, - }, - }, - - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { - "bash", - "c", - "diff", - "go", - "html", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "luadoc", - "luap", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "rust", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc", - "xml", - "yaml", - }) - end, - }, -} diff --git a/files/config/nvim/lua/plugins/ui.lua b/files/config/nvim/lua/plugins/ui.lua deleted file mode 100644 index 7645a72..0000000 --- a/files/config/nvim/lua/plugins/ui.lua +++ /dev/null @@ -1,130 +0,0 @@ -return { - { - "nvimdev/dashboard-nvim", - enabled = false, - }, - - { - "dgagn/diagflow.nvim", - -- event = 'LspAttach', This is what I use personnally and it works great - opts = { - scope = "line", - gap_size = 0, - max_width = 50, - max_height = 20, - show_borders = true, - toggle_event = { "InsertEnter", "InsertLeave" }, - }, - }, - - { - "akinsho/bufferline.nvim", - enabled = false, - }, - - { - "echasnovski/mini.indentscope", - enabled = false, - }, - - { - "lukas-reineke/indent-blankline.nvim", - enabled = false, - }, - - { "nvimdev/indentmini.nvim", opts = { char = "│" } }, - - { - "mvllow/modes.nvim", - opts = { - colors = { - copy = "#f5c359", - delete = "#c75c6a", - insert = "#ffcc00", - visual = "#c343fc", - }, - set_cursor = true, - set_cursorline = true, - set_number = true, - }, - }, - - { - "folke/noice.nvim", - event = "VeryLazy", - keys = { - { "sna", "NoiceTelescope", desc = "Show all messages in Telescope" }, - }, - opts = function() - local enable_conceal = true -- Hide command text if true - return { - presets = { bottom_search = true }, -- The kind of popup used for / - cmdline = { - view = "cmdline", -- The kind of popup used for : - format = { - cmdline = { conceal = enable_conceal }, - search_down = { conceal = enable_conceal }, - search_up = { conceal = enable_conceal }, - filter = { conceal = enable_conceal }, - lua = { conceal = enable_conceal }, - help = { conceal = enable_conceal }, - input = { conceal = enable_conceal }, - }, - }, - - messages = { enabled = true, view = "mini" }, - lsp = { - hover = { enabled = false }, - signature = { enabled = false }, - progress = { enabled = true, view = "cmdline" }, - message = { enabled = false }, - smart_move = { enabled = false }, - }, - } - end, - }, - - { - "rcarriga/nvim-notify", - opts = { - timeout = 1000, - render = "wrapped-compact", - top_down = false, - max_width = function() - return math.floor(vim.o.columns * 0.5) - end, - on_open = function(win) - vim.api.nvim_win_set_config(win, { - focusable = false, - zindex = 100, - }) - end, - }, - }, - - { - "nvim-lualine/lualine.nvim", - enabled = false, - }, - - { - "DrKJeff16/project.nvim", - config = function(_, opts) - if vim.fn.argv()[1] == nil then - require("project_nvim").setup(opts) -- Workaround for project.nvim not setting up - vim.schedule(function() - vim.cmd("Telescope projects") - end) - end - end, - opts = { - exclude_dirs = { - "~/.cargo/*", - "~/.config/*", - "/tmp/*", - }, - manual_mode = false, - patterns = { ".git", ".jj" }, - }, - }, -} diff --git a/flake.lock b/flake.lock index ef8d639..8f07eb6 100644 --- a/flake.lock +++ b/flake.lock @@ -29,11 +29,11 @@ "zig": "zig" }, "locked": { - "lastModified": 1729600492, - "narHash": "sha256-lQ1oSHfNRvveB9YEMetEFl6a8Tpb6cQkMtSQKAYBLMQ=", + "lastModified": 1730776162, + "narHash": "sha256-ODmmTWz3jqaPmJ1UiJgHD3oy90BTEd871GZHyT5Xn9M=", "ref": "refs/heads/main", - "rev": "5e001fcb64deeee69b92a03a51d05a21b09153bd", - "revCount": 7763, + "rev": "f9199a46118f173ac7a005130f871fdf050f94d1", + "revCount": 7881, "type": "git", "url": "ssh://git@github.com/ghostty-org/ghostty" }, @@ -64,11 +64,11 @@ ] }, "locked": { - "lastModified": 1729551526, - "narHash": "sha256-7LAGY32Xl14OVQp3y6M43/0AtHYYvV6pdyBcp3eoz0s=", + "lastModified": 1730633670, + "narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=", "owner": "nix-community", "repo": "home-manager", - "rev": "5ec753a1fc4454df9285d8b3ec0809234defb975", + "rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661", "type": "github" }, "original": { @@ -79,11 +79,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729413321, - "narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=", + "lastModified": 1730531603, + "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26", + "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", "type": "github" }, "original": { @@ -95,11 +95,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1729449015, - "narHash": "sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo=", + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "89172919243df199fe237ba0f776c3e3e3d72367", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", "type": "github" }, "original": { diff --git a/home/common/default.nix b/home/common/default.nix index 0697d99..3a2a686 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -9,7 +9,7 @@ ./gnome.nix ./k8s.nix ./nix.nix - ./nvim.nix + ./nvim ./scripts.nix ./ssh.nix ./tmux.nix diff --git a/home/common/nvim.nix b/home/common/nvim.nix deleted file mode 100644 index 9e65aaf..0000000 --- a/home/common/nvim.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ ... }: -{ - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - withNodeJs = false; - withPython3 = false; - withRuby = false; - }; - - xdg.configFile = { - "nvim" = { - recursive = true; - source = ./../../files/config/nvim; - }; - }; -} diff --git a/home/common/nvim/default.nix b/home/common/nvim/default.nix new file mode 100644 index 0000000..0c759b8 --- /dev/null +++ b/home/common/nvim/default.nix @@ -0,0 +1,119 @@ +{ lib, pkgs, ... }: +{ + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + withNodeJs = false; + withPython3 = false; + withRuby = false; + + extraLuaConfig = lib.fileContents ./init.lua; + extraPackages = with pkgs; [ + black + cue + go + gopls + gotools + lua-language-server + nil + nixd + nodePackages.prettier + nodePackages.typescript + nodePackages.typescript-language-server + nodePackages.bash-language-server + rust-analyzer + shellcheck + shfmt + stylua + tree-sitter + tree-sitter-grammars.tree-sitter-bash + tree-sitter-grammars.tree-sitter-yaml + tree-sitter-grammars.tree-sitter-go + tree-sitter-grammars.tree-sitter-markdown + tree-sitter-grammars.tree-sitter-lua + tree-sitter-grammars.tree-sitter-html + tree-sitter-grammars.tree-sitter-vim + tree-sitter-grammars.tree-sitter-nix + vscode-langservers-extracted + ]; + + + plugins = with pkgs.vimPlugins; [ + go-nvim + rustaceanvim + targets-vim + + { + plugin = pkgs.vimUtils.buildVimPlugin { + name = "dieter-nvim"; + src = pkgs.fetchgit { + url = "https://patagia.dev/Patagia/dieter.nvim.git"; + rev = "08fae6ffec4ae70ba6b2e1cafa780ff317ef0b61"; + hash = "sha256-C+Vo2SUVfNMkBwuLWqLoA59Pmy9aFwur7fBpfVkLm6Q="; + }; + }; + type = "lua"; + config = '' + vim.cmd.colorscheme "dieter" + ''; + } + + { + plugin = nvim-treesitter.withAllGrammars; # Treesitter + type = "lua"; + config = '' + require'nvim-treesitter.configs'.setup { + highlight = { enable = true, }, + indent = { enable = true }, + } + ''; + } + + { + plugin = pkgs.vimUtils.buildVimPlugin { + name = "nvim-tree-pairs"; # make % match in TS + src = pkgs.fetchFromGitHub { + owner = "yorickpeterse"; + repo = "nvim-tree-pairs"; + rev = "e7f7b6cc28dda6f3fa271ce63b0d371d5b7641da"; + hash = "sha256-fb4EsrWAbm8+dWAhiirCPuR44MEg+KYb9hZOIuEuT24="; + }; + }; + type = "lua"; + config = "require('tree-pairs').setup()"; + } + + { + plugin = nvim-treesitter-textobjects; # helix-style selection of TS tree + type = "lua"; + config = '' + require'nvim-treesitter.configs'.setup { + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + scope_incremental = "", + node_incremental = "", + node_decremental = "", + }, + }, + } + ''; + } + + { + plugin = mini-nvim; + type = "lua"; + config = lib.fileContents ./mini.lua; + } + + { + plugin = nvim-lspconfig; # Interface for LSPs + type = "lua"; + config = lib.fileContents ./lsp.lua; + } + ]; + }; +} diff --git a/home/common/nvim/init.lua b/home/common/nvim/init.lua new file mode 100644 index 0000000..ba179d8 --- /dev/null +++ b/home/common/nvim/init.lua @@ -0,0 +1,93 @@ +-- vim.g.mapleader = "" +vim.g.maplocalleader = ',' + +-- UI + +vim.opt.cursorline = true +vim.opt.laststatus = 0 +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.ruler = true +vim.opt.rulerformat = "" -- FIXME: fancify! +vim.opt.rulerformat = "%36(%5l,%-6(%c%V%) %t%)%*" +vim.opt.syntax = "on" +vim.opt.termguicolors = true + +-- Search +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Tab completion +-- vim.opt.wildmode="list:longest,full" +vim.opt.wildignore="*.swp,*.o,*.so,*.exe,*.dll" + +-- Whitespaces +vim.opt.breakindent = true +vim.opt.copyindent = true +vim.opt.expandtab = true +vim.opt.softtabstop = 2 +vim.opt.shiftround = true +vim.opt.shiftwidth = 2 +vim.opt.smartindent = true +vim.opt.tabstop = 2 +vim.opt.wrap = false +vim.opt.list = true +vim.opt.listchars="tab:»·,trail:·" + +-- Folds +vim.opt.foldenable = false +vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()" +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + +-- + +vim.o.autochdir = true +vim.o.fillchars = "stl: ,stlnc: ,eob:░,vert:│" +vim.o.list = false +vim.o.scrolloff = 7 +vim.o.splitkeep = "screen" +vim.o.updatetime = 50 +vim.o.timeout = true +vim.o.timeoutlen = 10 +vim.o.icm = "split" +-- vim.o.cia = 'kind,abbr,menu' wait for nightly to drop + +vim.o.showmode = false + + +-- Use rg +vim.o.grepprg = [[rg --glob "!.jj" --glob "!.git" --no-heading --vimgrep --follow $*]] +vim.opt.grepformat = vim.opt.grepformat ^ { "%f:%l:%c:%m" } + +vim.fn.sign_define( + "DiagnosticSignError", + { text = "", hl = "DiagnosticSignError", texthl = "DiagnosticSignError", culhl = "DiagnosticSignErrorLine" } +) +vim.fn.sign_define( + "DiagnosticSignWarn", + { text = "", hl = "DiagnosticSignWarn", texthl = "DiagnosticSignWarn", culhl = "DiagnosticSignWarnLine" } +) +vim.fn.sign_define( + "DiagnosticSignInfo", + { text = "", hl = "DiagnosticSignInfo", texthl = "DiagnosticSignInfo", culhl = "DiagnosticSignInfoLine" } +) +vim.fn.sign_define( + "DiagnosticSignHint", + { text = "", hl = "DiagnosticSignHint", texthl = "DiagnosticSignHint", culhl = "DiagnosticSignHintLine" } +) + +-- Make work for snippets +vim.keymap.set({ "i", "s" }, "", function() + if vim.snippet.active({ direction = 1 }) then + return "lua vim.snippet.jump(1)" + else + return "" + end +end, { expr = true }) + +vim.keymap.set({ "n" }, "", "gcc", { remap = true }) +vim.keymap.set({ "v" }, "", "gc", { remap = true }) +vim.keymap.set({ "n" }, "", "gcc", { remap = true }) +vim.keymap.set({ "v" }, "", "gc", { remap = true }) +vim.keymap.set("n", "zz", "zt", { remap = true }) diff --git a/home/common/nvim/lsp.lua b/home/common/nvim/lsp.lua new file mode 100644 index 0000000..852d1f5 --- /dev/null +++ b/home/common/nvim/lsp.lua @@ -0,0 +1,92 @@ +vim.keymap.set("n", "d", vim.diagnostic.setloclist, { desc = "Add buffer diagnostics to the location list." }) + +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = function(str) + return { buffer = ev.buf, desc = str } + end + + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client.server_capabilities.codeLensProvider then + vim.lsp.codelens.refresh({ bufnr = bufnr }) + end + + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, {}) + + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts("Declaration")) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts("Definition")) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts("Implementation")) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts("Signature Help")) + vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts("Signature Help")) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts("Add Workspace Folder")) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts("Remove Workspace Folder")) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts("List Workspace Folders")) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts("Type Definition")) + vim.keymap.set("n", "r", vim.lsp.buf.rename, opts("Rename Symbol")) + vim.keymap.set({ "n", "v" }, "a", vim.lsp.buf.code_action, opts("Code Action")) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts("Buffer References")) + vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ async = true }) + end, opts("Format Buffer")) + end, +}) + +local configs = require('lspconfig.configs') +local lspconfig = require("lspconfig") +local capabilities = vim.lsp.protocol.make_client_capabilities() + +local servers = { + 'gopls', + 'nil_ls', + 'ts_ls', +} + +for _, ls in ipairs(servers) do + lspconfig[ls].setup { + capabilities = capabilities, + on_attach = function(_, buf) + vim.api.nvim_set_option_value('omnifunc', 'v:lua.MiniCompletion.completefunc_lsp', {buf = buf}) + end, + } +end + +lspconfig.nixd.setup({ + capabilities = capabilities, + cmd = { "nixd" }, + settings = { + nixd = { + nixpkgs = { expr = "import { }" }, + formatting = { command = { "nixfmt" } }, + options = {}, + }, + }, +}) + +lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + path = vim.split(package.path, ";"), + }, + diagnostics = { globals = { "vim", "hs" } }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, + }, + }, + }, + }, +}) diff --git a/home/common/nvim/mini.lua b/home/common/nvim/mini.lua new file mode 100644 index 0000000..c7d4689 --- /dev/null +++ b/home/common/nvim/mini.lua @@ -0,0 +1,130 @@ + local opts = function(label) + return {noremap = true, silent = true, desc = label} + end + require('mini.ai').setup() + require('mini.align').setup() + require('mini.bracketed').setup() + require('mini.completion').setup() + require('mini.diff').setup() + require('mini.extra').setup() + require('mini.icons').setup() + require('mini.jump').setup() + -- require('mini.pairs').setup() + -- require('mini.statusline').setup() + require('mini.surround').setup() + require('mini.splitjoin').setup() + + require('mini.files').setup() + local oil_style = function() + if not MiniFiles.close() then + MiniFiles.open(vim.api.nvim_buf_get_name(0)) + MiniFiles.reveal_cwd() + end + end + vim.keymap.set('n', '-', oil_style, opts("File Explorer")); + + local hipatterns = require('mini.hipatterns') + hipatterns.setup({ -- highlight strings and colors + highlighters = { + -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' + fixme = { pattern = '%f[%w]()FIXME()%f[%W]', group = 'MiniHipatternsFixme' }, + hack = { pattern = '%f[%w]()HACK()%f[%W]', group = 'MiniHipatternsHack' }, + todo = { pattern = '%f[%w]()TODO()%f[%W]', group = 'MiniHipatternsTodo' }, + note = { pattern = '%f[%w]()NOTE()%f[%W]', group = 'MiniHipatternsNote' }, + + -- Highlight hex color strings (`#rrggbb`) using that color + hex_color = hipatterns.gen_highlighter.hex_color(), + } + }) + + require('mini.jump2d').setup({ + mappings = { + start_jumping = 'gw' + } + }) + + require('mini.pick').setup({ + mappings = { + move_down = '' + }, + options = { + use_cache = true + } + }) + MiniPick.registry.files_root = function(local_opts) + local root_patterns = { ".jj", ".git" } + local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, { upward = true })[1]) + local opts = { source = { cwd = root_dir, tool = "ripgrep"} } + local_opts.cwd = root_dir + local_opts.tool = "rg" + return MiniPick.builtin.files(local_opts, opts) + end + MiniPick.registry.grep_live_root = function(local_opts) + local root_patterns = { ".jj", ".git" } + local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, { upward = true })[1]) + local opts = { source = { cwd = root_dir } } + local_opts.cwd = root_dir + return MiniPick.builtin.grep_live(local_opts, opts) + end + vim.keymap.set('n', '/', "Pick grep_live_root", opts("Live Grep")) + vim.keymap.set('n', 'F', "Pick files", opts("Find Files in CWD")) + vim.keymap.set('n', 'ff', "Pick files_root", opts("Find Files")) + vim.keymap.set('n', 'fr', "Pick oldfiles", opts("Recent Files")) + vim.keymap.set('n', 'b', "Pick buffers", opts("Buffers")) + vim.keymap.set('n', 'd', "Pick diagnostics", opts("Diagnostics")) + vim.keymap.set('n', '', "Pick buffers include_current=false", opts("Buffers")) + vim.keymap.set('n', "'", "Pick resume", opts("Last Picker")) + vim.keymap.set('n', "g", "Pick git_commits", opts("Git Commits")) + + + local miniclue = require('mini.clue') + miniclue.setup({ -- cute prompts about bindings + triggers = { + { mode = 'n', keys = '' }, + { mode = 'x', keys = '' }, + { mode = 'n', keys = '' }, + { mode = 'x', keys = '' }, + + -- Built-in completion + { mode = 'i', keys = '' }, + + -- `g` key + { mode = 'n', keys = 'g' }, + { mode = 'x', keys = 'g' }, + + -- Marks + { mode = 'n', keys = "'" }, + { mode = 'n', keys = '`' }, + { mode = 'x', keys = "'" }, + { mode = 'x', keys = '`' }, + + -- Registers + { mode = 'n', keys = '"' }, + { mode = 'x', keys = '"' }, + { mode = 'i', keys = '' }, + { mode = 'c', keys = '' }, + + -- Window commands + { mode = 'n', keys = '' }, + + -- `z` key + { mode = 'n', keys = 'z' }, + { mode = 'x', keys = 'z' }, + + -- Bracketed + { mode = 'n', keys = '[' }, + { mode = 'n', keys = ']' }, + }, + clues = { + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + miniclue.gen_clues.z(), + }, + window = { + delay = 15, + } + }) + diff --git a/home/common/utils.nix b/home/common/utils.nix index 7d5fd93..0a608da 100644 --- a/home/common/utils.nix +++ b/home/common/utils.nix @@ -55,6 +55,8 @@ arguments = [ "--glob=!.git/*" "--glob=!.jj/*" + "--glob=!result/*" + "--glob=!target/*" ]; };