T
T
tugo2021-09-28 14:55:08
linux
tugo, 2021-09-28 14:55:08

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

6 answer(s)
A
Antonio Solo, 2021-09-28
@solotony

micro will save the father of Russian democracy

K
ky0, 2021-09-28
@ky0

> filename ; %ваш_любимый_редактор% filename, Shift+Insert

B
Boris Syomov, 2021-09-28
@kotomyava

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.

X
xotkot, 2021-09-28
@xotkot

Vim is not needed.

and emacs?)
as an option, try tilde ( tilde ) (select all Ctrl+A)
p.s.
stumbled upon an interesting console editor dte
is very flexible and weighs less than nano
$HOME/.dte/rc
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'

here we created a file ($HOME/.dte/rc) of the dte program settings and registered in it the aliases of the commands we needed (select-all and select-all-paste) and then hung them on the keyboard shortcuts (Ctrl + a and Alt + a )
select-all - selects all text
select-all-paste - selects all text and replaces it with the contents of the clipboard (so as not to stand up twice)
here wl-paste is an external Wayland clipboard utility
wl-paste -- clipboard copied
wl-paste -p -- buffer allocated
for X-owls instead of wl-paste, for example, you can use the same xsel with the necessary keys:
Selection options
-p, --primary Operate on the PRIMARY selection (default)
-s, --secondary Operate on the SECONDARY selection
-b, --clipboard Operate on the CLIPBOARD selection

that is, when replacing wl-paste with xsel, it will be something like this:
alias select-all-paste  'select-all; pipe-from -m xsel -p'

V
Viktor Golovanenko, 2021-09-28
@drygdryg

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

S
Saboteur, 2021-09-28
@saboteur_kiev

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 question

Ask a Question

731 491 924 answers to any question