From 0b63872d6294dd405ff3469c837129bfcb9af717 Mon Sep 17 00:00:00 2001
From: Tobias Reisinger <tobias@msrg.cc>
Date: Tue, 11 Apr 2023 13:08:44 +0200
Subject: [PATCH] Improve neovim-specific configs

---
 .bin/.e                                 |  2 +-
 .config/home-manager/common.nix         |  1 +
 .config/home-manager/nvim.nix           | 10 ++++++++++
 .config/home-manager/portalo-tobias.nix |  1 +
 .config/nvim/lua/plugins.lua            |  1 +
 .config/nvim/lua/set.lua                | 11 +++++++++++
 .config/sxhkd/sxhkdrc                   |  4 ++++
 7 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 .config/home-manager/nvim.nix

diff --git a/.bin/.e b/.bin/.e
index e6ed040..3f31313 100755
--- a/.bin/.e
+++ b/.bin/.e
@@ -14,7 +14,7 @@ declare -A mapper=(
 	["git-ignore"]="$HOME/.config/git/ignore"
 	["home-manager"]="$HOME/.config/home-manager/home.nix"
 	["nvim"]="$HOME/.config/nvim/"
-	["nvim.packer"]="$HOME/.config/nvim/lua/user/packer.lua"
+	["nvim.packer"]="$HOME/.config/nvim/lua/plugins.lua"
 	["polybar"]="$HOME/.config/polybar"
 	["qutebrowser"]="$HOME/.config/qutebrowser/common.py"
 	["starship"]="$HOME/.config/starship.toml"
diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix
index 84c8ba4..449e2a5 100644
--- a/.config/home-manager/common.nix
+++ b/.config/home-manager/common.nix
@@ -7,6 +7,7 @@
     dasel # tool to manage yq, jq, toml and more
     direnv # tool to load custom environments
     docker-credential-helpers
+    doggo # dns client
     exa # ls-alternative
     faas-cli # cli for openfaas
     fzf # fuzzy finder
diff --git a/.config/home-manager/nvim.nix b/.config/home-manager/nvim.nix
new file mode 100644
index 0000000..bc530ac
--- /dev/null
+++ b/.config/home-manager/nvim.nix
@@ -0,0 +1,10 @@
+{ config, pkgs, ... }:
+
+{
+  # Packages that should be installed to the user profile.
+  home.packages = with pkgs; [
+	nodejs # needed for lsp
+    fzf # fuzzy finder
+    neovim # alternative to vim
+  ];
+}
diff --git a/.config/home-manager/portalo-tobias.nix b/.config/home-manager/portalo-tobias.nix
index f159afd..022026b 100644
--- a/.config/home-manager/portalo-tobias.nix
+++ b/.config/home-manager/portalo-tobias.nix
@@ -7,6 +7,7 @@
   imports = [
     ./common.nix
     ./graphical.nix
+    ./nvim.nix
   ];
 
   home.packages = with pkgs; [
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index ad68d89..df68fd2 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -18,6 +18,7 @@ return require('packer').startup(function(use)
 		run = ':TSUpdate'
 	})
 
+	use("github/copilot.vim")
 	use("mbbill/undotree")
 	use("Wansmer/sibling-swap.nvim")
 
diff --git a/.config/nvim/lua/set.lua b/.config/nvim/lua/set.lua
index a63a6f2..5884ae0 100644
--- a/.config/nvim/lua/set.lua
+++ b/.config/nvim/lua/set.lua
@@ -22,6 +22,7 @@ vim.opt.undofile = true
 
 vim.opt.hlsearch = true
 vim.opt.incsearch = true
+vim.opt.wildmode = "longest,list,full"
 
 vim.opt.termguicolors = true
 
@@ -32,3 +33,13 @@ vim.opt.isfname:append("@-@")
 vim.opt.updatetime = 50
 
 vim.opt.colorcolumn = "80"
+
+
+vim.api.nvim_create_autocmd('TextYankPost', {
+  group = vim.api.nvim_create_augroup('highlight_yank', {}),
+  desc = 'Hightlight selection on yank',
+  pattern = '*',
+  callback = function()
+    vim.highlight.on_yank { higroup = 'IncSearch', timeout = 250 }
+  end,
+})
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index 960abe0..df9cda0 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -110,6 +110,10 @@ super + {_,shift + }{h,j,k,l}
 super + Tab
     bspc desktop -f last
 
+# focus the next/previous node in the current desktop
+super + {_,shift + }c
+    bspc node -f {next,prev}.local
+
 # focus or send to the given desktop
 super + {_,shift + }{1-9,0}
     bspc {desktop -f,node -d} '^{1-9,10}'