From 09fa0fc2d070651f6de1060827b2d1c3759366ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Tue, 21 Nov 2023 02:53:19 +0100 Subject: [PATCH] neovim improvements --- desktops/hyprland/hyprland.nix | 2 ++ home.nix | 2 +- packages.nix | 1 + programs/nixvim.nix | 44 +++++++++++++++++++++++++++------- programs/zsh.nix | 19 --------------- services.nix | 4 ++++ 6 files changed, 44 insertions(+), 28 deletions(-) delete mode 100644 programs/zsh.nix diff --git a/desktops/hyprland/hyprland.nix b/desktops/hyprland/hyprland.nix index adaca0a..a95f409 100644 --- a/desktops/hyprland/hyprland.nix +++ b/desktops/hyprland/hyprland.nix @@ -24,6 +24,8 @@ "ags" "swww init" "swww img ~/Pictures/Wallpapers/wallpaper.jpg" + "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XAUTHORITY" + "dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY XAUTHORITY" "gnome-keyring-daemon --start --components=secrets" "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" ]; diff --git a/home.nix b/home.nix index 290ecde..a0fb332 100644 --- a/home.nix +++ b/home.nix @@ -27,7 +27,7 @@ in { }; programs = import ./programs.nix { inherit pkgs; }; - services = import ./services.nix; + services = import ./services.nix { inherit pkgs; }; home.file.".p10k.zsh".source = ./programs/.p10k.zsh; } diff --git a/packages.nix b/packages.nix index 4c0f33e..cfd3a43 100644 --- a/packages.nix +++ b/packages.nix @@ -56,4 +56,5 @@ # utils neofetch + pinentry-gnome ] diff --git a/programs/nixvim.nix b/programs/nixvim.nix index f310686..f0436ef 100644 --- a/programs/nixvim.nix +++ b/programs/nixvim.nix @@ -21,7 +21,7 @@ }; keymaps = [ - { key = ""; mode = "n"; action = ":UndotreeToggle"; } + { key = "u"; mode = "n"; action = ":UndotreeToggle"; } ]; globals = { @@ -29,7 +29,7 @@ minimap_auto_start = 1; minimap_auto_start_win_enter = 1; - mapleader = ""; + mapleader = ";"; }; clipboard = { @@ -37,9 +37,33 @@ providers.wl-copy.enable = true; }; - extraConfigVim = '' + extraConfigVim = /* vim */ '' hi Normal guibg=NONE ctermbg=NONE ''; + + extraConfigLua = /* lua */ '' + local Terminal = require('toggleterm.terminal').Terminal + local lazygit = Terminal:new({ + cmd = "lazygit", + dir = "git_dir", + direction = "float", + on_open = function(term) + vim.cmd("startinsert!") + vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", {noremap = true, silent = true}) + end, + on_close = function(term) + vim.cmd("startinsert!") + end, + }) + + + function _lazygit_toggle() + lazygit:toggle() + end + + vim.api.nvim_set_keymap("n", "g", "lua _lazygit_toggle()", {noremap = true, silent = true}) + ''; + colorschemes.gruvbox = { enable = true; trueColor = true; @@ -52,7 +76,6 @@ plugins = { lualine.enable = true; - gitblame.enable = true; fidget.enable = true; indent-blankline = { enable = true; @@ -62,8 +85,13 @@ nvim-autopairs.enable = true; illuminate.enable = true; nvim-colorizer.enable = true; - nvim-tree.enable = true; undotree.enable = true; + toggleterm = { + enable = true; + openMapping = ""; + direction = "horizontal"; + }; + telescope = { enable = true; keymaps = { @@ -109,9 +137,9 @@ nvim-cmp = { enable = true; mapping = { - "" = "cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select})"; - "" = "cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select})"; - "" = "cmp.mapping.confirm({select = true})"; + "" = /* lua */ "cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select})"; + "" = /* lua */ "cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select})"; + "" = /* lua */ "cmp.mapping.confirm({select = true})"; }; sources = [ { name = "buffer"; } diff --git a/programs/zsh.nix b/programs/zsh.nix deleted file mode 100644 index 88b42e2..0000000 --- a/programs/zsh.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs }: -{ - enable = true; - zplug = { - enable = true; - plugins = [ - { name = "plugins/git"; tags = [ from:oh-my-zsh ]; } - { name = "plugins/docker"; tags = [ from:oh-my-zsh ]; } - { name = "plugins/zsh-interactive-cd"; tags = [ from:oh-my-zsh ]; } - { name = "zsh-users/zsh-autosuggestions"; } - { name = "kaplanelad/shellfirm"; } - { name = "zsh-users/zsh-syntax-highlighting"; } - { name = "romkatv/powerlevel10k"; tags = [ as:theme depth:1 ]; } - ]; - }; - initExtra = '' - [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - ''; -} diff --git a/services.nix b/services.nix index daed15c..24b18eb 100644 --- a/services.nix +++ b/services.nix @@ -1,7 +1,11 @@ +{ pkgs }: { gpg-agent = { enable = true; enableSshSupport = true; pinentryFlavor = "gnome3"; }; + # fix pinentry on non-gnome with this in + # the system config: services.dbus.packages = with pkgs; [ gcr ]; + gnome-keyring.enable = true; }