Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
oddnugget committed Apr 27, 2024
1 parent ebaab05 commit e9cf5dc
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,39 +450,34 @@ return {
> The `config.at_edge = 'wrap'` option is not supoprted in Kitty terminal multiplexer due to inability to determine
> pane layout from CLI.
> [!NOTE]
> This won't work if the pane is connected over SSH, as the pane will not properly report the foreground process name.
By default the plugin sets a kitty user-var `IS_NVIM` when it loads. You can take advantage of this together with kittys
[conditional mappings feature](https://sw.kovidgoyal.net/kitty/mapping/#conditional-mappings-depending-on-the-state-of-the-focused-window) to use the same keybind for both kitty and neovim.
Add the following snippet to `~/.config/kitty/kitty.conf`, adjusting the keymaps and resize amount as desired.
```
map ctrl+j kitten pass_keys.py neighboring_window bottom ctrl+j
map ctrl+k kitten pass_keys.py neighboring_window top ctrl+k
map ctrl+h kitten pass_keys.py neighboring_window left ctrl+h
map ctrl+l kitten pass_keys.py neighboring_window right ctrl+l
# the 3 here is the resize amount, adjust as needed
map alt+j kitten pass_keys.py relative_resize down 3 alt+j
map alt+k kitten pass_keys.py relative_resize up 3 alt+k
map alt+h kitten pass_keys.py relative_resize left 3 alt+h
map alt+l kitten pass_keys.py relative_resize right 3 alt+l
```
map ctrl+j neighboring_window down
map ctrl+k neighboring_window up
map ctrl+h neighboring_window left
map ctrl+l neighboring_window right
By default, it matches against the name of the current foreground process to detect if `vim`/`nvim` is running.
If that doesn't work for you, or you want to include other CLI/TUI programs in the exclusion, you can provide
an additional regex argument:
```
map ctrl+j kitten pass_keys.py neighboring_window bottom ctrl+j "^.* - nvim$"
map ctrl+k kitten pass_keys.py neighboring_window top ctrl+k "^.* - nvim$"
map ctrl+h kitten pass_keys.py neighboring_window left ctrl+h "^.* - nvim$"
map ctrl+l kitten pass_keys.py neighboring_window right ctrl+l "^.* - nvim$"
# Unset the mapping to pass the keys to neovim
map --when-focus-on var:IS_NVIM ctrl+j
map --when-focus-on var:IS_NVIM ctrl+k
map --when-focus-on var:IS_NVIM ctrl+h
map --when-focus-on var:IS_NVIM ctrl+l
# the 3 here is the resize amount, adjust as needed
map alt+j kitten pass_keys.py relative_resize down 3 alt+j "^.* - nvim$"
map alt+k kitten pass_keys.py relative_resize up 3 alt+k "^.* - nvim$"
map alt+h kitten pass_keys.py relative_resize left 3 alt+h "^.* - nvim$"
map alt+l kitten pass_keys.py relative_resize right 3 alt+l "^.* - nvim$"
map alt+j kitten relative_resize down 3
map alt+k kitten relative_resize up 3
map alt+h kitten relative_resize left 3
map alt+l kitten relative_resize right 3
map --when-focus-on var:IS_NVIM alt+j
map --when-focus-on var:IS_NVIM alt+k
map --when-focus-on var:IS_NVIM alt+h
map --when-focus-on var:IS_NVIM alt+l
```
Then, you must allow Kitty to listen for remote commands on a socket. You can do this
Expand Down

0 comments on commit e9cf5dc

Please sign in to comment.