2

I'm using PyCharm with IdeaVim, and I have a little issue. I'm trying to execute the following command in Vim:

:! cd ./Desktop

However, I got the following error, and I don't know why :

Cannot run program "cd": error=2, No such file or directory.

I'd like to execute that kind of command in PyCharm. How could I fix this little issue?

muru
  • 197,895
  • 55
  • 485
  • 740

1 Answers1

3

IdeaVim != Vim.

Looking at the code, it uses Runtime.exec() to run commands, which doesn't use a shell. So, :!cd is meaningless here.

muru
  • 197,895
  • 55
  • 485
  • 740
  • I have a similar problem with gvim (/bin/bash: line 0: cd: Desktop: No such file or directory). Is there a way to fix it in both situation? –  Jan 11 '17 at 04:56
  • @DavidHilbert that is a different problem. You should be doing cd ~/Desktop. But if you want to change directories in Vim proper, use :cd instead of :!cd. – muru Jan 11 '17 at 04:59
  • Thanks for that! Do you know if there exists a solution for the question. –  Jan 11 '17 at 05:01
  • @DavidHilbert file a feature request: https://youtrack.jetbrains.com/issues/VIM – muru Jan 11 '17 at 05:01
  • I know you are likely a good user of Vim. Do you use Vundle to install a plugin? –  Jan 11 '17 at 05:04
  • @DavidHilbert I started with pathogen and now I use vim-plug: https://github.com/junegunn/vim-plug. – muru Jan 11 '17 at 05:06
  • Is there a reason why you use vim-plug instead of another, Vundle for instance? –  Jan 11 '17 at 05:10
  • @DavidHilbert just the awkward initialisation of Vundle (turn off filetype, manually add to rtp). And vim-plug does all that I need it to. – muru Jan 11 '17 at 05:29