diff --git a/config/default.nix b/config/default.nix index 7d1c52e..53b29ef 100644 --- a/config/default.nix +++ b/config/default.nix @@ -64,5 +64,6 @@ ./utils/nvim-autopairs.nix ./utils/nvim-colorizer.nix ./utils/nvim-surround.nix + ./utils/oil.nix ]; } diff --git a/config/utils/oil.nix b/config/utils/oil.nix new file mode 100644 index 0000000..0310b7d --- /dev/null +++ b/config/utils/oil.nix @@ -0,0 +1,52 @@ +{ + plugins.oil = { + enable = true; + useDefaultKeymaps = true; + deleteToTrash = true; + viewOptions = { + showHidden = true; + }; + float = { + padding = 2; + maxWidth = 0; # ''math.ceil(vim.o.lines * 0.8 - 4)''; + maxHeight = 0; # ''math.ceil(vim.o.columns * 0.8)''; + border = "rounded"; # 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open + winOptions = { + winblend = 0; + }; + }; + preview = { + border = "rounded"; + }; + keymaps = { + "g?" = "actions.show_help"; + "" = "actions.select"; + "" = "actions.select_vsplit"; + "" = "actions.select_split"; # this is used to navigate left + "" = "actions.select_tab"; + "" = "actions.preview"; + "" = "actions.close"; + "" = "actions.refresh"; + "-" = "actions.parent"; + "_" = "actions.open_cwd"; + "`" = "actions.cd"; + "~" = "actions.tcd"; + "gs" = "actions.change_sort"; + "gx" = "actions.open_external"; + "g." = "actions.toggle_hidden"; + "q" = "actions.close"; + }; + }; + keymaps = [ + { + mode = "n"; + key = "o"; + action = ":Oil --float"; + options = { + desc = "Open parent directory"; + silent = true; + }; + } + ]; +} +