Compare commits

...

12 Commits

Author SHA1 Message Date
Zachary Yedidia
fb258dd57a Clean default settings in micro -clean 2020-06-18 17:22:21 -04:00
Zachary Yedidia
891b117a33 Bind Ctrl-/ (CtrlUnderscore) in comment plugin 2020-06-18 17:18:34 -04:00
Zachary Yedidia
f5dc0a51ba Fix issue with search and replace at the end of a range 2020-06-18 16:38:10 -04:00
Zachary Yedidia
8cbe7fa92b Update tcell version 2020-06-17 23:24:53 -04:00
Zachary Yedidia
a584ff36de Merge 2020-06-17 23:14:03 -04:00
Zachary Yedidia
f5405cee18 Improve keybinding label consistency
The old notation (for example `CtrlG`) causes confusion when combined
with new notation needed for alt (`Alt-g`) due to Alt being case
sensitive. Previously both formats were supported, but the documentation
and defaults used a combination. This commit only uses the new notation
for consistency.

Ref #1470
2020-06-17 23:11:50 -04:00
Zachary Yedidia
3516c8a9a6 Start replacement search at cursor location
Fixes #1731
2020-06-17 22:43:22 -04:00
Matthias
c19dce87e4 Fix typo in defaultkeys (#1730) 2020-06-17 13:35:59 -04:00
Zachary Yedidia
2adba18159 Don't move nightly tag 2020-06-17 00:48:17 +00:00
Zachary Yedidia
f9f2ef02ac Edit nightly release instead of replacing 2020-06-16 20:33:59 -04:00
Zachary Yedidia
0976eb3e51 Cross compile binaries in release scripts 2020-06-16 19:55:12 -04:00
Zachary Yedidia
ac2d1491ff Use hub for creating releases 2020-06-16 19:55:12 -04:00
20 changed files with 285 additions and 575 deletions

View File

@@ -41,6 +41,9 @@ func CleanConfig() {
return
}
fmt.Println("Cleaning default settings")
config.WriteSettings(filepath.Join(config.ConfigDir, "settings.json"))
// detect unused options
var unusedOptions []string
defaultSettings := config.DefaultAllSettings()

2
go.mod
View File

@@ -17,7 +17,7 @@ require (
github.com/zyedidia/highlight v0.0.0-20170330143449-201131ce5cf5
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d
github.com/zyedidia/pty v2.0.0+incompatible // indirect
github.com/zyedidia/tcell v1.4.6
github.com/zyedidia/tcell v1.4.7
github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415
golang.org/x/text v0.3.2
gopkg.in/sourcemap.v1 v1.0.5 // indirect

14
go.sum
View File

@@ -12,8 +12,6 @@ github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdk
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -23,8 +21,6 @@ github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tW
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/p-e-w/go-runewidth v0.0.10-0.20200613030200-3e1705c5c059 h1:/+h2b6i15wh4EWsFkfdNdBE1jjGA872tpXEyhPM5aYg=
@@ -42,8 +38,6 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0=
github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
github.com/zyedidia/clipboard v0.0.0-20190823154308-241f98e9b197 h1:gYTNnAW6azuB3BbA6QYWO/H4F2ABSOjjw3Z03tlXd2c=
github.com/zyedidia/clipboard v0.0.0-20190823154308-241f98e9b197/go.mod h1:WDk3p8GiZV9+xFWlSo8qreeoLhW6Ik692rqXk+cNeRY=
github.com/zyedidia/clipboard v0.0.0-20200421031010-7c45b8673834 h1:0nOfq3JwYRiY3+nwfWVQYEaXDmGCQgj3RKoqTifLzP4=
github.com/zyedidia/clipboard v0.0.0-20200421031010-7c45b8673834/go.mod h1:zykFnZUXX0ErxqvYLUFEq7QDJKId8rmh2FgD0/Y8cjA=
github.com/zyedidia/glob v0.0.0-20170209203856-dd4023a66dc3 h1:oMHjjTLfGXVuyOQBYj5/td9WC0mw4g1xDBPovIqmHew=
@@ -58,12 +52,8 @@ github.com/zyedidia/poller v1.0.1 h1:Tt9S3AxAjXwWGNiC2TUdRJkQDZSzCBNVQ4xXiQ7440s
github.com/zyedidia/poller v1.0.1/go.mod h1:vZXJOHGDcuK08GXhF6IAY0ZFd2WcgOR5DOTp84Uk5eE=
github.com/zyedidia/pty v2.0.0+incompatible h1:Ou5vXL6tvjst+RV8sUFISbuKDnUJPhnpygApMFGweqw=
github.com/zyedidia/pty v2.0.0+incompatible/go.mod h1:4y9l9yJZNxRa7GB/fB+mmDmGkG3CqmzLf4vUxGGotEA=
github.com/zyedidia/tcell v1.4.4 h1:o34LXujNuSueuyTy+5eoQW+rQr8g0UbY8k1NczZyskQ=
github.com/zyedidia/tcell v1.4.4/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA=
github.com/zyedidia/tcell v1.4.5 h1:JFmOiWLxr3Fsk2vjRL3n8oRUoJeyrazGhkhZqW31kEY=
github.com/zyedidia/tcell v1.4.5/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA=
github.com/zyedidia/tcell v1.4.6 h1:8OYvZpUyqYQ3nigenBwOtnY3fXWEHekbm6QYchBeOxs=
github.com/zyedidia/tcell v1.4.6/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA=
github.com/zyedidia/tcell v1.4.7 h1:bKXRjv8RglPyOFqofzUUJkrdsLs9p9mT89W2ShFFlco=
github.com/zyedidia/tcell v1.4.7/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA=
github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415 h1:752dTQ5OatJ9M5ULK2+9lor+nzyZz+LYDo3WGngg3Rc=
github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415/go.mod h1:8leT8G0Cm8NoJHdrrKHyR9MirWoF4YW7pZh06B6H+1E=
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@@ -805,7 +805,7 @@ func (h *BufPane) ReplaceCmd(args []string) {
return l.GreaterEqual(start) && l.LessEqual(end)
}
searchLoc := start
searchLoc := h.Cursor.Loc
var doReplacement func()
doReplacement = func() {
locs, found, err := h.Buf.FindNext(search, start, end, searchLoc, true, !noRegex)
@@ -816,6 +816,7 @@ func (h *BufPane) ReplaceCmd(args []string) {
if !found || !inRange(locs[0]) || !inRange(locs[1]) {
h.Cursor.ResetSelection()
h.Buf.RelocateCursors()
return
}
@@ -831,7 +832,9 @@ func (h *BufPane) ReplaceCmd(args []string) {
searchLoc = locs[0]
searchLoc.X += nrunes + locs[0].Diff(locs[1], h.Buf)
end.Move(nrunes, h.Buf)
if end.Y == locs[1].Y {
end = end.Move(nrunes, h.Buf)
}
h.Cursor.Loc = searchLoc
nreplaced++
} else if !canceled && !yes {

View File

@@ -30,28 +30,28 @@ func DefaultBindings() map[string]string {
"Alt-{": "ParagraphPrevious",
"Alt-}": "ParagraphNext",
"Enter": "InsertNewline",
"CtrlH": "Backspace",
"Ctrl-h": "Backspace",
"Backspace": "Backspace",
"Alt-CtrlH": "DeleteWordLeft",
"Alt-Backspace": "DeleteWordLeft",
"Tab": "Autocomplete|IndentSelection|InsertTab",
"Backtab": "CycleAutocompleteBack|OutdentSelection|OutdentLine",
"CtrlO": "OpenFile",
"CtrlS": "Save",
"CtrlF": "Find",
"CtrlN": "FindNext",
"CtrlP": "FindPrevious",
"CtrlZ": "Undo",
"CtrlY": "Redo",
"CtrlC": "CopyLine|Copy",
"CtrlX": "Cut",
"CtrlK": "CutLine",
"CtrlD": "DuplicateLine",
"CtrlV": "Paste",
"CtrlA": "SelectAll",
"CtrlT": "AddTab",
"Alt,": "PreviousTab",
"Alt.": "NextTab",
"Ctrl-o": "OpenFile",
"Ctrl-s": "Save",
"Ctrl-f": "Find",
"Ctrl-n": "FindNext",
"Ctrl-p": "FindPrevious",
"Ctrl-z": "Undo",
"Ctrl-y": "Redo",
"Ctrl-c": "CopyLine|Copy",
"Ctrl-x": "Cut",
"Ctrl-k": "CutLine",
"Ctrl-d": "DuplicateLine",
"Ctrl-v": "Paste",
"Ctrl-a": "SelectAll",
"Ctrl-t": "AddTab",
"Alt-,": "PreviousTab",
"Alt-.": "NextTab",
"Home": "StartOfTextToggle",
"End": "EndOfLine",
"CtrlHome": "CursorStart",
@@ -60,17 +60,17 @@ func DefaultBindings() map[string]string {
"PageDown": "CursorPageDown",
"CtrlPageUp": "PreviousTab",
"CtrlPageDown": "NextTab",
"CtrlG": "ToggleHelp",
"Ctrl-g": "ToggleHelp",
"Alt-g": "ToggleKeyMenu",
"CtrlR": "ToggleRuler",
"CtrlL": "command-edit:goto ",
"Ctrl-r": "ToggleRuler",
"Ctrl-l": "command-edit:goto ",
"Delete": "Delete",
"CtrlB": "ShellMode",
"CtrlQ": "Quit",
"CtrlE": "CommandMode",
"CtrlW": "NextSplit",
"CtrlU": "ToggleMacro",
"CtrlJ": "PlayMacro",
"Ctrl-b": "ShellMode",
"Ctrl-q": "Quit",
"Ctrl-e": "CommandMode",
"Ctrl-w": "NextSplit",
"Ctrl-u": "ToggleMacro",
"Ctrl-j": "PlayMacro",
"Insert": "ToggleOverwriteMode",
// Emacs-style keybindings

View File

@@ -32,28 +32,28 @@ func DefaultBindings() map[string]string {
"Alt-{": "ParagraphPrevious",
"Alt-}": "ParagraphNext",
"Enter": "InsertNewline",
"CtrlH": "Backspace",
"Ctrl-h": "Backspace",
"Backspace": "Backspace",
"Alt-CtrlH": "DeleteWordLeft",
"Alt-Backspace": "DeleteWordLeft",
"Tab": "Autocomplete|IndentSelection|InsertTab",
"Backtab": "CycleAutocompleteBack|OutdentSelection|OutdentLine",
"CtrlO": "OpenFile",
"CtrlS": "Save",
"CtrlF": "Find",
"CtrlN": "FindNext",
"CtrlP": "FindPrevious",
"CtrlZ": "Undo",
"CtrlY": "Redo",
"CtrlC": "CopyLine|Copy",
"CtrlX": "Cut",
"CtrlK": "CutLine",
"CtrlD": "DuplicateLine",
"CtrlV": "Paste",
"CtrlA": "SelectAll",
"CtrlT": "AddTab",
"Alt,": "PreviousTab",
"Alt.": "NextTab",
"Ctrl-o": "OpenFile",
"Ctrl-s": "Save",
"Ctrl-f": "Find",
"Ctrl-n": "FindNext",
"Ctrl-p": "FindPrevious",
"Ctrl-z": "Undo",
"Ctrl-y": "Redo",
"Ctrl-c": "CopyLine|Copy",
"Ctrl-x": "Cut",
"Ctrl-k": "CutLine",
"Ctrl-d": "DuplicateLine",
"Ctrl-v": "Paste",
"Ctrl-a": "SelectAll",
"Ctrl-t": "AddTab",
"Alt-,": "PreviousTab",
"Alt-.": "NextTab",
"Home": "StartOfTextToggle",
"End": "EndOfLine",
"CtrlHome": "CursorStart",
@@ -62,17 +62,17 @@ func DefaultBindings() map[string]string {
"PageDown": "CursorPageDown",
"CtrlPageUp": "PreviousTab",
"CtrlPageDown": "NextTab",
"CtrlG": "ToggleHelp",
"Ctrl-g": "ToggleHelp",
"Alt-g": "ToggleKeyMenu",
"CtrlR": "ToggleRuler",
"CtrlL": "command-edit:goto ",
"Ctrl-r": "ToggleRuler",
"Ctrl-l": "command-edit:goto ",
"Delete": "Delete",
"CtrlB": "ShellMode",
"CtrlQ": "Quit",
"CtrlE": "CommandMode",
"CtrlW": "NextSplit",
"CtrlU": "ToggleMacro",
"CtrlJ": "PlayMacro",
"Ctrl-b": "ShellMode",
"Ctrl-q": "Quit",
"Ctrl-e": "CommandMode",
"Ctrl-w": "NextSplit",
"Ctrl-u": "ToggleMacro",
"Ctrl-j": "PlayMacro",
"Insert": "ToggleOverwriteMode",
// Emacs-style keybindings

View File

@@ -7,6 +7,13 @@ import (
)
func (b *Buffer) findDown(r *regexp.Regexp, start, end Loc) ([2]Loc, bool) {
lastcn := util.CharacterCount(b.LineBytes(b.LinesNum() - 1))
if start.Y > b.LinesNum()-1 {
start.X = lastcn - 1
}
if end.Y > b.LinesNum()-1 {
end.X = lastcn
}
start.Y = util.Clamp(start.Y, 0, b.LinesNum()-1)
end.Y = util.Clamp(end.Y, 0, b.LinesNum()-1)
@@ -48,6 +55,13 @@ func (b *Buffer) findDown(r *regexp.Regexp, start, end Loc) ([2]Loc, bool) {
}
func (b *Buffer) findUp(r *regexp.Regexp, start, end Loc) ([2]Loc, bool) {
lastcn := util.CharacterCount(b.LineBytes(b.LinesNum() - 1))
if start.Y > b.LinesNum()-1 {
start.X = lastcn - 1
}
if end.Y > b.LinesNum()-1 {
end.X = lastcn
}
start.Y = util.Clamp(start.Y, 0, b.LinesNum()-1)
end.Y = util.Clamp(end.Y, 0, b.LinesNum()-1)
@@ -132,7 +146,7 @@ func (b *Buffer) FindNext(s string, start, end, from Loc, down bool, useRegex bo
// ReplaceRegex replaces all occurrences of 'search' with 'replace' in the given area
// and returns the number of replacements made and the number of runes
// added or removed
// added or removed on the last line of the range
func (b *Buffer) ReplaceRegex(start, end Loc, search *regexp.Regexp, replace []byte) (int, int) {
if start.GreaterThan(end) {
start, end = end, start
@@ -162,7 +176,9 @@ func (b *Buffer) ReplaceRegex(start, end Loc, search *regexp.Regexp, replace []b
result = search.Expand(result, replace, in, submatches)
}
found++
netrunes += util.CharacterCount(in) - util.CharacterCount(result)
if i == end.Y {
netrunes += util.CharacterCount(result) - util.CharacterCount(in)
}
return result
})

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@ This help page aims to cover two aspects of micro's syntax highlighting engine:
## Colorschemes
To change your colorscheme, press CtrlE in micro to bring up the command
To change your colorscheme, press Ctrl-e in micro to bring up the command
prompt, and type:
```

View File

@@ -1,6 +1,6 @@
# Command bar
The command bar is opened by pressing CtrlE. It is a single-line buffer,
The command bar is opened by pressing Ctrl-e. It is a single-line buffer,
meaning that all keybindings from a normal buffer are supported (as well
as mouse and selection).
@@ -13,7 +13,7 @@ does not look up environment variables.
# Commands
Micro provides the following commands that can be executed at the command-bar
by pressing `CtrlE` and entering the command. Arguments are placed in single
by pressing `Ctrl-e` and entering the command. Arguments are placed in single
quotes here but these are not necessary when entering the command in micro.
* `bind 'key' 'action'`: creates a keybinding from key to action. See the
@@ -109,7 +109,7 @@ quotes here but these are not necessary when entering the command in micro.
is most useful for debugging keybindings.
* `showkey`: Show the action(s) bound to a given key. For example
running `> showkey CtrlC` will display `Copy`.
running `> showkey Ctrl-c` will display `Copy`.
* `term exec?`: Open a terminal emulator running the given executable. If no
executable is given, this will open the default shell in the terminal

View File

@@ -80,7 +80,7 @@ can change it!
| Ctrl-z | Undo |
| Ctrl-y | Redo |
| Alt-UpArrow | Move current line or selected lines up |
| Alt-DownArrow | Move current line of selected lines down |
| Alt-DownArrow | Move current line or selected lines down |
| Alt-Backspace or Alt-Ctrl-h | Delete word left |
| Ctrl-a | Select all |

View File

@@ -4,9 +4,9 @@ Micro is a terminal-based text editor that aims to be easy to use and
intuitive, while also taking advantage of the full capabilities of modern
terminals.
To open the command bar, press CtrlE. This enables a `>` prompt for typing
To open the command bar, press Ctrl-e. This enables a `>` prompt for typing
commands. From now on when the documentation says to run a command such as `>
help`, this means press CtrlE and type `help` (and press enter to execute the
help`, this means press Ctrl-e and type `help` (and press enter to execute the
command).
For a list of the default keybindings run `> help defaultkeys`.
@@ -14,7 +14,7 @@ For more information on keybindings see `> help keybindings`.
## Quick-start
Press Ctrl-q to quit, and Ctrl-s to save. Press CtrlE to start typing commands
Press Ctrl-q to quit, and Ctrl-s to save. Press Ctrl-e to start typing commands
and you can see which commands are available by pressing tab, or by viewing the
help topic `> help commands`.
@@ -34,7 +34,7 @@ Press Ctrl-w to move between splits, and type `> vsplit filename` or
Micro has a built-in help system which can be accessed with the `help` command.
To use it, press CtrlE to access command mode and type in `help` followed by a
To use it, press Ctrl-e to access command mode and type in `help` followed by a
topic. Typing `help` followed by nothing will open this page.
Here are the possible help topics that you can read:

View File

@@ -30,11 +30,17 @@ following in the `bindings.json` file.
```json
{
"CtrlY": "Undo",
"CtrlZ": "Redo"
"Ctrl-y": "Undo",
"Ctrl-z": "Redo"
}
```
**Note:** The syntax `<Modifier><key>` is equivalent to `<Modifier>-<key>`. In
addition, Ctrl-Shift bindings are not supported by terminals, and are the same
as simply Ctrl bindings. This means that `CtrlG`, `Ctrl-G`, and `Ctrl-g` all
mean the same thing. However, for Alt this is not the case: `AltG` and `Alt-G`
mean `Alt-Shift-g`, while `Alt-g` does not require the Shift modifier.
In addition to editing your `~/.config/micro/bindings.json`, you can run
`>bind <keycombo> <action>` For a list of bindable actions, see below.
@@ -85,15 +91,15 @@ your working directory in the infobar.
You can also bind an "editable" command with `command-edit:`. This means that
micro won't immediately execute the command when you press the binding, but
instead just place the string in the infobar in command mode. For example,
you could rebind `CtrlG` to `> help`:
you could rebind `Ctrl-g` to `> help`:
```json
{
"CtrlG": "command-edit:help "
"Ctrl-g": "command-edit:help "
}
```
Now when you press `CtrlG`, `help` will appear in the command bar and your
Now when you press `Ctrl-g`, `help` will appear in the command bar and your
cursor will be placed after it (note the space in the json that controls the
cursor placement).
@@ -357,32 +363,32 @@ F62
F63
F64
CtrlSpace
CtrlA
CtrlB
CtrlC
CtrlD
CtrlE
CtrlF
CtrlG
CtrlH
CtrlI
CtrlJ
CtrlK
CtrlL
CtrlM
CtrlN
CtrlO
CtrlP
CtrlQ
CtrlR
CtrlS
CtrlT
CtrlU
CtrlV
CtrlW
CtrlX
CtrlY
CtrlZ
Ctrl-a
Ctrl-b
Ctrl-c
Ctrl-d
Ctrl-e
Ctrl-f
Ctrl-g
Ctrl-h
Ctrl-i
Ctrl-j
Ctrl-k
Ctrl-l
Ctrl-m
Ctrl-n
Ctrl-o
Ctrl-p
Ctrl-q
Ctrl-r
Ctrl-s
Ctrl-t
Ctrl-u
Ctrl-v
Ctrl-w
Ctrl-x
Ctrl-y
Ctrl-z
CtrlLeftSq
CtrlBackslash
CtrlRightSq
@@ -450,28 +456,28 @@ conventions for text editing defaults.
"Alt-{": "ParagraphPrevious",
"Alt-}": "ParagraphNext",
"Enter": "InsertNewline",
"CtrlH": "Backspace",
"Ctrl-h": "Backspace",
"Backspace": "Backspace",
"Alt-CtrlH": "DeleteWordLeft",
"Alt-Backspace": "DeleteWordLeft",
"Tab": "Autocomplete|IndentSelection|InsertTab",
"Backtab": "OutdentSelection|OutdentLine",
"CtrlO": "OpenFile",
"CtrlS": "Save",
"CtrlF": "Find",
"CtrlN": "FindNext",
"CtrlP": "FindPrevious",
"CtrlZ": "Undo",
"CtrlY": "Redo",
"CtrlC": "CopyLine|Copy",
"CtrlX": "Cut",
"CtrlK": "CutLine",
"CtrlD": "DuplicateLine",
"CtrlV": "Paste",
"CtrlA": "SelectAll",
"CtrlT": "AddTab",
"Alt,": "PreviousTab",
"Alt.": "NextTab",
"Ctrl-o": "OpenFile",
"Ctrl-s": "Save",
"Ctrl-f": "Find",
"Ctrl-n": "FindNext",
"Ctrl-p": "FindPrevious",
"Ctrl-z": "Undo",
"Ctrl-y": "Redo",
"Ctrl-c": "CopyLine|Copy",
"Ctrl-x": "Cut",
"Ctrl-k": "CutLine",
"Ctrl-d": "DuplicateLine",
"Ctrl-v": "Paste",
"Ctrl-a": "SelectAll",
"Ctrl-t": "AddTab",
"Alt-,": "PreviousTab",
"Alt-.": "NextTab",
"Home": "StartOfText",
"End": "EndOfLine",
"CtrlHome": "CursorStart",
@@ -480,17 +486,17 @@ conventions for text editing defaults.
"PageDown": "CursorPageDown",
"CtrlPageUp": "PreviousTab",
"CtrlPageDown": "NextTab",
"CtrlG": "ToggleHelp",
"Ctrl-g": "ToggleHelp",
"Alt-g": "ToggleKeyMenu",
"CtrlR": "ToggleRuler",
"CtrlL": "command-edit:goto ",
"Ctrl-r": "ToggleRuler",
"Ctrl-l": "command-edit:goto ",
"Delete": "Delete",
"CtrlB": "ShellMode",
"CtrlQ": "Quit",
"CtrlE": "CommandMode",
"CtrlW": "NextSplit",
"CtrlU": "ToggleMacro",
"CtrlJ": "PlayMacro",
"Ctrl-b": "ShellMode",
"Ctrl-q": "Quit",
"Ctrl-e": "CommandMode",
"Ctrl-w": "NextSplit",
"Ctrl-u": "ToggleMacro",
"Ctrl-j": "PlayMacro",
"Insert": "ToggleOverwriteMode",
// Emacs-style keybindings
@@ -526,7 +532,7 @@ conventions for text editing defaults.
## Final notes
Note: On some old terminal emulators and on Windows machines, `CtrlH` should be
Note: On some old terminal emulators and on Windows machines, `Ctrl-h` should be
used for backspace.
Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a` or

View File

@@ -16,8 +16,8 @@ the settings and their values. To change an option, you can either change the
value in the `settings.json` file, or you can type it in directly while using
micro.
Press CtrlE to go to command mode, and type `set option value` (in the
future, I will use `> set option value` to indicate pressing CtrlE). The change
Press Ctrl-e to go to command mode, and type `set option value` (in the
future, I will use `> set option value` to indicate pressing Ctrl-e). The change
will take effect immediately and will also be saved to the `settings.json` file
so that the setting will stick even after you close micro.
@@ -48,12 +48,12 @@ If you would like to know more about all the available options, see the
Keybindings work in much the same way as options. You configure them using the
`~/.config/micro/bindings.json` file.
For example if you would like to bind `CtrlR` to redo you could put the
For example if you would like to bind `Ctrl-r` to redo you could put the
following in `bindings.json`:
```json
{
"CtrlR": "redo"
"Ctrl-r": "redo"
}
```
@@ -74,7 +74,7 @@ micro starts and is essentially a one-file plugin. The plugin name is
`initlua`.
This example will show you how to use the `init.lua` file by creating a binding
to `CtrlR` which will execute the bash command `go run` on the current file,
to `Ctrl-r` which will execute the bash command `go run` on the current file,
given that the current file is a Go file.
You can do that by putting the following in `init.lua`:
@@ -84,9 +84,9 @@ local config = import("micro/config")
local shell = import("micro/shell")
function init()
-- true means overwrite any existing binding to CtrlR
-- true means overwrite any existing binding to Ctrl-r
-- this will modify the bindings.json file
config.TryBindKey("CtrlR", "lua:initlua.gorun", true)
config.TryBindKey("Ctrl-r", "lua:initlua.gorun", true)
end
function gorun(bp)
@@ -104,7 +104,7 @@ the `bindings.json` file:
```json
{
"CtrlR": "lua:initlua.gorun"
"Ctrl-r": "lua:initlua.gorun"
}
```

View File

@@ -143,5 +143,6 @@ end
function init()
config.MakeCommand("comment", comment, config.NoComplete)
config.TryBindKey("Alt-/", "lua:comment.comment", false)
config.TryBindKey("CtrlUnderscore", "lua:comment.comment", false)
config.AddRuntimeFile("comment", config.RTHelp, "help/comment.md")
end

View File

@@ -1,8 +1,10 @@
# Comment Plugin
The comment plugin provides auto commenting/uncommenting.
The default binding to comment/uncomment a line is `Alt-/`,
but you can easily modify that in your `bindings.json` file:
The default binding to comment/uncomment a line is `Alt-/`
and `CtrlUnderscore`, which is equivalent in most terminals
to `Ctrl-/`. You can easily modify that in your `bindings.json`
file:
```json
{

View File

@@ -1,161 +1,43 @@
# This script creates the nightly release on Github for micro
# You must have the correct Github access token to run this script
# Must be run from inside the micro git repository
commitID=$(git rev-parse HEAD)
info=$(github-release info -u zyedidia -r micro -t nightly)
commitID=$(git rev-parse --short HEAD)
# info=$(github-release info -u zyedidia -r micro -t nightly)
if [[ $info = *$commitID* ]]; then
echo "No new commits since last nightly"
exit 1
fi
# if [[ $info = *$commitID* ]]; then
# echo "No new commits since last nightly"
# exit 1
# fi
echo "Deleting old release"
github-release delete \
--user zyedidia \
--repo micro \
--tag nightly
go run remove-nightly-assets.go
echo "Moving tag"
git tag --force nightly $commitID
git push --force --tags
echo "Creating new release"
github-release release \
--user zyedidia \
--repo micro \
--tag nightly \
--name "Nightly build" \
--description "Autogenerated nightly build of micro. If you don't see anything here that probably means it's building right now!" \
--pre-release
# echo "Moving tag"
# hub push origin :refs/tags/nightly
# git tag -f nightly $commitID
# hub push --tags
echo "Cross compiling binaries"
./cross-compile.sh $1
mv ../binaries .
echo "Uploading OSX binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-osx.tar.gz" \
--file binaries/micro-$1-osx.tar.gz
MESSAGE=$'Nightly build\n\nAutogenerated nightly build of micro'
echo "Uploading Linux 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-linux64.tar.gz" \
--file binaries/micro-$1-linux64.tar.gz
echo "Uploading Linux 64 static binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-linux64-static.tar.gz" \
--file binaries/micro-$1-linux64-static.tar.gz
echo "Uploading Linux 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-linux32.tar.gz" \
--file binaries/micro-$1-linux32.tar.gz
echo "Uploading Linux Arm 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-linux-arm.tar.gz" \
--file binaries/micro-$1-linux-arm.tar.gz
echo "Uploading Linux Arm 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-linux-arm64.tar.gz" \
--file binaries/micro-$1-linux-arm64.tar.gz
echo "Uploading FreeBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-freebsd64.tar.gz" \
--file binaries/micro-$1-freebsd64.tar.gz
echo "Uploading FreeBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-freebsd32.tar.gz" \
--file binaries/micro-$1-freebsd32.tar.gz
echo "Uploading OpenBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-openbsd64.tar.gz" \
--file binaries/micro-$1-openbsd64.tar.gz
echo "Uploading OpenBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-openbsd32.tar.gz" \
--file binaries/micro-$1-openbsd32.tar.gz
echo "Uploading NetBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-netbsd64.tar.gz" \
--file binaries/micro-$1-netbsd64.tar.gz
echo "Uploading NetBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-netbsd32.tar.gz" \
--file binaries/micro-$1-netbsd32.tar.gz
echo "Uploading Windows 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-win64.zip" \
--file binaries/micro-$1-win64.zip
echo "Uploading Windows 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag nightly \
--name "micro-$1-win32.zip" \
--file binaries/micro-$1-win32.zip
# echo "Uploading vendored tarball"
# github-release upload \
# --user zyedidia \
# --repo micro \
# --tag nightly \
# --name "micro-$1-src.tar.gz" \
# --file binaries/micro-$1-src.tar.gz
#
# echo "Uploading vendored zip"
# github-release upload \
# --user zyedidia \
# --repo micro \
# --tag nightly \
# --name "micro-$1-src.zip" \
# --file binaries/micro-$1-src.zip
echo "Creating new release"
hub release edit nightly \
--prerelease \
--draft=false \
--message "$MESSAGE. Assets uploaded on $(date) for commit $commitID." \
--attach "binaries/micro-$1-osx.tar.gz" \
--attach "binaries/micro-$1-linux64.tar.gz" \
--attach "binaries/micro-$1-linux64-static.tar.gz" \
--attach "binaries/micro-$1-linux32.tar.gz" \
--attach "binaries/micro-$1-linux-arm.tar.gz" \
--attach "binaries/micro-$1-linux-arm64.tar.gz" \
--attach "binaries/micro-$1-freebsd64.tar.gz" \
--attach "binaries/micro-$1-freebsd32.tar.gz" \
--attach "binaries/micro-$1-openbsd64.tar.gz" \
--attach "binaries/micro-$1-openbsd32.tar.gz" \
--attach "binaries/micro-$1-netbsd64.tar.gz" \
--attach "binaries/micro-$1-netbsd32.tar.gz" \
--attach "binaries/micro-$1-win64.zip" \
--attach "binaries/micro-$1-win32.zip"

View File

@@ -8,145 +8,29 @@ tag="v$1"
echo "Creating tag"
git tag $tag $commitID
git push --tags
echo "Creating new release"
github-release release \
--user zyedidia \
--repo micro \
--tag $tag \
--name "$1" \
--description "$2" \
--pre-release
hub push --tags
echo "Cross compiling binaries"
./cross-compile.sh $1
mv ../binaries .
echo "Uploading OSX binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-osx.tar.gz" \
--file binaries/micro-$1-osx.tar.gz
NL=$'\n'
echo "Uploading Linux 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux64.tar.gz" \
--file binaries/micro-$1-linux64.tar.gz
echo "Uploading Linux 64 static binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux64-static.tar.gz" \
--file binaries/micro-$1-linux64-static.tar.gz
echo "Uploading Linux 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux32.tar.gz" \
--file binaries/micro-$1-linux32.tar.gz
echo "Uploading Linux Arm 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux-arm.tar.gz" \
--file binaries/micro-$1-linux-arm.tar.gz
echo "Uploading Linux Arm 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux-arm64.tar.gz" \
--file binaries/micro-$1-linux-arm64.tar.gz
echo "Uploading FreeBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-freebsd64.tar.gz" \
--file binaries/micro-$1-freebsd64.tar.gz
echo "Uploading FreeBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-freebsd32.tar.gz" \
--file binaries/micro-$1-freebsd32.tar.gz
echo "Uploading OpenBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-openbsd64.tar.gz" \
--file binaries/micro-$1-openbsd64.tar.gz
echo "Uploading OpenBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-openbsd32.tar.gz" \
--file binaries/micro-$1-openbsd32.tar.gz
echo "Uploading NetBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-netbsd64.tar.gz" \
--file binaries/micro-$1-netbsd64.tar.gz
echo "Uploading NetBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-netbsd32.tar.gz" \
--file binaries/micro-$1-netbsd32.tar.gz
echo "Uploading Windows 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-win64.zip" \
--file binaries/micro-$1-win64.zip
echo "Uploading Windows 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-win32.zip" \
--file binaries/micro-$1-win32.zip
# echo "Uploading vendored tarball"
# github-release upload \
# --user zyedidia \
# --repo micro \
# --tag $tag \
# --name "micro-$1-src.tar.gz" \
# --file binaries/micro-$1-src.tar.gz
#
# echo "Uploading vendored zip"
# github-release upload \
# --user zyedidia \
# --repo micro \
# --tag $tag \
# --name "micro-$1-src.zip" \
# --file binaries/micro-$1-src.zip
echo "Creating new release"
hub release create $tag \
--prerelease \
--message "$1${NL}${NL}$2" \
--attach "binaries/micro-$1-osx.tar.gz" \
--attach "binaries/micro-$1-linux64.tar.gz" \
--attach "binaries/micro-$1-linux64-static.tar.gz" \
--attach "binaries/micro-$1-linux32.tar.gz" \
--attach "binaries/micro-$1-linux-arm.tar.gz" \
--attach "binaries/micro-$1-linux-arm64.tar.gz" \
--attach "binaries/micro-$1-freebsd64.tar.gz" \
--attach "binaries/micro-$1-freebsd32.tar.gz" \
--attach "binaries/micro-$1-openbsd64.tar.gz" \
--attach "binaries/micro-$1-openbsd32.tar.gz" \
--attach "binaries/micro-$1-netbsd64.tar.gz" \
--attach "binaries/micro-$1-netbsd32.tar.gz" \
--attach "binaries/micro-$1-win64.zip" \
--attach "binaries/micro-$1-win32.zip"

View File

@@ -8,144 +8,28 @@ tag="v$1"
echo "Creating tag"
git tag $tag $commitID
git push --tags
hub push --tags
echo "Creating new release"
github-release release \
--user zyedidia \
--repo micro \
--tag $tag \
--name "$1" \
--description "$2" \
NL=$'\n'
echo "Cross compiling binaries"
./cross-compile.sh $1
mv ../binaries .
echo "Uploading OSX binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-osx.tar.gz" \
--file binaries/micro-$1-osx.tar.gz
echo "Uploading Linux 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux64.tar.gz" \
--file binaries/micro-$1-linux64.tar.gz
echo "Uploading Linux 64 static binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux64-static.tar.gz" \
--file binaries/micro-$1-linux64-static.tar.gz
echo "Uploading Linux 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux32.tar.gz" \
--file binaries/micro-$1-linux32.tar.gz
echo "Uploading Linux Arm 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux-arm.tar.gz" \
--file binaries/micro-$1-linux-arm.tar.gz
echo "Uploading Linux Arm 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-linux-arm64.tar.gz" \
--file binaries/micro-$1-linux-arm64.tar.gz
echo "Uploading FreeBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-freebsd64.tar.gz" \
--file binaries/micro-$1-freebsd64.tar.gz
echo "Uploading FreeBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-freebsd32.tar.gz" \
--file binaries/micro-$1-freebsd32.tar.gz
echo "Uploading OpenBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-openbsd64.tar.gz" \
--file binaries/micro-$1-openbsd64.tar.gz
echo "Uploading OpenBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-openbsd32.tar.gz" \
--file binaries/micro-$1-openbsd32.tar.gz
echo "Uploading NetBSD 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-netbsd64.tar.gz" \
--file binaries/micro-$1-netbsd64.tar.gz
echo "Uploading NetBSD 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-netbsd32.tar.gz" \
--file binaries/micro-$1-netbsd32.tar.gz
echo "Uploading Windows 64 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-win64.zip" \
--file binaries/micro-$1-win64.zip
echo "Uploading Windows 32 binary"
github-release upload \
--user zyedidia \
--repo micro \
--tag $tag \
--name "micro-$1-win32.zip" \
--file binaries/micro-$1-win32.zip
# echo "Uploading vendored tarball"
# github-release upload \
# --user zyedidia \
# --repo micro \
# --tag $tag \
# --name "micro-$1-src.tar.gz" \
# --file binaries/micro-$1-src.tar.gz
#
# echo "Uploading vendored zip"
# github-release upload \
# --user zyedidia \
# --repo micro \
# --tag $tag \
# --name "micro-$1-src.zip" \
# --file binaries/micro-$1-src.zip
echo "Creating new release"
hub release create $tag \
--message "$1${NL}${NL}$2" \
--attach "binaries/micro-$1-osx.tar.gz" \
--attach "binaries/micro-$1-linux64.tar.gz" \
--attach "binaries/micro-$1-linux64-static.tar.gz" \
--attach "binaries/micro-$1-linux32.tar.gz" \
--attach "binaries/micro-$1-linux-arm.tar.gz" \
--attach "binaries/micro-$1-linux-arm64.tar.gz" \
--attach "binaries/micro-$1-freebsd64.tar.gz" \
--attach "binaries/micro-$1-freebsd32.tar.gz" \
--attach "binaries/micro-$1-openbsd64.tar.gz" \
--attach "binaries/micro-$1-openbsd32.tar.gz" \
--attach "binaries/micro-$1-netbsd64.tar.gz" \
--attach "binaries/micro-$1-netbsd32.tar.gz" \
--attach "binaries/micro-$1-win64.zip" \
--attach "binaries/micro-$1-win32.zip"

View File

@@ -0,0 +1,39 @@
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os/exec"
"strings"
"github.com/zyedidia/json5"
)
func main() {
resp, err := http.Get("https://api.github.com/repos/zyedidia/micro/releases")
if err != nil {
fmt.Println(err.Error())
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
var data interface{}
err = json5.Unmarshal(body, &data)
for _, val := range data.([]interface{}) {
m := val.(map[string]interface{})
releaseName := m["name"].(string)
assets := m["assets"].([]interface{})
for _, asset := range assets {
assetInfo := asset.(map[string]interface{})
url := assetInfo["url"].(string)
if strings.Contains(strings.ToLower(releaseName), "nightly") {
cmd := exec.Command("hub", "api", "-X", "DELETE", url)
cmd.Run()
}
}
}
}