1

When I run a command using make, it runs from a different directory than running it as a regular command with !. My app is a CBRA, and I open vim from within a component. The top-level app, though, is where the git repository is rooted.

Running :pwd returns /Users/bill/dev/app/components/my_component.

Running :!pwd returns /Users/bill/dev/app/components/my_component.

Running :set makeprg=pwd followed by :make returns /Users/bill/dev/app.

I'd like to run my make commands from within my pwd, preferably without having to prepend a cd to everything.

The only related configuration I could find is autochdir, which is set to noautochdir.

4
  • My best guess is that there is a QuickFixCmdPre autocmd event; you can check with :au QuickFixCmdPre. Commented Sep 13, 2022 at 16:47
  • Welcome to Vi and Vim! Have you tried How to debug my vimrc?
    – D. Ben Knoble
    Commented Sep 13, 2022 at 17:57
  • 1
    Huge apologies; the issue was happening in neovim, but I tried it as well in an old installation of vim and got the same behavior. I forgot that, once upon a time, that old vim was my daily driver, and the same plugin (vim-rails in this case) was installed for both. @MartinTournoij there was indeed an autocmd for this action. Commented Sep 14, 2022 at 11:18
  • vim-rails seems to change directory, but to be honest I don't really understand why or what to exactly. Commented Sep 14, 2022 at 14:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.