Alacritty+tmux: Map <C-i> to <leader>i
dblume

dblume commited on 2024-04-27 22:19:39
Showing 2 changed files, with 9 additions and 1 deletions.


When only in Alacritty, nvim receives <C-i> as a different command than <Tab>.
But in tmux, then they're the same. So have Alacritty map <C-i> to <leader>i
so that nvim still has a chance to map <C-i> differently then <Tab>.

All this so <C-o>/<C-i> are a pair and so are <Tab>/<S-Tab>.
... ...
@@ -1,2 +1,8 @@
1 1
 [font.normal]
2 2
 family = "DejaVu Sans Mono for Powerline"
3
+
4
+[keyboard]
5
+bindings = [
6
+# For vim <leader>i as a proxy for when in tmux where <C-i> is Tab
7
+{ key = "I", mods = "Control",        chars = "\\i" }
8
+]
... ...
@@ -39,12 +39,14 @@ nnoremap <C-l> <C-w>l
39 39
 " clear search highlights
40 40
 nnoremap <cr> :noh<cr><cr>
41 41
 
42
+" tmux in Alacritty doesn't send C-i, so I have Alacritty map C-i to <leader>i
43
+nnoremap <leader>i <C-i>
42 44
 " Use (Shift-)Tab to switch buffers if Tab different than C-i (usually not in tmux).
43 45
 " Test with this:
44 46
 " nvim -Nu NONE +'nno <C-i> :echom "C-i pressed"<cr>' +'nno <tab> :echom "Tab pressed"<cr>'
45 47
 if stridx(expand($TERM), 'xterm') == 0
46 48
   nnoremap <C-i> <C-i>
47
-  nnoremap <Tab> :bn<cr>
49
+  nmap <Tab> :bn<cr>
48 50
 endif
49 51
 nnoremap <S-Tab> :bp<cr>
50 52
 
51 53