IntelliJ的嵌入式终端不加载鱼功能

ano*_*ode 10 intellij-idea fish

我使用的IntelliJ的嵌入式终端与鱼贝,这也有一个例外的工作原理:它似乎并没有加载中定义的鱼类功能~/.config/fish/functions/*.

当我使用macOS Terminal.app或iTerm2时,函数按预期加载,只有IntelliJ的嵌入式终端无法这样做.

奇怪的是,IntelliJ终端确实加载~/.config/fish/config.fish得很好.

这是echo $fish_function_pathiterm2和Terminal.app 的输出:

/Users/moritz/.config/fish/functions
/usr/local/Cellar/fish/2.6.0/etc/fish/functions
/usr/local/share/fish/vendor_functions.d
/usr/local/Cellar/fish/2.6.0/share/fish/functions
Run Code Online (Sandbox Code Playgroud)

这是在IntelliJ的嵌入式终端中运行相同的输出:

/Applications/IntelliJ IDEA.app/Contents/plugins/terminal/fish/functions
/usr/local/Cellar/fish/2.6.0/etc/fish/functions
/usr/local/share/fish/vendor_functions.d
/usr/local/Cellar/fish/2.6.0/share/fish/functions
Run Code Online (Sandbox Code Playgroud)

我想这看起来像IntelliJ的嵌入式终端初始化鱼会话具有不同的值$fish_function_path

$HOME(= /Users/moritz)和$XDG_CONFIG_HOME(未设置)在iTerm2,Terminal.app和IntelliJ的嵌入式终端中都是相同的.

ook*_*ook 27

echo $fish_function_path通过转到设置|,我可以从IntelliJ的嵌入式终端和iTerm2中获得相同的结果 然后终端关闭Shell集成.

我使用的是phpStorm 2017.3.4,但我认为这也适用于任何IntelliJ嵌入式终端.


Coo*_*ice 16

检查智能选项。关闭外壳集成

在此处输入图片说明


ano*_*ode 8

有人在IntelliJ错误跟踪器中发布了一个很好的解决方案.

IntelliJ有自己的config.fish,在哪里.config/fish/config.fish加载,但不是函数......

将以下内容添加到IntelliJ的内部,config.fish并且在IntelliJ的嵌入式终端中可以正常加载fish函数:

if test -d ~/.config/fish/functions
  for f in ~/.config/fish/functions/*.fish
    source $f
  end
end
Run Code Online (Sandbox Code Playgroud)

IntelliJ的位置config.fish因macOS而异

  • 终极版: /Applications/IntelliJ\ IDEA.app/Contents/plugins/terminal/fish/config.fish
  • 社区版: /Applications/IntelliJ\ IDEA\ CE.app/Contents/plugins/terminal/fish/config.fish
  • 如果通过Jetbrains Toolbox安装,甚至是这样的东西: ~/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/172.4574.11/IntelliJ IDEA.app/Contents/plugins/terminal/fish

您也可以通过符号链接将fishIntelliJ中的整个目录替换plugins/terminal为普通的fish配置目录.config/fish/.

还有另一种选择:您可以只链接functions目录,例如:

ln -s ~/.config/fish/functions \
  /Applications/IntelliJ\ IDEA.app/Contents/plugins/terminal/fish/config.fish
Run Code Online (Sandbox Code Playgroud)