UPDATE 20221006:
Alacritty built-in shortcuts
As far as I can see from tests, you can press Ctrl+Shift+Space
for vim mode, then use vim's ggVG
to mark all, and Alacritty-copy with Ctrl+Shift+C
into the system clipboard. Either this was changed, or I have just overseen it, or it does not always work, I do not understand why it is not in the older workarounds further below.
alacritty.yml: save_to_clipboard: true
If that does not work, for example since the server does not have or allow copying to the system clipboard, check whether it helps to change the alacritty.yml config file in the main folder of Alacritty. Search for #save_to_clipboard: false
, and change to true:
\#selection
...
\# When set to `true`, selected text will be copied to the primary clipboard.
save_to_clipboard: true
System clipboard binding
If that does not help, bind the system clipboard to a key of your choice.
Install a clipboard like xclip or xsel:
# Check whether xclip is installed:
$ xclip
# Out:
xclip is hashed (/usr/bin/xclip)
# If it is not installed, install it with
$ sudo apt-get update -y
$ sudo apt-get install -y xclip
a. Alacritty bindings
Bindings in Alacritty are documented in the alacritty.yml. This includes the ctrl+shift+c/v bindings for copy/paste. See: How can I copy text from Alacritty to clipboard #5202 . Take that binding pattern and make your own binding. I did not test any self-written bindings in the Alacritty config that I could share.
b. Tmux bindings
Instead, I ended up in installing Tmux on top of Alacritty, and that is the waterproof way of copying whatever from Alacritty to wherever. In Alacritty, you will now have tmux power, as well as in any other terminal.
In the Tmux config, the binding for "y" would be:
bind -T copy-mode-vi y send -X copy-pipe "xclip -selection c"
Start with Ctrl+B+[, mark what you want to copy by pressing Space to begin with and "y" when you are done, and it will be in the system clipboard.
Older workarounds
The workarounds below are older, no need to read, and I guess I am also wrong there in saying that there is no answer.
You seem not to be able to mark all and copy from Alacritty, therefore, the answer is just that there is no answer. Here are some workarounds.
Workaround 1: vim mode: G
, terminal mode: Ctrl
+-
max zoom out, Shift
+mouse, Shift
+Page down
if more than one page
In vim mode, press G
so that you load the file from top to bottom. You may then also :q
quit the file, but not needed. The main thing is just that the full file is part of the terminal history, without any gaps, and that you do not use any vim commands after this G
: any vim page down Ctrl
+F
leaves a printout at the page end which you do not want. Then zoom out with Ctrl
+-
until you see the whole file or until the max zoom is reached. Copy the zoomed out page with the mouse, press Ctrl
+Shift
+C
and paste in your local file. Repeat page for page by pressing Shift
+Page down
and mark everything again. This is still step by step then, but at the max zoom, you will usually have just one or two steps to make. You do not need to zoom in during the steps, just press use Shift
+Page down
in terminal mode.
Workaround 2a: Copy only chosen lines using vim/Alacritty search power
Before you copy the whole terminal history only to search through that again, you can also start searching in the terminal. When entering vim mode with Ctrl+Shift+Space
, you can use the vim search power to search through the whole history. Just press g
, then type /MY_WORD
, press Enter
and then go on with pressing n
for each next finding of "MY_WORD".
Without vim, you can also just use Ctrl+Shift+F to search through the terminal history (commands/opened text files) from the command line upwards.
By this, I could find code changes right before a crash. And I could mouse-shift-page_up_or_down-copy (as written at the bottom) the needed code that was spread over many pages.
Workaround 3: Pipe text to file and copy it somewhere else
As the "best practice workaround", pipe anything you do (commands, files) into a new file, for example a file in /tmp
, and copy it to your machine. If you are on a server, you can scp the files to your computer.
Workaround 4: Copy only ~ 500 lines
The following cannot copy all lines of a large terminal history, just about 350 to 500 in most cases as I saw during my tests. This might still be enough for many copy tasks, and you can go on stepwise to catch more, though that is fiddly. It is therefore not working well enough. I thought it would, but that was just since I marked an embedded vim text with more than 1000 lines and thought you can copy more. In fact, the clipboard lines of 524 are also changing, the allowed lines depend on how large the vim file is that you mark within your history. I had >1000 lines and one with 522 lines as well in the output.
You need to stay in normal mode - do not change to vim mode that would be reached with Ctrl+Shift+Space
- and
- scroll with
Shift+Page up
,
- mark your start with a left-click,
Shift+Page down
to your end mark,
- use right-click to make the fine-tuning of finding the end,
- and then
Ctrl+Shift+C
.