From c2723363ec67eec8c2b6d45273392c8d677d6390 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 10 Jul 2024 21:40:36 +0100 Subject: [PATCH 1/5] home: vim: migrate to 'oil.nvim' --- modules/home/vim/after/ftplugin/netrw.vim | 6 ------ modules/home/vim/after/plugin/mappings/oil.lua | 8 ++++++++ modules/home/vim/default.nix | 2 +- modules/home/vim/plugin/settings/oil.lua | 3 +++ 4 files changed, 12 insertions(+), 7 deletions(-) delete mode 100644 modules/home/vim/after/ftplugin/netrw.vim create mode 100644 modules/home/vim/after/plugin/mappings/oil.lua create mode 100644 modules/home/vim/plugin/settings/oil.lua diff --git a/modules/home/vim/after/ftplugin/netrw.vim b/modules/home/vim/after/ftplugin/netrw.vim deleted file mode 100644 index e3689f8..0000000 --- a/modules/home/vim/after/ftplugin/netrw.vim +++ /dev/null @@ -1,6 +0,0 @@ -" Create the `b:undo_ftplugin` variable if it doesn't exist -call ftplugined#check_undo_ft() - -" Don't show Netrw in buffer list -setlocal bufhidden=delete -let b:undo_ftplugin='|setlocal bufhidden<' diff --git a/modules/home/vim/after/plugin/mappings/oil.lua b/modules/home/vim/after/plugin/mappings/oil.lua new file mode 100644 index 0000000..f627c34 --- /dev/null +++ b/modules/home/vim/after/plugin/mappings/oil.lua @@ -0,0 +1,8 @@ +local wk = require("which-key") +local oil = require("oil") + +local keys = { + ["-"] = { oil.open, "Open parent directory" }, +} + +wk.register(keys) diff --git a/modules/home/vim/default.nix b/modules/home/vim/default.nix index d7280fb..e2c3504 100644 --- a/modules/home/vim/default.nix +++ b/modules/home/vim/default.nix @@ -46,7 +46,6 @@ in vim-repeat # Enanche '.' for plugins vim-rsi # Readline mappings vim-unimpaired # Some ex command mappings - vim-vinegar # Better netrw # Languages rust-vim @@ -85,6 +84,7 @@ in dressing-nvim # Integrate native UI hooks with Telescope etc... gitsigns-nvim # Fast git UI integration nvim-surround # Deal with pairs, now in Lua + oil-nvim # Better alternative to NetrW telescope-fzf-native-nvim # Use 'fzf' fuzzy matching algorithm telescope-lsp-handlers-nvim # Use 'telescope' for various LSP actions telescope-nvim # Fuzzy finder interface diff --git a/modules/home/vim/plugin/settings/oil.lua b/modules/home/vim/plugin/settings/oil.lua new file mode 100644 index 0000000..0dca2f6 --- /dev/null +++ b/modules/home/vim/plugin/settings/oil.lua @@ -0,0 +1,3 @@ +local oil = require("oil") + +oil.setup() From 241071df3058a04ab807605b475d0d38debad197 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 10 Jul 2024 22:16:51 +0100 Subject: [PATCH 2/5] home: vim: oil: add detail view toggle mapping --- modules/home/vim/plugin/settings/oil.lua | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/home/vim/plugin/settings/oil.lua b/modules/home/vim/plugin/settings/oil.lua index 0dca2f6..2fee1a5 100644 --- a/modules/home/vim/plugin/settings/oil.lua +++ b/modules/home/vim/plugin/settings/oil.lua @@ -1,3 +1,26 @@ local oil = require("oil") +local detail = false -oil.setup() +oil.setup({ + view_options = { + -- Show files and directories that start with "." by default + show_hidden = true, + -- But never '..' + is_always_hidden = function(name, bufnr) + return name == ".." + end, + }, + keymaps = { + ["gd"] = { + desc = "Toggle file detail view", + callback = function() + detail = not detail + if detail then + oil.set_columns({ "icon", "permissions", "size", "mtime" }) + else + oil.set_columns({ "icon" }) + end + end, + }, + }, +}) From ace6212f49f7716f9f7b4b98727917909a01b4d4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 10 Jul 2024 22:45:48 +0100 Subject: [PATCH 3/5] home: vim: remove redundant 'nobackup' It's already the default. --- modules/home/vim/init.vim | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/home/vim/init.vim b/modules/home/vim/init.vim index 3a74c4f..eba0c25 100644 --- a/modules/home/vim/init.vim +++ b/modules/home/vim/init.vim @@ -38,8 +38,6 @@ set tabstop=8 " File parameters {{{ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Disable backups, we have source control for that -set nobackup " Disable swapfiles too set noswapfile " }}} From e8652cbc1614dc93ed98c76728db8275c75bfdce Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 10 Jul 2024 22:47:14 +0100 Subject: [PATCH 4/5] home: vim: enable swap and undo files Trying it on for size, since NeoVim does use XDG directories for those. --- modules/home/vim/init.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/home/vim/init.vim b/modules/home/vim/init.vim index eba0c25..a5a06f4 100644 --- a/modules/home/vim/init.vim +++ b/modules/home/vim/init.vim @@ -38,8 +38,10 @@ set tabstop=8 " File parameters {{{ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Disable swapfiles too -set noswapfile +" Enable swap files +set swapfile +" And undo files +set undofile " }}} " UI and UX parameters {{{ From 6b00d6a499154c68ec9018dfd44a0063bbccb8bd Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 11 Jul 2024 13:16:52 +0000 Subject: [PATCH 5/5] nixos: hardware: sound: remove ALSA Not needed for Pulseaudio. --- modules/nixos/hardware/sound/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/nixos/hardware/sound/default.nix b/modules/nixos/hardware/sound/default.nix index e8ba7f7..1cf12cb 100644 --- a/modules/nixos/hardware/sound/default.nix +++ b/modules/nixos/hardware/sound/default.nix @@ -54,9 +54,6 @@ in # Pulseaudio setup (lib.mkIf cfg.pulse.enable { - # ALSA - sound.enable = true; - hardware.pulseaudio.enable = true; }) ]);