prompt-toolkit / pyvim

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

:q not closing editor, ZZ not working as well #19

Open lunemec opened 9 years ago

lunemec commented 9 years ago

I've noticed that ":q" causes (even on not changed file) to say "1 more file to edit" and editor will not close. ZZ does nothing, it should be equivalent to ":q".

Also ":bd" should close a split window (":q" should too).

SanketDG commented 9 years ago

OS and python version? Works here in Mint 17 and python2.7

jonathanslenders commented 9 years ago

Thanks for reporting. There is indeed still a bug in :q. It happens when you start the editor without file, and then uses :edit to add a new file. I will fix that.

ZZ has not yet been implemented. I'll fix that as well.

lunemec commented 9 years ago

Also there is a difference on these:

ZZ is equivalent of :wq - write and close ZQ is equivalent to :q!

lunemec commented 9 years ago

I found some strange behavior. I added this function

    @handle('Z', 'Z', filter=in_navigation_mode)
    def close_with_save(event):
        print('Close and save.')

to file pyvim/key_bindings.py to function _def create_keybindings(editor):

But when I press ZZ, nothing happens. But strange thing is, when I add this exact same function (only with filter=navigation_mode) to python-prompt-toolkit, file prompt_toolkit/key_binding/bindings/vi.py to function _def load_vi_bindings(registry, vistate, filter=None): it WORKS! Why?

SimonBiggs commented 8 years ago

In windows 7, python 3.5, using powershell I type:

:help  

then:

:q

And I get the error "1 more files to edit" and it does not exit.

See screenshot below: capture

I am interested in this project, and am also stuck using windows at work.

:q! also does not work, however :wq does.