prompt-toolkit / pyvim

Pure Python Vim clone.
BSD 3-Clause "New" or "Revised" License
2.53k stars 163 forks source link

Adding 'ZZ' to .pyvimrc #122

Open mbusch-regis opened 5 years ago

mbusch-regis commented 5 years ago

I seem to be odd that my primary method for exiting vim is the 'ZZ' command -- I don't think I've talked to another vim user (f2f). Of course I want that method of exiting pyvim but I've been frustrated in all my attempts to add it to .pyvimrc.

My closest attempt so far will exit but it does not write the file:

     @editor.add_key_binding('Z', 'Z', filter=ViNavigationMode())
     def _(event): 
         """
         Typing '<shift>zz' in navigation mode should write the buffer and quit.

         (imap ZZ :wq)
         """
         editor_buffer = editor.current_editor_buffer
         write_and_quit(editor,editor_buffer.location)

Any suggestions how I can make it both write and quit?

Thanks!

hurdlecrew commented 4 years ago

You are not alone. I recently started using pyvim on my Android laptop when working in pydroid, and zz is definitely a feature I miss.

jonathanslenders commented 4 years ago

@mbusch-regis , @hurdlecrew : Is any of you able to test the pull request from @lieryan above? If it works for you I will merge it. I have not had the time yet to extensively review/test it.

mbusch-regis commented 4 years ago

Initial, cursory tests of the ZZ key binding are good. Will try to test others as time permits (but don't hold your breath... not a lot of time or attention to spare).