user985675
user985675

Reputation: 291

Run .bashrc function in background from vim

Within vim, I'd like to run one of my .bashrc functions, ocr, in background. I've tried the following commands in .vimrc, which do not work:

set shell=bash\ --login  " to run bash aliases must use interactive shell
set shellcmdflag=-ic  " to run bash aliases must use interactive shell

This ex command does work, but it won't run it in background:

:!bash -c -i ocr &

instead returning the message:

bash: initialize_job_control: no job control in background: Bad file descriptor

and the job is running in fg so that I cannot return to vim.

Upvotes: 0

Views: 543

Answers (1)

user985675
user985675

Reputation: 291

I've tried 3 "solutions" to this problem, 2 I listed in my original post, and one given by Sergio above. None of them worked for me, and I think its clear that what will work for any system depends very much on how that system is set up.

But I do know this: copying the function ocr into a script, ocr.sh and it runs just fine.

Upvotes: 1

Related Questions