You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
let g:ale_fixers = { 'html': ['prettier'] }
let g:ale_linters = { 'html': ['stylelint'] }
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 by ALEInfo. Here is the output from ALEInfo.
### :ALEInfo
<details>
<summary>Expand</summary>
Current Filetype: html
Available Linters: ['alex', 'angular', 'cspell', 'eslint', 'fecs', 'htmlhint', 'proselint', 'stylelint', 'tidy', 'vscodehtml', 'writegood']
Linter Aliases:
'angular' -> ['angular-language-server', 'angularls']
'writegood' -> ['write-good']
Enabled Linters: ['stylelint']
Ignored Linters: []
Suggested Fixers:
'fecs' - Apply fecs format to a file.
'html-beautify' - Fix HTML files with html-beautify from js-beautify.
'prettier' - Apply prettier to a file.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'rustywind' - Sort Tailwind CSS classes
'tidy' - Fix HTML files with tidy.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:
let g:ale_html_stylelint_executable = 'stylelint'
let g:ale_html_stylelint_options = ''
let g:ale_html_stylelint_use_global = 0
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 'auto'
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'html': ['prettier']}
let g:ale_history_enabled = 1
let g:ale_info_default_mode = 'preview'
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'html': ['stylelint']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 1
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'E'
let g:ale_sign_info = 'I'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'E'
let g:ale_sign_style_warning = 'W'
let g:ale_sign_warning = 'W'
let g:ale_sign_highlight_linenrs = 0
let g:ale_type_map = {}
let g:ale_use_neovim_diagnostics_api = 0
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) /Users/ribbons/node_modules/.bin/stylelint
(finished - exit code 127) ['/bin/zsh', '-c', '''/Users/ribbons/node_modules/.bin/stylelint'' --stdin-filename ''/Users/ribbons/Downloads/test.html'' < ''/var/folders/gl/bz0xhvl176j6zy6gl6vq2qch0000gp/T/vsIU9Vk/1/test.html''']
<<<OUTPUT STARTS>>>
env: node: No such file or directory
<<<OUTPUT ENDS>>>
(finished - exit code 127) ['/bin/zsh', '-c', '''/Users/ribbons/node_modules/.bin/prettier'' --version']
<<<OUTPUT STARTS>>>
env: node: No such file or directory
<<<OUTPUT ENDS>>>
(finished - exit code 127) ['/bin/zsh', '-c', '''/Users/ribbons/node_modules/.bin/prettier'' ''/var/folders/gl/bz0xhvl176j6zy6gl6vq2qch0000gp/T/vsIU9Vk/2/test.html'' --write']
</details>
The text was updated successfully, but these errors were encountered:
TheButterflyMon
changed the title
Cannot use ALE in MacVim when the file is opened via the right-click context menu or the File > Open dialog in Mac
Cannot use ALE in MacVim when the file is opened via the right-click context menu or the File > Open dialog in MacVim
Apr 19, 2024
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.
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
.The text was updated successfully, but these errors were encountered: