ChHaeni / vimtux

Send commands from Vim to Tmux
MIT License
1 stars 0 forks source link

Using zsh with bash completion enabled in .zshrc and sending code with a tab in it triggers the tab-completion in zsh #7

Open emilBeBri opened 11 months ago

emilBeBri commented 11 months ago

Hi so after lots of trial and error I finally discovered that when you use zsh with this tab-completion in your .zsh file:


autoload -Uz compinit
compinit

fpath=(/home/emil/Dropbox/share/zsh/plugins/zsh-completions/zsh-completions.plugin.zsh $fpath)
[ ! -f  /home/emil/Dropbox/share/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh ] || source /home/emil/Dropbox/share/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh
# Note: Please note that you should put the above command after the compinit, but before plugins that will wrap widgets, such as zsh-autosuggestions or fast-syntax-highlighting!

[ ! -f /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ] || source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

ZSH_AUTOSUGGEST_STRATEGY=(
    history
    completion
)

[ ! -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] || source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

rm -f ~/.zcompdump; compinit

then, when you use NormalModeSendToTmuxMotion from this plugin, the tmux terminal that you send to will start a tab completion of the word just before any tab that is in the code being send, like this here:

fi  yes

will give you suggestions to tab-completions starting with 'fi'.

and this here:


nor 

will be tab-completed to the function 'normalize', since there is nothing in (at least my system) other than normalize to complete to.

Not really sure if there is an easy fix for this - the easiest fix, of course is just to use bash instead. That's what I'll do from now on, but it would be quite nice to be able to use a zsh term with completion, if possible..

ChHaeni commented 11 months ago

I'm not familiar with the zsh, but can you try the following?

Open a new tmux session in a terminal.

Send the string nor by directly calling tmux send-keys -t $pane_id nor Enter, where $pane_id is refering to the session:window.pane ids (most likely 0:0.0 - you see all ids of your open tmux sessions when running tmux ls -F '#S:#I.#P').

Does the completion happen, too?