From 87673019ab910db15f3d4e9a43fab3d00fadae42 Mon Sep 17 00:00:00 2001 From: cswimr Date: Sun, 2 Feb 2025 06:38:51 -0600 Subject: [PATCH] work on neovim configuration --- flake.nix | 2 +- nixos/nvim/nnn.nix | 54 +++++++++++++++++++++++++++++++++++++++ nixos/{ => nvim}/nvim.nix | 5 ++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 nixos/nvim/nnn.nix rename nixos/{ => nvim}/nvim.nix (85%) diff --git a/flake.nix b/flake.nix index 8803194..571ea33 100644 --- a/flake.nix +++ b/flake.nix @@ -84,7 +84,7 @@ ./nixos/gaming.nix ./nixos/gui-pkgs.nix ./nixos/nvidia.nix - ./nixos/nvim.nix + ./nixos/nvim/nvim.nix ./nixos/ollama.nix ./nixos/pkg.nix ./nixos/shell.nix diff --git a/nixos/nvim/nnn.nix b/nixos/nvim/nnn.nix new file mode 100644 index 0000000..4b04d4e --- /dev/null +++ b/nixos/nvim/nnn.nix @@ -0,0 +1,54 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ tmux ]; + environment.variables = { + NNN_FIFO = "$XDG_RUNTIME_DIR/nnn.fifo"; + NNN_ICONLOOKUP = 1; + }; + + programs.nixvim = { + extraPlugins = [ + (pkgs.vimUtils.buildVimPlugin { + # https://github.com/luukvbaal/nnn.nvim + name = "nnn.nvim"; + src = pkgs.fetchFromGitHub { + owner = "luukvbaal"; + repo = "nnn.nvim"; + rev = "662034c73718885ee599ad9fb193ab1ede70fbcb"; + sha256 = "sha256-8+ax8n1fA4jgJugvWtRXkad4YM7TmAAsAopzalmGu/4="; + }; + }) + ]; + extraConfigLua = '' + local builtin = require("nnn").builtin + require("nnn").setup({ + explorer = { + cmd = "nnn -G -Pp", + }, + picker = { + cmd = "tmux new-session nnn -G -Pp", + style = { border = "rounded" }, + session = "shared", + }, + auto_open = { + setup = "explorer", + tabpage = "explorer", + ft_ignore = { + "gitcommit", + }, + }, + replace_netrw = "picker", + offset = true, + mappings = { + { "", builtin.open_in_tab }, -- open file(s) in tab + { "", builtin.open_in_split }, -- open file(s) in split + { "", builtin.open_in_vsplit }, -- open file(s) in vertical split + { "", builtin.open_in_preview }, -- open file in preview split keeping nnn focused + { "", builtin.copy_to_clipboard }, -- copy file(s) to clipboard + { "", builtin.cd_to_path }, -- cd to file directory + { "", builtin.populate_cmdline }, -- populate cmdline (:) with file(s) + }, + }) + ''; + }; +} diff --git a/nixos/nvim.nix b/nixos/nvim/nvim.nix similarity index 85% rename from nixos/nvim.nix rename to nixos/nvim/nvim.nix index 02e4610..1e9a6fa 100755 --- a/nixos/nvim.nix +++ b/nixos/nvim/nvim.nix @@ -1,5 +1,9 @@ { pkgs, ... }: { + imports = [ + ./nnn.nix + ]; + programs.nixvim = { extraPackages = with pkgs; [ fd ]; enable = true; @@ -14,6 +18,7 @@ cmp.enable = true; cmp-nvim-lsp.enable = true; lsp.enable = true; + bufferline.enable = true; }; }; }