22

vi editor is not responding any command in ksh.

I tried q, ctrl+c, :q!, nothing responded. I have to close connection on secureCrt and re-login.

Does anyone know cause-and solution?

papanito
  • 2,349
  • 2
  • 32
  • 60
oztur
  • 345
  • 1
  • 2
  • 9

2 Answers2

51

I think you wanted to save the file with CTRL-s. That's a screen-lock. Use CTRL-q to unlock and save with :w.

Walter A
  • 19,067
  • 2
  • 23
  • 43
  • 5
    I must have hit it accidently, I've never heard about this feature! – CaptainCrunch Oct 08 '19 at 20:39
  • 2
    It is amazing that I've used vim for several years now, but did not know this. This answer saves me from needing to kill my terminal session. :-D – RayLuo Feb 17 '20 at 02:32
  • 2
    Today I encountered same symptom, search and find this solution here. And, when I'm about to leave a comment for appreciation, I realize that the 3-year-yonger myself had already left that comment above. #ShakeMyHead – RayLuo May 10 '20 at 19:22
  • 1
    @RayLuo Unbelievable how you aged three years from the 17th February to the 10th May. – winklerrr Dec 21 '20 at 11:35
  • @winklerrr CTRL-s puts your aging process in warp speed. – Walter A Dec 21 '20 at 22:33
  • @winklerrr Nice catch! I must have momentarily misunderstood "Feb 17" as "Feb 2017". Nonetheless, this reinforces my SMH conclusion in 3 ways: (1) This knowledge is so rarely-used that I shamefully forgot it; (2) Being locked out by your editor during happy-hacking is surely a WTF moment to lose your composure and time-judgement; (3) and it also opens a wormhole for time warp (whatever that means). :-) – RayLuo Dec 23 '20 at 06:51
  • Just like others, I have been using Vim for decades and run into this issue (or is it a feature) just today. Thanks for the useful answer. – Chris Grundy Mar 12 '21 at 13:17
1

Did you try ESC-colon-q-bang?

:q! 

ESC to get out of insert mode, colon is to enter command mode, 'q' to quit, the bang is to discard any changes. It looks like you may just be missing the colon for command mode.

Check out this post for other ways to exit vi: https://stackoverflow.com/a/11828573/2543416

Community
  • 1
  • 1
Gary_W
  • 9,933
  • 1
  • 22
  • 40