IntelliJ's embedded terminal does not load fish functions

后端 未结 5 995
别那么骄傲
别那么骄傲 2021-02-04 04:15

I\'m using IntelliJ\'s embedded terminal with the fish shell, which works well with one exception: it does not seem to load the fish functions defined in ~/.config/fish/fu

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-04 04:44

    Someone posted a good solution for this in the IntelliJ bug tracker.

    IntelliJ has its own config.fish, where .config/fish/config.fish does get loaded, but not the functions...

    Add the following to IntelliJ's internal config.fish and the fish functions get loaded fine in IntelliJ's embedded terminal:

    if test -d ~/.config/fish/functions
      for f in ~/.config/fish/functions/*.fish
        source $f
      end
    end
    

    The location of IntelliJ's config.fish varies, on macOS it could be

    • Ultimate Edition: /Applications/IntelliJ\ IDEA.app/Contents/plugins/terminal/fish/config.fish
    • Community Edition: /Applications/IntelliJ\ IDEA\ CE.app/Contents/plugins/terminal/fish/config.fish
    • Or even something like this, if installed via Jetbrains Toolbox: ~/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/172.4574.11/IntelliJ IDEA.app/Contents/plugins/terminal/fish

    You could also just replace that whole fish directory in IntelliJ's plugins/terminal with a symlink to your normal fish config directory, usually .config/fish/.

    There's still another option: you can just link the functions directory, for example:

    ln -s ~/.config/fish/functions \
      /Applications/IntelliJ\ IDEA.app/Contents/plugins/terminal/fish/config.fish
    

提交回复
热议问题