zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.84k stars 1.17k forks source link

how to input nano keybinds into micro? #3409

Open qbai opened 1 month ago

qbai commented 1 month ago

I transfer from nano to micro, but it seems the default keybinds is based on window's mode, not linux. this is very odd. could we input nano's keybinds into micro by some way? thanks a lot

Andriamanitra commented 1 month ago

All keybindings in micro are configurable. help keybindings should contain all the information you need to configure them to match nano.

niten94 commented 1 month ago

There is also an example of bindings.json with nano keybindings in this comment: https://github.com/zyedidia/micro/issues/277#issuecomment-244402522

CtrlK is binded as CutLine by default and Open is OpenFile now, so the example would be like this when using it in new versions:

{
    "CtrlO": "Save",
    "CtrlR": "OpenFile",
    "CtrlY": "PageUp",
    "CtrlV": "PageDown",
    "CtrlU": "Paste",
    "CtrlX": "Quit",
    "CtrlW": "Find"
}
qbai commented 1 month ago

@niten94 this is little part of nano bindings, not all. what I meaning is that micro should provide compatible keybind for linux environment, not just using window's. this is not suitable for linux developer.

qbai commented 1 month ago

I suggest micro team to provide a tool that will create new keybind.json that is same as nano's, not just change jason file manually

niten94 commented 6 days ago

Keybindings in nanorc can be easily parsed but it does not seem like nanorc with default keybindings can be generated. The function calls in shortcut_init in src/global.c in code of nano can somewhat be parsed but the code can be changed so I think it is better if a manually written file is available instead.

I do not think programs like text editors usually include controls specific to other programs or files related with converting configuration. I tried at least writing bindings.json with default keybindings written in the cheatsheet in the website: bindings.json

The formatting of bindings.json is rewritten and comments are removed when a plugin adds keybindings but it is discussed in this issue: #2194