Closed vnazarenko closed 8 years ago
I believe this likely has nothing to do with ack.vim specifically and more to do with OS X, MacVim, and/or your shell… errorfile
refers to a Vim setting used by the quickfix feature and thus the search result lists used by ack.vim but also built-in Vim features like :grep
—my guess is you'll see similar errors if you just try to use :grep
after sleep instead of :Ack
.
TL;DR I'd first suggest set shell=bash
and see if that resolves it easily. I haven't reproduced this myself, my hunch is that Vim or MacVim is at some level using the $TMPDIR
environment variable as part of the default location for 'errorfile'
and caching the path, and OS X must be cleansing tmp
upon sleep, perhaps a security feature. Not entirely sure why set shell=bash
seems to resolve the general issue for some people, but maybe there is some bug in Vim where the environment variable expansion is cached if you're using a different shell.
Please re-open if you have some strong reasoning to suspect that ack.vim is still at fault, but I don't think so since our SearchWithGrep
essentially just delegates to Vim's built-in :grep
machinery with some temporary settings applied.
My Vim is currently using bash as its shell, but still gettin the exact error as above. I'm getting the error only when using special characters like (
in the :Ack
command. For normal string searches it's working. It used to work fine on my Ubuntu machine. Now running Vim v8 on Mac OSX High Sierra.
Things I've tried:
set shell=/bin/bash
export $TMPDIR=/tmp/
\(
Same problem after switching from Arch Linux to NixOS.
The cause was set shell=/bin/zsh
in my init.vim
, which in NixOS does not work, because zsh is not in /bin
. Changing to set shell=zsh
fixed the issue.
I had this happen due to incorrectly escaped/terminated grepprg
and/or shellpipe
.
For example, with this config:
let &grepprg='rg --no-config --vimgrep $*'
let &shellpipe='2>&1 | tee'
This command:
:grep! -F -t go -- 'FoO
Will be shelled-out as:
rg --no-config --vimgrep -F -t go -- 'FoO 2>&1 | tee
Since the quote on the search term FoO
hasn't been closed, the shell will keep trying to complete the token (consuming the redirect, the pipe, and the tee
). Without the redirect & the tee
, the results file will not be created, & vim will respond with E40: Can't open errorfile
. A syntax error in shellpipe
would have the same effect.
I'm using MacVim + 10.11 ( El Capitan ) After sleep Ack is not working, i'm getting something like this:
only app restart fix that.