Giter Club home page Giter Club logo

Comments (20)

pscollins avatar pscollins commented on May 12, 2024 3

Maybe a nice solution to this would be to read off configuration from a file, and ship it with sensible defaults? Assigning meaning to keybindings borders on holy war territory.

from micro.

LukeSkyw avatar LukeSkyw commented on May 12, 2024 3

Sorry to hijack that closed thread, but for all the people who came here for some sane defaults:

$ cat >> ~/.config/micro/bindings
{
  "CtrlLeft": "WordLeft",
  "CtrlRight": "WordRight"
}
^D

from micro.

zyedidia avatar zyedidia commented on May 12, 2024 1

I think most of these will be possible to implement, although they will only work on a subset of terminals which support these kinds of keybindings. I believe all relatively modern terminals support this stuff though. Unfortunately tcell does not support these keybindings out of the box, but I might be able add them anyway.

Of course, I will need to use Ctrl instead of Cmd for all these keybindings. See #19.

from micro.

bendem avatar bendem commented on May 12, 2024 1

@LukeSkyw I understand your feeling, but you're implying that the default keybindings are not sane while they totally make sense from a mac perspective. 😉

I guess providing keybindings for linux and windows couldn't hurt. That would go in a new issue though.

from micro.

mixmastamyk avatar mixmastamyk commented on May 12, 2024 1

The file above should be bindings.json, and to fix the shifted as well:

$ cat >> ~/.config/micro/bindings.json
{
    "AltLeft":        "StartOfLine",
    "AltRight":       "EndOfLine",
    "CtrlLeft":       "WordLeft",
    "CtrlRight":      "WordRight",

    "AltShiftLeft":   "SelectToStartOfLine",
    "AltShiftRight":  "SelectToEndOfLine",
    "CtrlShiftLeft":  "SelectWordLeft",
    "CtrlShiftRight": "SelectWordRight",

    "ShiftLeft":      "SelectLeft",
    "ShiftRight":     "SelectRight",

    "AltUp":         "CursorStart",
    "AltDown":       "CursorEnd",
    "AltShiftUp":    "SelectToStart",
    "AltShiftDown":  "SelectToEnd",
}

from micro.

robinmonjo avatar robinmonjo commented on May 12, 2024 1

Hello, I was having the same (original) issue on Mac OS with Terminal app. The CtrlShiftRight, CtrlShiftLeft, AltShiftRight, AltShiftLeft ... wasn't working (it was supposed to select text), here is how I fixed it:

Based on the mapping here, in preferences > profiles > keyboard you must map the missing key / action pair with what's on the code, by replacing \x1b by \033:

screen shot 2018-08-02 at 17 38 02

from micro.

Red5d avatar Red5d commented on May 12, 2024

Sortof related to this, the Home and End keys don't seem to work yet.

from micro.

slnt avatar slnt commented on May 12, 2024

Tagging onto this, also appreciated would be some Sublime/Atom like commands such as:

Ctrl-l: select line under cursor
Ctrl-d: select word under cursor, subsequent inputs of this will select the next occurrence of the current selection.

Another small nit I have is when selecting text with the mouse, it would be nice if it highlighted as you go rather than when you release the mouse.

Great work, love having this!

from micro.

zyedidia avatar zyedidia commented on May 12, 2024

It should highlight as you go, unless your terminal doesn't support mouse tracking. What terminal are you using?

Also, I'm currently using Ctrl-d for half page down. Does Sublime/Atom have a keybinding for this that I could use instead?

from micro.

slnt avatar slnt commented on May 12, 2024

OS X Terminal.app, but I'm inside of a tmux. Hmmm, works find outside of tmux.

Looks like sublime support keyboard scrolling functionality but don't have key bindings set by default.
Perhaps alt-uparrow and alt-downarrow? Personally that feels a bit more intuitive than ctrl-u and ctrl-d, but just my 2c.

from micro.

slnt avatar slnt commented on May 12, 2024

I think @pscollins has the way of it. :)

from micro.

bentranter avatar bentranter commented on May 12, 2024

@zyedidia do you think it'd be better to try to add more keypress events to tcell, or to look for an alternative solution for dealing with keybindings? I feel like most of these aren't possible until those keybindings are easily detectable. I also do really like @pscollins idea about a config file

from micro.

pscollins avatar pscollins commented on May 12, 2024

I guess the first step towards making it configurable would be defining what actions there should be: move-word-forward, move-word-back, page-up, page-down, etc.

from micro.

zyedidia avatar zyedidia commented on May 12, 2024

Yeah, that's what I was planning on doing. This configuration could go in the ~/.config/micro/settings.json file. For example:

{
    "syntax": true,
    "keybindings": {
        "CtrlC": "copy",
        "CtrlV": "paste"
    }
}

from micro.

zyedidia avatar zyedidia commented on May 12, 2024

A bunch of these keybindings are now supported (using Ctrl instead of Cmd). See #79.

from micro.

bendem avatar bendem commented on May 12, 2024

Using current master (6c99eea) I'm still seeing ctrl+arrows doing nothing and alt+arrows inserting [1;3C or [1;3D.

from micro.

zyedidia avatar zyedidia commented on May 12, 2024

Can you make sure you run make install from the root directory of the project to build. I think you need to update your version of tcell, and make install will do that automatically.

Make sure you use commit 957e97d which has the updated makefile.

from micro.

bendem avatar bendem commented on May 12, 2024

I ran GOPATH=$(pwd) make clean build test to compile. Pretty sure that does it.

from micro.

bendem avatar bendem commented on May 12, 2024

Nevermind, I was on the wrong branch, works fine.

from micro.

zyedidia avatar zyedidia commented on May 12, 2024

Of the bindings on this list, all that are possible have been implemented, so I'm closing this issue as resolved.

Here are the bindings that are implemented:

Movement
Ctrl-UpArrow: Go to start of the file
Ctrl-LeftArrow: Go to start of the line
Ctrl-RightArrow: Go to end of the line
Ctrl-DownArrow: Go to end of the file

Alt-LeftArrow: Go to start of previous word
Alt-RightArrow: Go to start of next word

Selection
Shift-Ctrl-UpArrow: Select from current position to start of the file
Shift-Ctrl-LeftArrow: Select from current position to start of the line
Shift-Ctrl-RightArrow: Select from current position to end of the line
Shift-Ctrl-DownArrow: Select from current position to end of the file

Shift-Alt-LeftArrow: Select from current position to start of previous word
Shift-Alt-RightArrow: Select from current position to start of next word

Deletion
Alt-Backspace: delete until end of previous word

Unfortunately, due to the way terminals work, it is not possible to support these keybindings:

Ctrl-Backspace: Delete until the start of the line
Ctrl-Delete: Delete until the end of the line

Alt-Delete: delete until end of next word

Terminals simply don't send these as their own key events.

from micro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.