micro icon indicating copy to clipboard operation
micro copied to clipboard

Ctrl-c (copy) does not work

Open Itookmyprozac opened this issue 2 years ago • 10 comments

The keybinding Ctrl-c works fine in my terminal but does not work on micro even if it's set on bindings.json. The copy function works ok if I press Ctrl-Shift-c. Ctrl-v (paste) also works ok.

Ctrl-c works out of the box on Linux Mint (i3wm) and MX-Linux (i3wm), both using Xfce4 terminal.

xclip is installed.

Commit hash: Micro 2.0.10 (comit hash b9763856). OS: Arco Linux with 3wm. Terminal: Xfce4-terminal

Content of my bindings.json file:

{
    "Alt-/": "lua:comment.comment",
    "Alt-a": "lua:snippets.Accept",
    "Alt-d": "lua:snippets.Cancel",
    "Alt-s": "lua:snippets.Insert",
    "Alt-w": "lua:snippets.Next",
    "CtrlUnderscore": "lua:comment.comment",
    "Ctrl-c": "Copy",
    "Ctrl-v": "Paste",
    "Ctrl-x": "Cut",
    "Ctrl-y": "Redo",
    "Ctrl-z": "Undo"
}

My settings file:

{
    "colorscheme": "nord-16"
}

Plugins installed: detectindent, micro-snippets-plugin, nordcolors. If I delete all of them there's no change on this problem.

Thanks for your help.

Itookmyprozac avatar Jul 31 '22 12:07 Itookmyprozac

@Itookmyprozac can you try opening Micro, pressing Ctrl+e, and typing set clipboard external?

tomodachi94 avatar Aug 14 '22 00:08 tomodachi94

Done but no changes unfortunately. Only Ctrl+Shift+c works. It's not a big deal but I always lose a couple of seconds using Ctrl+c and then Ctrl+Shift+c because I'm used to use micro on every device with the first one. Edit: I've discovered that Ctrl+c works ok using Alacritty so this problem only shows up when using Xfce4-terminal even the key binding (gtk_accel_path "<Actions>/terminal-window/copy" "<Primary>c") is set as usual in the accels.scm file.

Itookmyprozac avatar Aug 14 '22 19:08 Itookmyprozac

I'm on Manjaro / sway / wayland / alacritty, and pressing Ctrl+e and typing set clipboard terminal solved the problem for me.

tobip avatar Oct 20 '22 08:10 tobip

I found next: if your terminal emulator consumes the clipboard-copy action by Ctrl+Shift+C then micro will have Copy : Ctrl+C. Otherwise, if your terminal emulator consumes theclipboard-copy by Ctrl+C then micro will have Copy : Ctrl+Shift+C.

Env: Sway + foot.

hikkidev avatar Nov 17 '22 03:11 hikkidev

I found next: if your terminal emulator consumes the clipboard-copy action by Ctrl+Shift+C then micro will have Copy : Ctrl+C. Otherwise, if your terminal emulator consumes theclipboard-copy by Ctrl+C then micro will have Copy : Ctrl+Shift+C.

Env: Sway + foot.

You're right. Now it works.

I had to disable the keybinding Ctrl+c on Xfce-terminal (and also the autocopy selection) in order to allow micro to use that keybinding.

It's odd since I use this terminal and editor in other distros with the same WM. Well, in Arco Linux I'll have to use this workaround.

Thanks.

Itookmyprozac avatar Nov 17 '22 18:11 Itookmyprozac

so, problem solved? can this issue be closed then?

wizdoux avatar Jan 11 '23 11:01 wizdoux

No. I though it was working, but it's not.

The content of my bindings.json:

   {
       "Alt-/": "lua:comment.comment",
       "Alt-a": "lua:snippets.Accept",
       "Alt-d": "lua:snippets.Cancel",
       "Alt-s": "lua:snippets.Insert",
       "Alt-w": "lua:snippets.Next",
       "CtrlUnderscore": "lua:comment.comment",
       "Ctrl-c": "Copy",
       "Ctrl-v": "Paste",
       "Ctrl-x": "Cut",
       "Ctrl-y": "Redo",
       "Ctrl-z": "Undo"
  }

Ctrl+X does not work either.

It's a weird problem since I can paste text that it's copied from terminal into micro but I can't do the same if I try to copy & paste in micro. It happens the same also using Alacritty.

The copy action shows the message "Copied selection" but if I try to paste micro shows the message "no clipboard received from terminal".

Itookmyprozac avatar Jan 14 '23 10:01 Itookmyprozac