From a4d0b06bfabd70b34533e2b1741ec1780186967f Mon Sep 17 00:00:00 2001 From: zoe Date: Mon, 24 Oct 2022 21:14:09 +0200 Subject: [PATCH] usable vim config --- configuration.nix | 5 ++--- home.nix | 14 ++++++++++++++ nvim/settings.lua | 12 ++++++++++-- nvim/settings.nix | 26 ++++++++++++++++++++++++++ packages.nix | 2 ++ sync.sh | 12 +++++++++++- 6 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 home.nix create mode 100644 nvim/settings.nix diff --git a/configuration.nix b/configuration.nix index 7850f5d..c02e7a1 100644 --- a/configuration.nix +++ b/configuration.nix @@ -7,10 +7,10 @@ { imports = [ - # Include the results of the hardware scan. + ./hardware-configuration.nix ./packages.nix - + ./home.nix ]; # Bootloader. @@ -98,7 +98,6 @@ ]; }; - home-manager.users.zoe = { pkgs, ... }: { }; # Allow unfree packages nixpkgs.config.allowUnfree = true; diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..d99bb6d --- /dev/null +++ b/home.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: +let + nvimCustom = import nvim/settings.nix; +in +{ + home-manager.users.zoe = { pkgs, ... }: { + programs.neovim = nvimCustom pkgs; + programs.git = { + enable = true; + userName = "zoe"; + userEmail = "ZoeOosting@outlook.com"; + }; + }; +} diff --git a/nvim/settings.lua b/nvim/settings.lua index 580146e..df6d1e7 100644 --- a/nvim/settings.lua +++ b/nvim/settings.lua @@ -4,7 +4,15 @@ local g = vim.g -- allow mouse opt.mouse = "a" --- colors +-- look opt.termguicolors = true -opt.cursorline = true +opt.cursorline = false -- dont highlight current line opt.number = true + +-- highlight yanked text for 200ms using the "Visual" highlight group +vim.cmd[[ +augroup highlight_yank +autocmd! +au TextYankPost * silent! lua vim.highlight.on_yank({higroup="Visual", timeout=200}) +augroup END +]] diff --git a/nvim/settings.nix b/nvim/settings.nix new file mode 100644 index 0000000..aaa32a4 --- /dev/null +++ b/nvim/settings.nix @@ -0,0 +1,26 @@ +pkgs: + +{ + enable = true; + vimAlias = true; + + extraConfig = '' + luafile /etc/nixos/nvim/settings.lua + ''; + + plugins = with pkgs.vimPlugins; [ + # coc + coc-nvim + coc-rust-analyzer + coc-lua + + # make brackets nicer + nvim-autopairs + + # colorize hex codes + nvim-colorizer-lua + + # colorize brackets + rainbow + ]; +} diff --git a/packages.nix b/packages.nix index 97c6e4e..abbe2f9 100644 --- a/packages.nix +++ b/packages.nix @@ -12,5 +12,7 @@ wireguard-tools networkmanagerapplet vscodium + neofetch + nodejs ]; } diff --git a/sync.sh b/sync.sh index 5dfc5b1..c4438d7 100755 --- a/sync.sh +++ b/sync.sh @@ -1,7 +1,17 @@ #!/bin/sh +# update in case i was fucking around somewhere else git pull + +# format everything to look nice nixpkgs-fmt *.nix +nixpkgs-fmt ./nvim/*.nix + +# make a backup just in case cp -r /etc/nixos/ ./backup -sudo cp -r ./configuration.nix ./nvim/ ./packages.nix /etc/nixos/ + +# copy over all the files to /etc/nixos/ +sudo cp -r ./configuration.nix ./nvim/ ./packages.nix ./home.nix /etc/nixos/ + +# update and build my new config sudo nixos-rebuild switch --upgrade