diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-06-21 14:53:51 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-06-21 14:53:51 +0200 |
| commit | 87555f0bf9a7c5e489df76131c0d64b8f0bfb021 (patch) | |
| tree | 864f21add3d0b74d20882e337a5287fbfc08c1f7 /.config/zsh/.zshrc | |
| parent | 62a5053434de087912dcbd769b311fe95d2e870b (diff) | |
| download | dotfiles-87555f0bf9a7c5e489df76131c0d64b8f0bfb021.tar.gz dotfiles-87555f0bf9a7c5e489df76131c0d64b8f0bfb021.zip | |
Add conditional check to if tmux is running to update the status
Diffstat (limited to '.config/zsh/.zshrc')
| -rw-r--r-- | .config/zsh/.zshrc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 46942ee..dc35194 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -164,14 +164,18 @@ function update-mode-file() { echo "$new_mode" >| ~/.vi-mode fi - tmux refresh-client -S + if command -v tmux &>/dev/null && [[ -n "$TMUX" ]]; then + tmux refresh-client -S + fi } function check-nvim-running() { if pgrep -x "nvim" > /dev/null; then VI_MODE="" update-mode-file - tmux refresh-client -S + if command -v tmux &>/dev/null && [[ -n "$TMUX" ]]; then + tmux refresh-client -S + fi else if [[ ${KEYMAP} == vicmd || ${KEYMAP} == vi-cmd-mode ]]; then VI_MODE=$(normal-mode) @@ -179,7 +183,9 @@ function check-nvim-running() { VI_MODE=$(insert-mode) fi update-mode-file - tmux refresh-client -S + if command -v tmux &>/dev/null && [[ -n "$TMUX" ]]; then + tmux refresh-client -S + fi fi } @@ -230,7 +236,9 @@ function nvim-listener() { nvim_pid="$current_nvim_pid" VI_MODE="" # Clear VI_MODE to show Neovim mode update-mode-file - tmux refresh-client -S + if command -v tmux &>/dev/null && [[ -n "$TMUX" ]]; then + tmux refresh-client -S + fi elif [[ -z "$current_nvim_pid" && "$prev_nvim_status" == "active" ]]; then # Neovim stopped prev_nvim_status="inactive" @@ -241,10 +249,12 @@ function nvim-listener() { VI_MODE=$(insert-mode) fi update-mode-file - tmux refresh-client -S + if command -v tmux &>/dev/null && [[ -n "$TMUX" ]]; then + tmux refresh-client -S + fi fi # Add a delay - #sleep 0.5 + # sleep 0.5 done } |
