Vim Tips Wiki

Use this page to discuss script 3409 HJKL: game using H,J,K,L to explore a maze

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.




It could be useful if it does not create a new buffer if the one we are in is empty. For instance, I just changed the beginning of the HJKL() function to be

 414 function! s:HJKL(...)
 416     if bufname("%") != ''
 417         "create new window for game
 418         new
 419         resize 100
 420     endif

Bug: Exits Vim[]

After the game has been won, or when 'q' is pressed, the current Vim window closes. If only one window exists, however, it exits Vim completely, thus requiring the user to create a new window beforehand (and set it to max height, or the game returns a message that it needs more room). This is true of both Vim and gVim. The user is not notified as it says "type q to quit the game". You might want to fix this.

--- I agree, it's a great way to get those controls into your muscle memory but the fact that vim exits after every game makes it kind of annoying. I'd love for it to continue with the next game. I can always quit it with q.