Comments (20)
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.
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.
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.
@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.
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.
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
:
from micro.
Sortof related to this, the Home and End keys don't seem to work yet.
from micro.
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.
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.
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.
I think @pscollins has the way of it. :)
from micro.
@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.
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.
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.
A bunch of these keybindings are now supported (using Ctrl
instead of Cmd
). See #79.
from micro.
Using current master (6c99eea) I'm still seeing ctrl+arrows doing nothing and alt+arrows inserting [1;3C
or [1;3D
.
from micro.
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.
I ran GOPATH=$(pwd) make clean build test
to compile. Pretty sure that does it.
from micro.
Nevermind, I was on the wrong branch, works fine.
from micro.
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)
- `Clipboard erorr check` isn't after method that can cause it
- Is it possible to save file to stdin of another program? HOT 1
- Problems with key bindings (using KiTTY) HOT 3
- How to remove the background so it uses the configuration from the terminal? HOT 2
- Pressing `Down` when have "visual multiline selection" moves cursor to the second line of selection instead of end
- [Feature request]: autocomplete filetypes
- Help using func (*Buffer) FindNext HOT 2
- `SetActive` doesn't properly work (at least in plugins) HOT 2
- Help using WriteLog() function HOT 7
- Micro do not save file and reopen old file HOT 17
- Does log pane must have one instance? HOT 6
- Micro uses foot's `bright7` color instead of `default` listed in color scheme file HOT 11
- Copy & Copy as HTML disabled in menu HOT 1
- [Feature request]: Duplicate lazy line selection HOT 2
- [Question] How to write a complete for a command
- Weird multiline text pasting into info window
- Micro does not respnoe when edit specific file HOT 2
- "go install" is not working
- Micro ignores external plugins. HOT 2
- Micro cannot open files with colon in their name HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro.