micro: Keybindings mostly not working

Description of the problem or steps to reproduce

  • alt+left/right does not select
  • binding "Shift-Backspace": "DeleteWordLeft", does not work
  • one can not rebind ctrl+e ?
  • is there any Keybinding possible to swap the current line one up/ down (also works with selections in sublime using ctrl up+down)?
  • creating keybidnings for plugins is confusing, I wanted to create one for snippets but snippets.snippetinsert and variants do not work, instead one has to look into the source and use snippet.Insert which is not documented or intuitive based on the ctrl+e command

Specifications

Version: 1.3.4 Commit hash: 5fc8f84 Compiled on November 25, 2017

Commit hash: OS: macOS 10.13.2 Terminal: Terminal

the editor is generally really a nice improvement upon nano

thanks

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 32 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Here are the escape sequences I’m seeing when using iTerm2 vs alacritty. For Ctrl+Arrows and Alt+Arrows the sequences are the same (well iTerm2 uses 9 for meta, and alacritty uses 3 for alt, but it’s not a big deal since they both mean the same thing).

However, the differences come up with ctrl+shift+arrows and alt+shift+arrows.

iTerm2:

  • Alt-Shift-Arrows: \x1b[1;10A/B/C/D
  • Ctrl-Shift-Arrows: \x1b[1;6A/B/C/D

Alacritty:

  • Alt-Shift-Arrows: \uf700, \uf701, \uf702, \uf703.
  • Ctrl-Shift-Arrows: Same as alt-shift-arrows.

The unfortunate fact is that a lot of these escape sequences are non-standard as the original terminals didn’t have alt, control, and shift with arrow keys, or at least people didn’t worry about it.

Here’s a comment in the terminfo database here, which explains the escape codes:

# This fragment describes as much of XFree86 xterm's "pc-style" function
# keys as will fit into terminfo's 60 function keys.
# From ctlseqs.ms:
#    Code     Modifiers
#  ---------------------------------
#     2       Shift
#     3       Alt
#     4       Shift + Alt
#     5       Control
#     6       Shift + Control
#     7       Alt + Control
#     8       Shift + Alt + Control
#  ---------------------------------
# The meta key may also be used as a modifier in this scheme, adding another
# bit to the parameter.

iTerm2 is using different escape codes from these ones with 9 being Meta, 10 being Meta-Shift… I think you should just emit 4 for Alt-Shift, and 6 for Ctrl-Shift and everything will work fine.

  1. Just rebind CommandMode to whatever key you want, instead of CtrlE, in your bindings.json
  2. If the plugin doesn’t declare the function local (local function example()), then it can be bound in bindings.json by directly adding "AltE": "pluginname.functionname" (or whatever key you want)
  3. You can rebind vsplit (I bound it to Alt-v myself), but I don’t think there’s a way to specifically bind something that types into the command mode (CtrlE), although you can emulate the desired behaviour with a plugin.