Using vim keys in zsh terminal, how to exit "excute:_" mode? - vim

I have recently switched to vim style key binding for my terminal by placing set -o vi in my .zshrc file. When using it I find myself in this "excute:_" mode after pressing Esc and then : , the terminal then looks like this:
[I] ➜
execute: _
What is this mode and how do I exit it?
I have looked here and here for answers to no avail. I also asked in the vim stack exchange and got told to move.

I think it's called the vicmd mode. You can execute commands from the ZLE (Zsh Line Editor).
For example, you can type ed then TAB for completion which should write edit-command-line and if you run it, it will open your editor to edit the current line (as the name suggest).
You can go back to normal mode with ctrl + c

Related

vim backspace not working after stty erase ^?

Since backspace in vim was giving me ^? instead of working as a backspace, I put the following in .cshrc to make it work:
stty erase ^?
Now the problem is that when I open a gnome-terminal from my linux machine, the backspace still does not work in vim. However if I run tcsh on my shell, and reopen vim, backspace does work. If I open a gnome-terminal tab in the already open terminal, or open a new terminal window from the already open terminal on which tcsh was run, I don't see the issue. Could anyone tell me what might be going on?

Double Quote not working in Vim in command mode

I want to copy text from vim buffer to the system clipboard by using the command "*y but when I press the double quote sign in command mode, it doesn't seem to get fired at all as I don't see anything in the status bar (nothing gets copied also even if I blindly continue with the command). I can see all other commands in the status bar in vim. I'm using Ubuntu 12.04 and I have clipboard support enabled in my vim version.
You should press "+y in NORMAL (or VISUAL) mode.
If you love to do it in command line, do this:
:y +
(same for "*y)

vim system register * and + not working

:echo has('clipboard') returns 1, but whenever I execute "+yy" or "*yy" nothing seems to be in those registers. If I use regular yy to copy another line of text, then try to paste from the register using CONTROL+V nothing happens. If I try "+p vim pastes the line of text I copied using the regular yy command.
What's going on here? I'm on FreeBSD by the way.
Your vim version may not be compiled with X11 clipboard integration.
In vim run the :version command and look for xterm_clipboard in the output. It will be prefixed with a + (supported) or - (unsupported) sign.
What worked for me in Ubuntu 20.04 and Vim 8.1.2269
sudo apt install vim-gtk3
Explanation
This package adds support for the x_term_clipboard in vim if not present already.
For more info: Click Here, #blankblank's answer.
Another thing that could be going on is your DISPLAY environment variable is not being set correctly. This could happen sometimes if you're running vim from tmux or screen.
Try opening a new terminal, running echo $DISPLAY, and then from the terminal running vim, leave vim, execute export DISPLAY=:0 (but replace :0 with the output from your other terminal), and then re-enter vim and see if clipboard works by doing "+p.
If you have copy something to clipboard and paste that in vim, you can use "+p.
+ is a quoteplus, which means CLIPBOARD documented X selection. :help quoteplus for more information.
If you want to copy something in vim to clipboard and paste the content in the other place by Ctrl+v, you can do "+yy, this will copy the current line to clipboard.
more information about vim register:
:help registers
:help quotestar
I also met this problem.
My case is that DISPLAY is not set properly in tmux.
And I found a script to automatically update tmux DISPLAY.
My problem was my input source English (US, intl., with dead keys), in addition to vim not being compiled with x-clipboard.
I don't face the same issue on windows, but on Ubuntu 20.04 I have to press "<space>+y with this input source.
Edit:
Seems I can fix this by switching the input source to English (Intl. with AltGr dead keys)

vim command line editting

is there a way to use vim/vi in the vim command line? Sometimes I write a long
command in vim such as:
:!./script /home/user/pet --flag=1
and I want to change for instance "user" by "other". What I usually do is to
navigate the command line with right arrow which is time consuming and even more
when I want to go to the beginning of the line. I would like to have something
like "0" to go there or w/b to move by words. Or use j/k to go to the next/previous
command.
Thanks.
:h cedit
in command line, type ctrl-F(default) to enter command window.
or in normal mode type q:
(for search, type q/)
Vim has a feature called the "commandline window". You can enter it with Control-F by default when you're already on the commandline, or q: from normal mode, edit the commandline using vim commands, and press enter to execute. It also contains your command history so that you can yank previous commands if you like. See :help cmdline-window for more information.
I'm not aware how you can use Vim commands to edit a command directly on the command line, but if you enter the command window q: you get can use regular Vim editing to edit commands.
From there you can execute commands by hitting <CR> or use Ctrl-C to copy the command to the regular command line.
If you run set -o vi you will have vim capabilities in your command line. Just put 'set -o vi' in your .bashrc file or equivalent to have it by default.

ESC doesn't work in cygwin vim

I installed cygwin on Windows 7. When I start vim in cygwin terminal it starts in interactive mode. I can't change mode to command one by pressing ESC. What could be the reason?
UPDATE:
Also vim prints these varnings at start:
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal
If by interactive mode you mean insert mode (where keypresses are inserted as text, just as in other editors), then your Vim is in easy mode.
In it, you can temporarily execute normal mode commands via Ctrl + O. But I guess you don't want this strange beginner's mode. To turn it off, check whether Vim has been invoked with the -y argument or as evim (is there a shell alias?). Or, if you find a :set insertmode command in a .vimrc, remove it. (By default, at least in my Cygwin installations, Vim is not configured for easy mode, so it must be something in your configuration.)
Try to
Press “ESC” and "shift" and ":" together;
You should find the place that you can type command line in vim;

Resources