aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name/nv/nvim/plgs/lf-nvim
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-09 12:35:44 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-09 12:54:51 +0100
commit2122a01f99c6da466b8f0f55c965c11a9043d117 (patch)
tree6c1697afc30a5bb72635bda7db9b5610386a5b71 /modules/by-name/nv/nvim/plgs/lf-nvim
parentfix(pkgs/stamp): Fallback to `dot-license` (diff)
downloadnixos-config-2122a01f99c6da466b8f0f55c965c11a9043d117.zip
refactor(modules/legacy/conf/nvim): Move to `by-name`
Diffstat (limited to 'modules/by-name/nv/nvim/plgs/lf-nvim')
-rw-r--r--modules/by-name/nv/nvim/plgs/lf-nvim/default.nix21
-rw-r--r--modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua43
2 files changed, 64 insertions, 0 deletions
diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix
new file mode 100644
index 00000000..5e2836b0
--- /dev/null
+++ b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix
@@ -0,0 +1,21 @@
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}: let
+ cfg = config.soispha.programs.nvim;
+in {
+ home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable {
+ # TODO: package lf-nvim though a module
+ # FIXME: change the nvim path, when I change the path with lf
+ extraConfigLuaPost = ''
+ ${lib.strings.fileContents ./lua/lf-nvim.lua}
+ '';
+ extraPlugins = [
+ pkgs.vimExtraPlugins.lf-nvim
+
+ pkgs.vimPlugins.toggleterm-nvim # required by lf-nvim
+ ];
+ };
+}
diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua b/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua
new file mode 100644
index 00000000..1eadf375
--- /dev/null
+++ b/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua
@@ -0,0 +1,43 @@
+local fn = vim.fn
+
+-- Defaults
+require("lf").setup({
+ default_action = "drop", -- default action when `Lf` opens a file
+ -- TODO: what do these mappings do?
+ default_actions = { -- default action keybindings
+ ["<C-t>"] = "tabedit",
+ ["<C-x>"] = "split",
+ ["<C-v>"] = "vsplit",
+ ["<C-o>"] = "tab drop",
+ },
+
+ winblend = 10, -- psuedotransparency level
+ dir = "", -- directory where `lf` starts ('gwd' is git-working-directory, ""/nil is CWD)
+ direction = "float", -- window type: float horizontal vertical
+ border = "rounded", -- border kind: single double shadow curved
+ height = fn.float2nr(fn.round(0.75 * vim.o.lines)), -- height of the *floating* window
+ width = fn.float2nr(fn.round(0.75 * vim.o.columns)), -- width of the *floating* window
+ escape_quit = true, -- map escape to the quit command (so it doesn't go into a meta normal mode)
+ focus_on_open = true, -- focus the current file when opening Lf (experimental)
+ mappings = true, -- whether terminal buffer mapping is enabled
+ tmux = false, -- tmux statusline can be disabled on opening of Lf
+ default_file_manager = true, -- make lf default file manager
+ disable_netrw_warning = true, -- don't display a message when opening a directory with `default_file_manager` as true
+ highlights = { -- highlights passed to toggleterm
+ Normal = { link = "Normal" },
+ NormalFloat = { link = "Normal" },
+ FloatBorder = { guifg = "#cdcbe0", guibg = "#191726" },
+ },
+
+ -- Layout configurations
+ layout_mapping = "<M-u>", -- resize window with this key
+ views = { -- window dimensions to rotate through
+ { width = 0.800, height = 0.800 },
+ { width = 0.600, height = 0.600 },
+ { width = 0.950, height = 0.950 },
+ { width = 0.500, height = 0.500, col = 0, row = 0 },
+ { width = 0.500, height = 0.500, col = 0, row = 0.5 },
+ { width = 0.500, height = 0.500, col = 0.5, row = 0 },
+ { width = 0.500, height = 0.500, col = 0.5, row = 0.5 },
+ },
+})