From c484f7b57a071f26a4efa304e640276f3928111e Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 7 Jun 2024 22:59:21 -0400 Subject: [PATCH] Nixify my Neovim --- flake.nix | 5 ++ .../home-manager/common/neovim/default.nix | 10 ++++ .../common/neovim/vim-options.nix | 46 +++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 modules/home-manager/common/neovim/default.nix create mode 100644 modules/home-manager/common/neovim/vim-options.nix diff --git a/flake.nix b/flake.nix index 9776b92..ef18f21 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,11 @@ nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + nixvim = { + url = "github:nix-community/nixvim/nixos-24.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixpkgs-terraform = { url = "github:stackbuilders/nixpkgs-terraform"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/home-manager/common/neovim/default.nix b/modules/home-manager/common/neovim/default.nix new file mode 100644 index 0000000..713efc5 --- /dev/null +++ b/modules/home-manager/common/neovim/default.nix @@ -0,0 +1,10 @@ +{inputs, ...}: { + imports = [ + inputs.nixvim.homeManagerModules.nixvim + ]; + programs.nixvim = { + enable = true; + defaultEditor = true; + luaLoader.enable = true; + }; +} diff --git a/modules/home-manager/common/neovim/vim-options.nix b/modules/home-manager/common/neovim/vim-options.nix new file mode 100644 index 0000000..80e5d46 --- /dev/null +++ b/modules/home-manager/common/neovim/vim-options.nix @@ -0,0 +1,46 @@ +{ ... }: { + programs.nixvim = { + globals = { + mapleader = " "; + maplocalleader = " "; + }; + + opts = { + # make sure vim know I always have a dark terminal + background = "dark"; + + # use spaces for tabs and whatnot + expandtab = true; + tabstop = 2; + softtabstop = 2; + shiftwidth = 2; + shiftround = true; + + # make sure all the mouse stuff is on. + # pressing alt to hightlight + copy/paste works like it does outside of nvim + mouse = "a"; + + termguicolors = true; + + # Tips from https://github.com/folke/edgy.nvim + # views can only be fully collapsed with the global statusline + laststatus = 3; + + # Default splitting will cause your main splits to jump when opening an edgebar. + # To prevent this, set `splitkeep` to either `screen` or `topline`. + splitkeep = "screen"; + }; + + # TODO + #vim.keymap.set("n", "h", ":nohlsearch") + + #vim.wo.relativenumber = true + }; +} + + + + + + +