From d360f0e7016f1e016c4b9bd6d7228e7147af9f0a Mon Sep 17 00:00:00 2001 From: iofq Date: Sat, 5 Jul 2025 20:36:06 -0500 Subject: [PATCH] no more oil --- flake.lock | 19 +----- flake.nix | 110 ++++++++++++++++---------------- nix/neovim-overlay.nix | 16 +++-- nvim/lua/config/init.lua | 13 ++-- nvim/lua/plugins/completion.lua | 2 +- nvim/lua/plugins/mini.lua | 39 ++++++----- nvim/lua/plugins/misc.lua | 25 -------- 7 files changed, 97 insertions(+), 127 deletions(-) diff --git a/flake.lock b/flake.lock index e0a33d9..7cf582e 100644 --- a/flake.lock +++ b/flake.lock @@ -394,30 +394,13 @@ "type": "github" } }, - "oil-nvim": { - "flake": false, - "locked": { - "lastModified": 1749076816, - "narHash": "sha256-fbRbRT9VJdppOs4hML1J113qLHdj7YRuSDQgZkt34cM=", - "owner": "stevearc", - "repo": "oil.nvim", - "rev": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb", - "type": "github" - }, - "original": { - "owner": "stevearc", - "repo": "oil.nvim", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", "gen-luarc": "gen-luarc", "mini-nvim": "mini-nvim", "neovim-nightly-overlay": "neovim-nightly-overlay", - "nixpkgs": "nixpkgs_2", - "oil-nvim": "oil-nvim" + "nixpkgs": "nixpkgs_2" } }, "systems": { diff --git a/flake.nix b/flake.nix index 5c2dd29..78131bc 100644 --- a/flake.nix +++ b/flake.nix @@ -13,10 +13,6 @@ url = "github:echasnovski/mini.nvim"; flake = false; }; - oil-nvim = { - url = "github:stevearc/oil.nvim"; - flake = false; - }; # Add bleeding-edge plugins here. # They can be updated with `nix flake update` (make sure to commit the generated flake.lock) # wf-nvim = { @@ -24,57 +20,63 @@ # flake = false; # }; }; - outputs = inputs @ { - self, - nixpkgs, - flake-utils, - ... - }: let - systems = builtins.attrNames nixpkgs.legacyPackages; + outputs = + inputs@{ + self, + nixpkgs, + flake-utils, + ... + }: + let + systems = builtins.attrNames nixpkgs.legacyPackages; - # This is where the Neovim derivation is built. - neovim-overlay = import ./nix/neovim-overlay.nix {inherit inputs;}; - in - flake-utils.lib.eachSystem systems (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [ - inputs.neovim-nightly-overlay.overlays.default - neovim-overlay - # This adds a function can be used to generate a .luarc.json - # containing the Neovim API all plugins in the workspace directory. - # The generated file can be symlinked in the devShell's shellHook. - inputs.gen-luarc.overlays.default - ]; - }; - shell = pkgs.mkShell { - name = "nvim-devShell"; - buildInputs = with pkgs; [ - lua-language-server - nil - stylua - luajitPackages.luacheck - alejandra - ]; - shellHook = '' - # symlink the .luarc.json generated in the overlay - ln -fs ${pkgs.nvim-luarc-json} .luarc.json - # allow quick iteration of lua configs - ln -Tfns $PWD/nvim ~/.config/nvim-dev - ''; - }; - in { - packages = rec { - default = nvim; - nvim = pkgs.nvim-pkg; - nvim-min = pkgs.nvim-min-pkg; - nvim-dev = pkgs.nvim-dev; - }; - devShells = { - default = shell; - }; - }) + # This is where the Neovim derivation is built. + neovim-overlay = import ./nix/neovim-overlay.nix { inherit inputs; }; + in + flake-utils.lib.eachSystem systems ( + system: + let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [ + inputs.neovim-nightly-overlay.overlays.default + neovim-overlay + # This adds a function can be used to generate a .luarc.json + # containing the Neovim API all plugins in the workspace directory. + # The generated file can be symlinked in the devShell's shellHook. + inputs.gen-luarc.overlays.default + ]; + }; + shell = pkgs.mkShell { + name = "nvim-devShell"; + buildInputs = with pkgs; [ + lua-language-server + nil + stylua + luajitPackages.luacheck + alejandra + ]; + shellHook = '' + # symlink the .luarc.json generated in the overlay + ln -fs ${pkgs.nvim-luarc-json} .luarc.json + # allow quick iteration of lua configs + ln -Tfns $PWD/nvim ~/.config/nvim-dev + ''; + }; + in + { + packages = rec { + default = nvim; + nvim = pkgs.nvim-pkg; + nvim-min = pkgs.nvim-min-pkg; + nvim-dev = pkgs.nvim-dev; + }; + devShells = { + default = shell; + }; + } + ) // { overlays.default = neovim-overlay; }; diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 87fdbce..1e2a8b2 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -1,18 +1,20 @@ # This overlay, when applied to nixpkgs, adds the final neovim derivation to nixpkgs. -{inputs}: final: prev: -with final.pkgs.lib; let +{ inputs }: +final: prev: +with final.pkgs.lib; +let pkgs = final; pkgs-wrapNeovim = prev; - mkNvimPlugin = src: pname: + mkNvimPlugin = + src: pname: pkgs.vimUtils.buildVimPlugin { inherit pname src; version = src.lastModifiedDate; }; - mkNeovim = pkgs.callPackage ./mkNeovim.nix {inherit pkgs-wrapNeovim;}; + mkNeovim = pkgs.callPackage ./mkNeovim.nix { inherit pkgs-wrapNeovim; }; mini-nvim-git = mkNvimPlugin inputs.mini-nvim "mini.nvim"; - oil-nvim-git = mkNvimPlugin inputs.oil-nvim "oil.nvim"; all-plugins = with pkgs.vimPlugins; [ blink-cmp @@ -31,7 +33,6 @@ with final.pkgs.lib; let nvim-treesitter-context nvim-treesitter-textobjects nvim-treesitter.withAllGrammars - oil-nvim-git quicker-nvim refactoring-nvim render-markdown-nvim @@ -62,7 +63,8 @@ with final.pkgs.lib; let jujutsu fd ]; -in { +in +{ nvim-pkg = mkNeovim { plugins = all-plugins; appName = "nvim"; diff --git a/nvim/lua/config/init.lua b/nvim/lua/config/init.lua index fd54f6b..af169ee 100644 --- a/nvim/lua/config/init.lua +++ b/nvim/lua/config/init.lua @@ -4,10 +4,11 @@ vim.opt.confirm = true vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } vim.opt.cmdheight = 1 vim.opt.diffopt = 'internal,filler,closeoff,inline:char' -vim.opt.expandtab = true -- insert tabs as spaces +vim.opt.expandtab = true -- insert tabs as spaces vim.o.foldenable = true -vim.o.foldmethod = 'expr' -- use tree-sitter for folding method +vim.o.foldmethod = 'expr' -- use tree-sitter for folding method vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()' +vim.o.foldlevelstart = 99 vim.opt.inccommand = 'split' -- incremental live completion vim.opt.list = true vim.opt.nrformats:append('alpha') -- let Ctrl-a do letters as well @@ -62,12 +63,14 @@ vim.diagnostic.config { -- Allow basic deletion in qflist vim.api.nvim_create_autocmd({ 'FileType' }, { - pattern = "qf", + pattern = 'qf', callback = function() - vim.keymap.set({ "n", "i" }, 'dd', function() + vim.keymap.set({ 'n', 'i' }, 'dd', function() local ln = vim.fn.line('.') local qf = vim.fn.getqflist() - if #qf == 0 then return end + if #qf == 0 then + return + end table.remove(qf, ln) vim.fn.setqflist(qf, 'r') vim.cmd('copen') diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index 0e15172..62368fb 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -8,7 +8,7 @@ return { }, opts = { enabled = function() - return not vim.tbl_contains({ 'snacks_picker_input', 'oil' }, vim.bo.filetype) + return not vim.tbl_contains({ 'snacks_picker_input' }, vim.bo.filetype) end, fuzzy = { sorts = { diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua index 56acd25..e6a6895 100644 --- a/nvim/lua/plugins/mini.lua +++ b/nvim/lua/plugins/mini.lua @@ -51,7 +51,7 @@ return { content = { active = function() local mode, mode_hl = MiniStatusline.section_mode {} - local filename = MiniStatusline.section_filename { trunc_width = 140 } + -- local filename = MiniStatusline.section_filename { trunc_width = 140 } local diagnostics = MiniStatusline.section_diagnostics { trunc_width = 75 } local lsp = MiniStatusline.section_lsp { trunc_width = 75 } local search = MiniStatusline.section_searchcount { trunc_width = 75 } @@ -60,7 +60,7 @@ return { '%<', -- Mark general truncate point -- { hl = 'MiniStatuslineFilename', strings = { filename } }, '%=', -- End left alignment - { hl = 'MiniStatuslineDevinfo', strings = { rec, diagnostics, lsp } }, + { hl = 'MiniStatuslineDevinfo', strings = { diagnostics, lsp } }, { hl = 'MiniStatuslineDevinfo', strings = { search } }, { hl = mode_hl, strings = { mode } }, } @@ -93,7 +93,7 @@ return { }, } require('mini.align').setup() - require('mini.bracketed').setup() + require('mini.bracketed').setup { file = { suffix = 'm' } } require('mini.icons').setup() require('mini.git').setup() require('mini.surround').setup() @@ -159,23 +159,28 @@ return { miniclue.gen_clues.z(), }, } - - local map = require('mini.map') - map.setup { - symbols = { - scroll_line = '┃', - scroll_view = '', + local files = require('mini.files') + files.setup { + mappings = { + go_in_plus = '', }, - integrations = { - map.gen_integration.builtin_search(), - map.gen_integration.diagnostic(), - map.gen_integration.diff(), - }, - window = { - show_integration_count = false, + windows = { + preview = true, + width_focus = 30, + width_preview = 50, }, } - vim.keymap.set('n', 'nm', map.toggle, { noremap = true, desc = 'minimap open' }) + vim.keymap.set('n', 'nc', files.open, { noremap = true, desc = 'minifiles open' }) + vim.api.nvim_create_autocmd('User', { + pattern = 'MiniFilesBufferCreate', + callback = function(args) + vim.keymap.set('n', '`', function() + local cur_entry_path = MiniFiles.get_fs_entry().path + local cur_directory = vim.fs.dirname(cur_entry_path) + vim.fn.chdir(cur_directory) + end, { buffer = args.data.buf_id }) + end, + }) local multi = require('mini.keymap').map_multistep multi({ 'i' }, '', { 'minipairs_bs' }) diff --git a/nvim/lua/plugins/misc.lua b/nvim/lua/plugins/misc.lua index 0e52e74..9849c9e 100644 --- a/nvim/lua/plugins/misc.lua +++ b/nvim/lua/plugins/misc.lua @@ -1,29 +1,4 @@ return { - { - 'stevearc/oil.nvim', - opts = { - watch_for_changes = true, - columns = { - 'permissions', - 'size', - }, - view_options = { - show_hidden = true, - }, - keymaps = { - ['wq'] = 'actions.close', - }, - }, - keys = { - { - 'nc', - function() - require('oil').toggle_float() - end, - { noremap = true, silent = true, desc = 'oil' }, - }, - }, - }, { 'jinh0/eyeliner.nvim', event = 'VeryLazy',