jimeh / tmuxifier

Tmuxify your Tmux. Powerful session, window & pane management for Tmux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fish shell integration is not working

wikimatze opened this issue · comments

When I'm doing the part of Setup with eval (tmuxifier init -) I get the following error:

fish: Unknown command “export”
- (line 1): begin; export TMUXIFIER="/home/wm/.tmuxifier"; source "$TMUXIFIER/init.sh"; ;end 
                   ^
in . (source) call of file “-”,
    called on line 21 of file “/home/wm/.config/fish/config.fish”,

in . (source) call of file “/home/wm/.config/fish/config.fish”,
    called on standard input,

fish: Unknown command “source”
- (line 1): begin; export TMUXIFIER="/home/wm/.tmuxifier"; source "$TMUXIFIER/init.sh"; ;end 
                                                           ^
in . (source) call of file “-”,
    called on line 21 of file “/home/wm/.config/fish/config.fish”,

in . (source) call of file “/home/wm/.config/fish/config.fish”,
    called on standard input,

Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

It seems like the init.fish is not loaded. Do I have to put it in the ~/.config/fish folder? I'm a fish newbie so I can't really help you much with this issue.

Got it working with manually loading the init.fish file

if test -z $TMUXIFIER
  set -gx TMUXIFIER "$HOME/.tmuxifier"
end

# Add `bin` directroy to `$PATH`.
if not contains "$TMUXIFIER/bin" $PATH
  set -gx PATH "$TMUXIFIER/bin" $PATH
end

# If `tmuxifier` is available, and `$TMUXIFIER_NO_COMPLETE` is not set, then
# load Tmuxifier shell completion.
if test -n (which tmuxifier); and test -z $TMUXIFIER_NO_COMPLETE
  . "$TMUXIFIER/completion/tmuxifier.fish"
end

Hey, it seems the shell detection code isn't detecting your shell correctly.

You can force the init script to assume a specific shell by doing this:

eval (tmuxifier init - fish)

But I'm curious as to why the detection fails. Would you mind running echo $SHELL and tell me what the output is?

The output is:

$ echo $SHELL
/usr/bin/fish

So I think everything is right.

I encounter this problem as well because my default shell is bash and I subsequently load fish (I haven't made it my default shell). Therefore I see this:

mark@mark-mint17 /m/r/d/u/w/w/g/j/tmuxifier> echo $SHELL
/bin/bash

mark@mark-mint17 /m/r/d/u/mark> fish --version
fish, version 2.0.0

mark@mark-mint17 /m/r/d/u/w/w/g/j/tmuxifier> set | grep fish
__fish_bin_dir /usr/bin
__fish_cd_direction prev
__fish_config_interactive_done
__fish_datadir /usr/share/fish
__fish_help_dir /usr/share/doc/fish
__fish_init_1_22_0
__fish_init_1_50_0
__fish_prompt_cwd \e[32m
__fish_prompt_hostname mark-mint17
__fish_prompt_normal \e[30m\e(B\e[m
__fish_sysconfdir /etc/fish
fish_color_autosuggestion '555' 'yellow'
fish_color_command '005fd7' 'purple'
fish_color_comment red
fish_color_cwd green
fish_color_cwd_root red
fish_color_error 'red' '--bold'
fish_color_escape cyan
fish_color_history_current cyan
fish_color_match cyan
fish_color_normal normal
fish_color_operator cyan
fish_color_param '00afff' 'cyan'
fish_color_quote brown
fish_color_redirection normal
fish_color_search_match --background=purple
fish_color_valid_path --underline
fish_complete_path '/home/mark/.config/fish/completions' '/etc/fish/completions' '/u'…
fish_function_path '/home/mark/.config/fish/functions' '/etc/fish/functions' '/usr/s'…
fish_greeting Welcome\ to\ fish,\ the\ friendly\ interactive\ shell\nType\ \e[32mhe…
fish_key_bindings fish_default_key_bindings
fish_pager_color_completion normal
fish_pager_color_description '555' 'yellow'
fish_pager_color_prefix cyan
fish_pager_color_progress cyan

Perhaps detecting the existence of fish_greeting or any _fish_* environment variable might be sufficient?

The root cause appears to be that Fish 2.0.0, released May 17, 2013, is part of the Ubuntu 14.04LTS/Linux Mint 17 OS distro. My brief search of the fish shell repo shows that the "source" command wasn't documented until August 14, 2013, see https://github.com/fish-shell/fish-shell/commits/5c25be51ea9ab623ae55728eee1987d0f16df255/doc_src/source.txt

I am guessing "source" was released with Fish 2.1.0 and that explains the fish: Unknown command “source” error.

See my pull request for patches.

According to the fish shell documentation, the "." alias to the source command will be deprecated in the future. So my fix is not future proof without detecting fish --version < 2.1.0

My 2 cents: since fish is a pretty new shell and with a niche market. I think fish users should and are able to keep their fish shell updated. So there is no need to support old version.
Maybe we can add a note that only fish >= 2.1 is supported.

Of course this will change after fish matures and have stable releases.