From f408aa30c05dc5b18ee1ff758b96fbb91e2016f3 Mon Sep 17 00:00:00 2001
From: Jens Nolte <jens@nightmarestudio.de>
Date: Tue, 21 Apr 2020 19:11:52 +0200
Subject: [PATCH] Add shortcuts for switching windows in neovim.

The shortcuts are recommended in neovims `:help terminal`.
---
 pkgs/neovim/default.nix | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/pkgs/neovim/default.nix b/pkgs/neovim/default.nix
index f60ba99..2918e9f 100644
--- a/pkgs/neovim/default.nix
+++ b/pkgs/neovim/default.nix
@@ -43,6 +43,20 @@ pkgs.neovim.override {
       " Save with Ctrl-S (if file has changed)
       noremap <c-s> <Cmd>update<CR>
 
+      " Use `ALT+{h,j,k,l}` to navigate windows from any mode
+      :tnoremap <A-h> <C-\><C-N><C-w>h
+      :tnoremap <A-j> <C-\><C-N><C-w>j
+      :tnoremap <A-k> <C-\><C-N><C-w>k
+      :tnoremap <A-l> <C-\><C-N><C-w>l
+      :inoremap <A-h> <C-\><C-N><C-w>h
+      :inoremap <A-j> <C-\><C-N><C-w>j
+      :inoremap <A-k> <C-\><C-N><C-w>k
+      :inoremap <A-l> <C-\><C-N><C-w>l
+      :nnoremap <A-h> <C-w>h
+      :nnoremap <A-j> <C-w>j
+      :nnoremap <A-k> <C-w>k
+      :nnoremap <A-l> <C-w>l
+
       " Always show the sign column (to prevent jumps when loading git- or the language client)
       " Disabled because it also adds a sign column to NERDTree
       "set signcolumn=yes
-- 
GitLab