Open zhiyuan411 opened 5 years ago
Hello @zhiyuan411! It looks like you're probably using mycli with "Vim" mode enabled, but it sounds like this isn't what you want.
If you press [F4], it should toggle to Emacs mode (which emulates the default behavior in Bash/readline).
Some more information is here (along with how to configure this in the config file): https://www.mycli.net/keybindings
If you do want to use Vim mode, there is a Vim insert mode and a Vim normal mode. In insert mode (I
), what you type is displayed. If you use the Escape key to switch modes (shown at the bottom of the screen), then you can enter Normal mode (N
). In normal mode typing v
will open the editor window. Typing i
in mycli will switch you back to insert mode.
Insert mode:
Normal mode:
Hello @tsroten! thx for reply. I'm sure the default config is Emacs mode, and in mycli, I can toggle to Vim mode with 'F4'. I can see 'Vi-mode (I)' at the bottom when I press 'F4'. But whether I'm in Emacs mode, or Vi-mode (I), It always open the vim editor window when I press 'v'. (also I tried in Vi-mode (N), the same as it should be, that's ok.) Maybe there is Some System or Other application Configs to cause that? Do you have any idea or suggestion for it? thx again.
I have a version 1.20.1 and I press accidentally the v many times in Vi-mode. (I would like to visual select some text to delete ':)
My external editor is vim and if I send the :x command its execute the new query from the editor which is obvious but when I write the :q! command mycli execute the one which was before I pressed the v button.
Can I exit from the editor without executing any query or can I remap the open editor shortcut something else?
Can I exit from the editor without executing any query or can I remap the open editor shortcut something else?
No, you cannot. It's an issue that bugs me too, I'll take a look on weekend.
UPD: it turns out, you can avoid executing the query as long as your editor supports exiting with an error code. In vim it's :cq
@NeverI I've tried to completely disable the auto-execution, you can try to install mycli from this branch to see if it feels better:
pip install git+https://github.com/dbcli/mycli.git@editor-auto-execute
@pasenor Awesome, it's sames great to me. I'll give it a try for a few days.
Maybe it's bother some experienced user with steady hand but I like the idea to always double check the query before I execute it. Better safe then sorry :sweat_smile:
when enter character 'v', it opens a new vim's window to edit the input. such as '>v', '>select v', etc, when enter 'v', and just the 'v', it opens the vim to edit the input, just like I open a file with vim, and the file name is like "/tmp/=tmp6rve_thn.sql", a random file under /tmp dir. (when the editing in vim is end, the edited text will input into the mycli to execute.) I have no idea how that happens, and I wish it not.
Env infos: linux centOS 3.10.0, python 3.5, mycli 1.17.0