I have set VIM as the default editor in the Terminal.
I changed the ~/.bashrc:
export VISUAL=vim
export EDITOR="$VISUAL"
You can also set the default editor only for git:
git config --global core.editor "vim"
So far so good.
When I open VIM on its own, it opens in the Terminal frame. When I make a git commit, it pops up inside the same Terminal window I am in, which is good.
Now to the problem. I am a beginner at VIM and I follow what is the command for "Select All" in vim and VsVim?. I cannot right-click and copy after selecting all (ggVG
), it is the normal Terminal menu that pops up, and VIM likely does not have any such menu anyway.
With VIM shortcuts, it does not work either.
Ctrl
+Shift
+C
does not work.- When I press
y
to "yank" (which is also not a clear copy command from a beginner's perspective...) the text loses the selection again, but the clipboard is still unchanged. - Yet, when I mark text in Visual mode "V" or in Insertion mode "I" with the mouse, then of course just the text that I can see on the screen without any scrolling, I can copy (using the right-click menu of the terminal again):
If I mark all with the command from the link above and then shrink this line by line with the
Shift
and thePage Up
key until I have only a one-pager, I still do not get a workingCopy
symbol in any step - also not when I reach the one-pager. Copying is only possible with text that can be seen in the window.I can also press
v
and just select something that can be seen on the screen and pressy
to copy, works fine. But I cannot go over the screen border and do the same. As soon as scrolling is needed, or as soon I go to the end of the file, I cannot usey
anymore. I have shown this to another user of VIM and he was also surprised, proving that I have not just misunderstood something here.
How can I ungrey this terminal "Copy" button in the right-click menu when all of the text is selected? Or which VIM shortcut can still copy when the "Copy" symbol of the right-click menu is greyed out?
PS:
Since I did not want to risk the file content that I had in a Docker container only with some hour of work in it, I decided to copy and paste, step by step, a larger code file before trying even "y" for yank or more shortcuts. With research and this question here I lost half an hour only to try copying my work. Is this murphy's law in action or just a beginner's stupidity so that only I have this problem?
y
copies to the unnamed and 0 registers as usual, whereas you need something like"*y
or"+y
to yank to clipboard registers.y
, the selection is lost, but nothing is in the clipboard. It is also happening when I use VIM just in a normal terminal as the forced editor for a git commit.:%y[ank] [register]
Copy
also being greyed out then! That explains it, I have VIM as the default editor in terminal (export VISUAL=vim export
andEDITOR="$VISUAL"
), and the right-click menu is still the terminal right-click. Even if I open VIM directly it is opened in the terminal. And that might block the copying of more than the terminal window "that can be seen".