Open TheButterflyMon opened 7 months ago
I solved this issue. It's not a bug with ALE but rather a configuration issue with Vim. I'm documenting the solution so that it may help others who are facing a similar issue.
The solution is to add the -i
flag to the default -c
flag in the shellcmdflag
option in your .vimrc
, like this: set shellcmdflag=-ci
.
Brief Explanation: By default, Vim runs shell commands using a non-interactive shell, which does not source your .zshrc
file (maybe because using an interactive shell can be risky when running untrusted scripts). In Zsh, the interactive option is -i
, and adding this flag to the shellcmdflag
option tells Zsh to run in interactive mode when executing shell commands.
There may be a better way to do this.
Not sure how exactly sourcing .zshrc
affects ALE, did you find it out? I'm experiencing a similar issue on my Kubuntu installation, where gvim x.ts
(vim-gtk3) works fine, but opening x.ts
via Dolphin makes ALE silently fail. I have neither zsh
installed nor any lsp-related things in my .bashrc
-- it's pretty default. I'll try your solution at Monday-ish and if it works, will add to this. Thanks for the report!
Information
VIM version VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 4 2024 03:08:50) macOS version - arm64
Operating System: macOS Sonoma 14.4.1
What went wrong
I'm using MacVim r179 (Vim 9.1.0) and using the latest version of ALE (I updated it today). I'm running macOS Sonoma 14.4.1 and Z shell: zsh 5.9 (x86_64-apple-darwin23.0).
I could not find a solution to this problem on the Internet, so I decided to post it here. When I open a file (say an HTML file) with MacVim by right-clicking on the file and selecting Open With > MacVim or using File > Open in MacVim, I am unable to use ALE to lint or fix the file.
However, if I use Terminal Vim (that ships with Mac) or use the Terminal to navigate to the directory where the file is stored and open the file with MacVim, like
mvim file
, ALE works as expected.Here is my ALE configuration:
Reproducing the bug
Open a file in MacVim either by right-clicking on the file and selecting Open With > MacVim or using File > Open in MacVim. Then, try to use ALE to lint or fix the file.
ALEInfo
I opened an HTML file with MacVim from the right-click context menu in Mac, ran
ALEFix
, followed byALEInfo
. Here is the output fromALEInfo
.