diff options
| author | Martin Fischer <martin@push-f.com> | 2026-10-02 18:00:45 +0200 |
|---|---|---|
| committer | Martin Fischer <martin@push-f.com> | 2026-10-10 19:54:55 +0200 |
| commit | 0c995487877fa5a586bd74401c2af5fc2e1c3062 (patch) | |
| tree | a32e3fd355e2970a2e03a47010c80c6b364074a0 /user | |
| parent | b657343b58adb1d4a8ab7f648c9683c4b1d67128 (diff) | |
tweak(workstation): make nvim open mini.pick when passed dir
Diffstat (limited to 'user')
| -rw-r--r-- | user/nvim/init.lua | 30 | ||||
| -rw-r--r-- | user/sway/config | 2 |
2 files changed, 30 insertions, 2 deletions
diff --git a/user/nvim/init.lua b/user/nvim/init.lua index 2874c1d..282d086 100644 --- a/user/nvim/init.lua +++ b/user/nvim/init.lua @@ -30,3 +30,33 @@ vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>', { desc = 'Clear search highl vim.keymap.set('n', '<C-p>', function() pick.builtin.files() end, { desc = 'Pick files' }) + +-- 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, +}) 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: # |
