From 25fdfe6fd7dde9b064201d3379be3112b0a65ee1 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 2 Oct 2026 18:00:45 +0200 Subject: tweak(workstation): make nvim open mini.pick when passed dir --- user/nvim/init.lua | 30 ++++++++++++++++++++++++++++++ user/sway/config | 2 -- 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'user') diff --git a/user/nvim/init.lua b/user/nvim/init.lua index a69e742..b8e073c 100644 --- a/user/nvim/init.lua +++ b/user/nvim/init.lua @@ -21,6 +21,36 @@ pick.setup({ source = { show = pick.default_show } }) -- Reuse Neovim's popup-menu selection color for mini.pick's selected item. vim.api.nvim_set_hl(0, 'MiniPickMatchCurrent', { link = 'PmenuSel' }) +-- Disable netrw's directory browser; directory arguments are handled below with MiniPick. +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +-- When Neovim is started with a directory, use MiniPick instead of netrw. +vim.api.nvim_create_autocmd('VimEnter', { + callback = function() + local dir = vim.fn.argc() == 1 and vim.fn.argv(0) or nil + if not dir or vim.fn.isdirectory(dir) == 0 then + return + end + + vim.fn.chdir(vim.fn.fnamemodify(dir, ':p')) + + local buf = vim.api.nvim_get_current_buf() + vim.cmd.enew() + vim.api.nvim_buf_delete(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, +}) + -- Shortcut for Hugo TOML frontmatter. vim.api.nvim_create_autocmd('FileType', { pattern = 'markdown', 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