When opening a very large file vim will sometimes take a long time and just show the black screen while it loads. Sometime I change my mind after opening and want to return to the command line without having to wait for vim to finish opening the file. How can I do this?

I've tried Ctrl+C and Ctrl+D and :q! and Ctrl+Z to no avail.

It seems to reject any keyboard input.

  • Not a solution but these two lines in your vimrc can speed up opening large files: set lazyredraw set regexpengine=1 – Tanath Jun 24 '19 at 20:52
  • What operating system are you using? In Linux, you can kill the vim task from another terminal or click on the close window icon and say yes when the window manager asks if you want to kill the task which is not responding. You can probably do similar things in Windows (Task Manager) or OSX. If you have other things open in the same instance of vim, you might lose unsaved content by killing vim. – Joe Jun 25 '19 at 9:01
  • I'm on linux. My current solution is closing the Konsole using the x icon. But then you lose what else you had in that window. – noah Jun 25 '19 at 16:24

The following worked from a second shell. I'm running bash on Windows, and it also works for linux.

myuser@mycomp:/filepath$ ps-ef|grep vim 
myuser      21     4  0 21:16 tty1     00:00:00 vim 
myuser      38    23  0 21:16 tty2     00:00:00 grep vim 
myuser@mycomp:/filepath$  kill 21 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.