Vim - Troubleshooting08 May 2018
- [MacVim] blank screen on macOS Sierra and above
- iTerm2 and MacVim hang when running ALE
- location list becomes blank after opening Markdown file
- when using mouse, cursor is positioned with noticeable lag
- creating alternate file doesn’t work
- incorrect folding of lines with equal indent
- poor performance of Vim in the terminal on macOS
in my case problem was with invalid .rubocop.yml file. this can be easily
checked by running
rubocop in the project root: if rubocop starts analyzing
your project then all is fine otherwise it complains about invalid syntax -
in that case just follow on-screen instructions and fix .rubocop.yml.
to debug inside Vim turn on syntastic debugging messages in command-line mode:
:let g:syntastic_debug = 1 " or 3 or 33
run syntastic checkers:
:SyntasticCheck mri rubocop
view syntastic debugging messages in Vim messages:
in my case rubocop returned status code 2 which means running rubocop checker failed on rubocop side.
BTW always set path to ruby and rubocop executables manually so as not to
rely on correct
PATH inside Vim (it can be messed up for a million reasons):
let g:syntastic_ruby_mri_exec = '~/.rbenv/shims/ruby' let g:syntastic_ruby_rubocop_exec = '~/.rbenv/shims/rubocop'
[MacVim] blank screen on macOS Sierra and above
the problem didn’t exist in El Capitan - it first appeared in Sierra: the whole screen went blank when starting to move a cursor around.
# ~/.zlogin defaults write org.vim.MacVim MMUseCGLayerAlways 1
this fix seems to be no longer required on macOS Mojave and MacVim 8.1-151_2 (maybe previous MacVim versions work too or maybe it’s all about new macOS).
…Mojave change that made all NSView automatically become layer-backed
iTerm2 and MacVim hang when running ALE
this happens only when file is saved several times in quick succession
htop is opened in iTerm2 (or another terminal) - it freezes both
iTerm2 and MacVim somehow.
this is a known bug in
htop, macOS High Sierra or both:
htop 2.0.2 is back in brew even though the issue is still open.
location list becomes blank after opening Markdown file
this happens when trying to open some Markdown files from location list with search results.
the problem is not Markdown-specific and is caused by ALE linting first
opened files (
g:ale_lint_on_enter option is enabled by default): after
running linters ALE populates location list of current window with found
issues (or just clears it if no issues are found) - anyway the previous
contents of location list (search results) are gone.
to circumvent this problem it’s possible:
- to disable linting of first opened files
let g:ale_lint_on_enter = 0)
- to disable populating location list with issues found by ALE
let g:ale_set_loclist = 0)
when using mouse, cursor is positioned with noticeable lag
this might be caused by source code tooltips (balloons) - disable them:
" ~/.vim/vimrc set noballooneval
for Ruby it’s also necessary to unset
balloonexpr ftplugin file:
" ftplugin/ruby.vim setlocal balloonexpr=
creating alternate file doesn’t work
:AV command (same as
:confirm A) there is no prompt
to create alternate file if it’s missing:
E345: Can't find file "/Users/tap/dev/sith/spec/controllers/webhooks_controller_spec.rb" in path
I created new Rails project with
was created instead of
spec one and
vim-rails plugin couldn’t find
or create alternate file. so just rename directory to fix the issue.
incorrect folding of lines with equal indent
" ~/.vim/vimrc set foldmethod=indent
lines with equal indent don’t form a fold - folding stops at blank line.
If I’ve reproduced the problem and run :set shiftwidth=2 after the text has already been input, it works as expected but not if i do :set shiftwidth=2 before the text has been input. Similarly if the file has been saved and reopened, the shiftwidth=2 in .vimrc works and the fold works as expected.
all in all if folding is somehow broken, just reload file with
poor performance of Vim in the terminal on macOS
scrolling, moving cursor around - everything feels very slow.
macOS + tmux + vim is slow! I thought this was supposed to be fast!
This appears to be an issue outside of terminal emulators; either macOS has an IPC performance issue, or either tmux or vim (or both) have a bug. This same issue can be seen in iTerm2 and Terminal.app. I’ve found that if tmux is running on another machine which is connected to Alacritty via SSH, this issue disappears. Actual throughput and rendering performance are still better in Alacritty.
P.S. MacVim’s version of Vim (
mvim -v) runs a little bit faster.