Answer the question
In order to leave comments, you need to log in
Is there a console editor for Linux that makes it easy to select all text?
Just select all the text, like Ctrl-A in Windows.
Just a keyboard shortcut.
Vim is not needed.
To paste text from the clipboard and it would replace the selected text.
Answer the question
In order to leave comments, you need to log in
You're confusing the operation inside the editor with the clipboard operation, which your console applications don't know anything about - for them, the paste operation is actually your typing the same text. And with the insertion / copying, the terminal application works on the side of your operating system.
The contents of the clipboard will not be able to replace the selection in any console editor, as it happens in your local editor. You must first delete the desired fragment in the file, or clear it, and then paste it.
Your question should rather be asked as follows: In which console editor can you clear the file being edited or the selection in it with a simple key combination.
For example, in some nano, you can delete everything from the current position via Alt + T. Or clear the file beforehand as ky0 suggestedand then open it in a console editor and paste what you need there.
Vim is not needed.
alias select-all 'bof; select -l; eof'
alias select-all-paste 'select-all; pipe-from -m wl-paste -p'
bind C-A 'select-all'
bind M-a 'select-all-paste'
Selection options
-p, --primary Operate on the PRIMARY selection (default)
-s, --secondary Operate on the SECONDARY selection
-b, --clipboard Operate on the CLIPBOARD selection
alias select-all-paste 'select-all; pipe-from -m xsel -p'
Use xclip to work with the clipboard.
Copy file to clipboard:
$ cat file.txt | xclip -sel clip
Replace file content with clipboard content (equivalent to Ctrl+A, Ctrl+V in editor):
$ xclip -sel clip -o > file.txt
What is meant by clipboard?
Are you sitting in Linux under a Linux text terminal?
Are you on linux under gui and launching a terminal?
You sit and connect to Linux by a remote machine and the clipboard is not in Linux but in your local machine, which needs to be transferred remotely via ssh?
When you understand that you most likely have the third option, you will understand that the clipboard is not just like that.
even vi is fine for deleting/replacing text.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question