mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
Feat: Allow user to switch back to the main neovim window
This commit is contained in:
parent
b2bb0d6f2b
commit
0690c995f6
@ -73,6 +73,15 @@ a new terminal is created.
|
|||||||
lua require("harpoon.term").gotoTerminal(1) -- navigates to term 1
|
lua require("harpoon.term").gotoTerminal(1) -- navigates to term 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Once you switch to a terminal you can always switch back to neovim, this is a
|
||||||
|
little bash script that will switch to the window which is running neovim.
|
||||||
|
|
||||||
|
In your `tmux.conf` (or anywhere you have keybinds), add this
|
||||||
|
```bash
|
||||||
|
bind-key -r G run-shell "path-to-harpoon/harpoon/scripts/tmux/switch-back-to-nvim"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Commands to Terminals
|
### Commands to Terminals
|
||||||
commands can be sent to any terminal
|
commands can be sent to any terminal
|
||||||
```lua
|
```lua
|
||||||
|
14
scripts/tmux/switch-back-to-nvim
Executable file
14
scripts/tmux/switch-back-to-nvim
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Make sure tmux is running
|
||||||
|
tmux_running=$(pgrep tmux)
|
||||||
|
|
||||||
|
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
||||||
|
echo "tmux needs to be running"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Switch to a window called nvim in tmux - if it exists
|
||||||
|
session_name=$(tmux display-message -p "#S")
|
||||||
|
|
||||||
|
tmux switch-client -t "$session_name:nvim"
|
Loading…
x
Reference in New Issue
Block a user