From 9d12f12a985bcfa63790d2ce1c0ef9f0b8622372 Mon Sep 17 00:00:00 2001 From: Felix Tenley Date: Tue, 5 Apr 2022 19:42:51 +0200 Subject: [PATCH] feat(neovim): replace vim-kitty-navigator with nvim-kitty-navigator --- flake.lock | 17 +++++++++++++++++ flake.nix | 9 ++++++++- home/editors/neovim/default.nix | 1 + home/shell/terminal.nix | 29 +++++++++++++++-------------- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index d48d753..c000bd7 100644 --- a/flake.lock +++ b/flake.lock @@ -84,6 +84,22 @@ "type": "github" } }, + "nvim-kitty-navigator": { + "flake": false, + "locked": { + "lastModified": 1648739869, + "narHash": "sha256-dgu9ug0R9dbu5QyuNXJ6E/Gv2ruoYsefPc23iWI6eVc=", + "owner": "hermitmaster", + "repo": "nvim-kitty-navigator", + "rev": "16574acb6e5d8b47f0da535dc391cac541163e87", + "type": "github" + }, + "original": { + "owner": "hermitmaster", + "repo": "nvim-kitty-navigator", + "type": "github" + } + }, "nvim-lspfuzzy": { "flake": false, "locked": { @@ -130,6 +146,7 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nur": "nur", + "nvim-kitty-navigator": "nvim-kitty-navigator", "nvim-lspfuzzy": "nvim-lspfuzzy", "pre-commit-hooks": "pre-commit-hooks" } diff --git a/flake.nix b/flake.nix index deb2840..377af60 100644 --- a/flake.nix +++ b/flake.nix @@ -30,8 +30,13 @@ flake = false; }; + inputs.nvim-kitty-navigator = { + url = "github:hermitmaster/nvim-kitty-navigator"; + flake = false; + }; + outputs = { self, nixpkgs, nixos-hardware, flake-utils, home-manager, nur - , pre-commit-hooks, nvim-lspfuzzy }@inputs: + , pre-commit-hooks, nvim-lspfuzzy, nvim-kitty-navigator }@inputs: let overlays = { neovim = self: super: @@ -46,6 +51,8 @@ in { vimPlugins = super.vimPlugins // { nvim-lspfuzzy = buildVimPlugin "nvim-lspfuzzy" nvim-lspfuzzy; + nvim-kitty-navigator = + buildVimPlugin "nvim-kitty-navigator" nvim-kitty-navigator; }; }; deconz = self: super: { diff --git a/home/editors/neovim/default.nix b/home/editors/neovim/default.nix index 12ae1da..77187f0 100644 --- a/home/editors/neovim/default.nix +++ b/home/editors/neovim/default.nix @@ -34,6 +34,7 @@ in { nvim-autopairs camelcasemotion luasnip + nvim-kitty-navigator nvim-cmp cmp-path diff --git a/home/shell/terminal.nix b/home/shell/terminal.nix index 504623a..aea671f 100644 --- a/home/shell/terminal.nix +++ b/home/shell/terminal.nix @@ -1,29 +1,30 @@ { config, pkgs, lib, ... }: with pkgs; -with lib; -let - yamlToJSON = path: - runCommand "yaml.json" { nativeBuildInputs = [ pkgs.ruby ]; } '' - ruby -rjson -ryaml -e "puts YAML.load(ARGF).to_json" < ${path} > $out - ''; -in { +with lib; { + # kitty programs.kitty = { enable = true; - keybindings = { - "ctrl+j" = "kitten pass_keys.py neighboring_window bottom ctrl+j"; - "ctrl+k" = "kitten pass_keys.py neighboring_window top ctrl+k"; - "ctrl+h" = "kitten pass_keys.py neighboring_window left ctrl+h"; - "ctrl+l" = "kitten pass_keys.py neighboring_window right ctrl+l"; + keybindings = let + vimKittyBinding = bind: + ''kitten pass_keys.py neighboring_window ${bind} "^.* - nvim$"''; + in { + "ctrl+h" = vimKittyBinding "left ctrl+h"; + "ctrl+j" = vimKittyBinding "bottom ctrl+j"; + "ctrl+k" = vimKittyBinding "top ctrl+k"; + "ctrl+l" = vimKittyBinding "right ctrl+l"; }; settings = { + allow_remote_control = "yes"; + # single_instance = "yes"; + listen_on = "unix:@mykitty"; scrollback_pager = '' nvim -u NONE -c "syntax on" -c 'set ft=man nonumber nolist showtabline=0 foldcolumn=0 laststatus=0' -c "autocmd VimEnter * normal G" -c "map q :qa!" -c "set clipboard+=unnamedplus" -''; }; }; xdg.configFile."kitty/pass_keys.py".source = - "${vimPlugins.vim-kitty-navigator}/pass_keys.py"; + "${vimPlugins.nvim-kitty-navigator}/kitty/pass_keys.py"; xdg.configFile."kitty/neighboring_window.py".source = - "${vimPlugins.vim-kitty-navigator}/neighboring_window.py"; + "${vimPlugins.nvim-kitty-navigator}/kitty/neighboring_window.py"; }