From b09c1b4e257a5b7e5f8a6d338f7e1bacc56e88bb Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 2 Oct 2026 18:00:45 +0200 Subject: tweak(workstation): make nvim use mini.pick for dirs --- user/nvim/init.lua | 29 +++++++++++++++++++++++++++++ user/sway/config | 2 -- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'user') diff --git a/user/nvim/init.lua b/user/nvim/init.lua index 7302e3d..108f84a 100644 --- a/user/nvim/init.lua +++ b/user/nvim/init.lua @@ -34,3 +34,32 @@ vim.keymap.set('n', '', function() local tool = vim.fs.root(vim.fn.getcwd(), '.git') and 'git' or nil pick.builtin.files({ tool = tool }) end, { desc = 'Pick files' }) + +-- Disable netrw's directory browser; directory buffers are handled below with MiniPick. +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +-- When entering a directory (for example at startup or with `gf`), use MiniPick instead of netrw. +vim.api.nvim_create_autocmd('BufEnter', { + callback = function(args) + local dir = vim.api.nvim_buf_get_name(args.buf) + if vim.fn.isdirectory(dir) == 0 then + return + end + + vim.fn.chdir(vim.fn.fnamemodify(dir, ':p')) + + vim.cmd.enew() + vim.api.nvim_buf_delete(args.buf, { force = true }) + + pick.builtin.files(nil, { + source = { + -- Without this filetype detection doesn't run for some reason. + choose = function(path) + vim.schedule(function() + vim.cmd.edit(vim.fn.fnameescape(path)) + end) + end, + }, + }) + end, +}) diff --git a/user/sway/config b/user/sway/config index c0a715c..6f50677 100644 --- a/user/sway/config +++ b/user/sway/config @@ -94,8 +94,6 @@ input "10429:514:Hanvon_Ugee_Shortcut_Remote_Keyboard" { # Exit sway (logs you out of your Wayland session) bindsym $mod+Shift+q exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' - - bindsym $mod+m exec foot zsh -c 'cd ~/repos/notes && ed --min-query-length 1' # # Moving around: # -- cgit v1.3.1