Darrel Lee
Darrel Lee

Reputation: 2470

Can I use a shell other than cmd with IdeaVim

I'm using IdeaVim with PyCharm 2021.2 on Windows 10. I've found that !! commands seem to use the DOS cmd command prompt to execute shell commands. I'd like to invoke Cygwin/bash or git bash (or maybe use the WSL?)

I haven't been able to find any obvious settings in PyCharm.

You can change the terminal settings but that doesn't seem to affect IdeaVim. And I can't find an settings for the plug-in other than the key conflict map.

I've tried setting it in .ideavimrc, but that doesn't seem to work. I know the settings should be ok, because I test them vim -u .ideavimrc and they work for vim, but not idea vim.

After a while it occurred to me to look use use the normal vim settings. Duh.

But that doesn't seem to work. I know the config is ok in general because it is effective for my vim with -u .ideavimrc. But it just breaks !! in IdeaVim. I just get an error sound.

If you use :set all in IdeaVim you set the shellxquote=( is set. Unsetting in .ideavimrc has no effect, neither does using :set shellxquote= in IdeaVim. Are the some more obscure vimrc setting to try. How much vim is in IdeaVim?

Has anyone figured out what the secret sauce is? Surely someone is using IdeaVim with a different shell for external commands.

Upvotes: 1

Views: 692

Answers (1)

mellow-yellow
mellow-yellow

Reputation: 1810

If you install WSL, this works in IntelliJ IDEA 2022.1 (source), which should work in PyCharm too (since PyCharm is IDEA but with only 1 paid plugin: namely Python).

  1. click the IdeaVim icon (lower-right corner) > open ~/.ideavim
  2. add set shell=bash.exe
  3. add set shellcmdflag=-c (most common case) OR set shellcmdflag=-lic (l=login shell, i=interactive shell, c=run the commands in step 5)
  4. restart your IDE OR enter this Ex command: source c:\Users\YOUR_USERNAME\.ideavimrc
  5. enter this Ex command !ls -lah

Upvotes: 2

Related Questions