Compare commits

..

29 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
Hugo Locurcio
5bfc892a74 Add support for dozens more languages to the comment plugin (#1729) 2020-06-16 00:49:07 -04:00
Ryan Westlund
1793b6268b Add comment support for Haskell (#1728) 2020-06-15 16:11:51 -04:00
Zachary Yedidia
9b62aa4170 Merge branch 'p-e-w-faster-runewidth' 2020-06-13 17:00:03 -04:00
Zachary Yedidia
6fef5d6232 Merge branch 'faster-runewidth' of https://github.com/p-e-w/micro into p-e-w-faster-runewidth 2020-06-13 16:59:52 -04:00
Zachary Yedidia
fe19b13b3b Update go-shellquote for windows 2020-06-13 16:58:20 -04:00
Philipp Emanuel Weidmann
6559b116c0 Make determining rune width faster 2020-06-13 08:59:17 +05:30
Zachary Yedidia
ca976a8a3c Update runtime build script
Ref #1687
2020-06-12 20:54:37 -04:00
Zachary Yedidia
cfc595e80e Fix MoveLines on last line of buffer
Fixes #1723
Fixes #1724
2020-06-12 15:16:27 -04:00
Zachary Yedidia
fde4b92b9f More consistent key labels in docs 2020-06-12 14:41:57 -04:00
Zachary Yedidia
b8ec7b320a Add note for macOS terminals in docs 2020-06-12 14:20:26 -04:00
Zachary Yedidia
1786165d8b Merge branch 'master' of https://github.com/zyedidia/micro 2020-06-12 14:16:53 -04:00
Zachary Yedidia
0322e91933 Update readme 2020-06-12 14:16:47 -04:00
Ján Priner
b2261fc225 Add latex support in comment plugin (#1725) 2020-06-12 12:58:51 -04:00
Philipp Emanuel Weidmann
5ce26cca71 Make determining whether a code point represents a combining mark faster (#1719) 2020-06-12 00:10:00 -04:00
Zachary Yedidia
efb38b8636 Merge branch 'settings-config'
With these changes, settings.json should only contain options that
have been modified from their default values. Micro will actively
options that are set to default values from the settings.json file.
To see a full list of settings and their defaults, see the "options"
documentation, as well as `micro -options`.
2020-06-09 16:34:37 -04:00
Zachary Yedidia
0654db334a Show key name in raw pane 2020-06-09 15:57:52 -04:00
Dmitry Maluka
1f58eecf3c Lower priority of cursorline and colorcolumn highlighting (#1697)
Fixes #1665
2020-06-08 16:15:54 -04:00
27 changed files with 495 additions and 668 deletions

View File

@@ -46,6 +46,7 @@ fetch-tags:
# Builds the runtime
runtime:
git submodule update --init
rm -f runtime/syntax/*.hdr
go run runtime/syntax/make_headers.go runtime/syntax
go build -o tools/bindata ./tools/go-bindata
tools/bindata -pkg config -nomemcopy -nometadata -o runtime.go runtime/...
@@ -79,7 +80,7 @@ bench-compare:
for i in 1 2 3; do \
go test -bench=. ./internal/...; \
done > benchmark_results
benchstat benchmark_results_baseline benchmark_results
benchstat -alpha 0.15 benchmark_results_baseline benchmark_results
clean:
rm -f micro

View File

@@ -44,7 +44,7 @@ You can also check out the website for Micro at https://micro-editor.github.io.
- Easy to use and install.
- No dependencies or external files are needed — just the binary you can download further down the page.
- Multiple cursors.
- Common keybindings (<kbd>Ctrl+S</kbd>, <kbd>Ctrl+C</kbd>, <kbd>Ctrl+V</kbd>, <kbd>Ctrl+Z</kbd>, …).
- Common keybindings (<kbd>Ctrl-s</kbd>, <kbd>Ctrl-c</kbd>, <kbd>Ctrl-v</kbd>, <kbd>Ctrl-z</kbd>, …).
- Keybindings can be rebound to your liking.
- Sane defaults.
- You shouldn't have to configure much out of the box (and it is extremely easy to configure).
@@ -53,7 +53,7 @@ You can also check out the website for Micro at https://micro-editor.github.io.
- Extremely good mouse support.
- This means mouse dragging to create a selection, double click to select by word, and triple click to select by line.
- Cross-platform (it should work on all the platforms Go runs on).
- Note that while Windows is supported Mingw/Cygwin is not (see below)
- Note that while Windows is supported Mingw/Cygwin is not (see below).
- Plugin system (plugins are written in Lua).
- micro has a built-in plugin manager to automatically install, remove, and update plugins.
- Built-in diff gutter.
@@ -169,7 +169,7 @@ CGO_ENABLED=0 make build
### macOS terminal
If you are using macOS, you should consider using [iTerm2](http://iterm2.com/) instead of the default terminal (Terminal.app). The iTerm2 terminal has much better mouse support as well as better handling of key events. For best keybinding behavior, choose `xterm defaults` under `Preferences->Profiles->Keys->Load Preset`. The newest versions also support true color.
If you are using macOS, you should consider using [iTerm2](http://iterm2.com/) instead of the default terminal (Terminal.app). The iTerm2 terminal has much better mouse support as well as better handling of key events. For best keybinding behavior, choose `xterm defaults` under `Preferences->Profiles->Keys->Presets...`, and select `Esc+` for `Left Option Key` in the same menu. The newest versions also support true color.
If you still insist on using the default Mac terminal, be sure to set `Use Option key as Meta key` under
`Preferences->Profiles->Keyboard` to use <kbd>option</kbd> as <kbd>alt</kbd>.
@@ -187,7 +187,7 @@ If you don't have these commands, micro will use an internal clipboard for copy
If you open micro and it doesn't seem like syntax highlighting is working, this is probably because
you are using a terminal which does not support 256 color mode. Try changing the color scheme to `simple`
by pressing <kbd>Ctrl+E</kbd> in micro and typing `set colorscheme simple`.
by pressing <kbd>Ctrl-e</kbd> in micro and typing `set colorscheme simple`.
If you are using the default Ubuntu terminal, to enable 256 make sure your `TERM` variable is set
to `xterm-256color`.
@@ -228,7 +228,7 @@ click to enable line selection.
## Documentation and Help
micro has a built-in help system which you can access by pressing <kbd>Ctrl+E</kbd> and typing `help`. Additionally, you can
micro has a built-in help system which you can access by pressing <kbd>Ctrl-e</kbd> and typing `help`. Additionally, you can
view the help files here:
- [main help](https://github.com/zyedidia/micro/tree/master/runtime/help/help.md)

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()

6
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
@@ -25,4 +25,8 @@ require (
layeh.com/gopher-luar v1.0.7
)
replace github.com/kballard/go-shellquote => github.com/zyedidia/go-shellquote v0.0.0-20200613203517-eccd813c0655
replace github.com/mattn/go-runewidth => github.com/p-e-w/go-runewidth v0.0.10-0.20200613030200-3e1705c5c059
go 1.11

18
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,10 +21,10 @@ 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=
github.com/p-e-w/go-runewidth v0.0.10-0.20200613030200-3e1705c5c059/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff h1:+6NUiITWwE5q1KO6SAfUX918c+Tab0+tGAM/mtdlUyA=
@@ -40,12 +38,12 @@ 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=
github.com/zyedidia/glob v0.0.0-20170209203856-dd4023a66dc3/go.mod h1:YKbIYP//Eln8eDgAJGI3IDvR3s4Tv9Z9TGIOumiyQ5c=
github.com/zyedidia/go-shellquote v0.0.0-20200613203517-eccd813c0655 h1:Z3RhH6hvcSx7eX6Q/pP6YVsgea/1eMDG99vtWwi3nK4=
github.com/zyedidia/go-shellquote v0.0.0-20200613203517-eccd813c0655/go.mod h1:1sTqqO+kcYzZp43M5VsJe1tns9IzlSeC9jB6c2+o/5Y=
github.com/zyedidia/highlight v0.0.0-20170330143449-201131ce5cf5 h1:Zs6mpwXvlqpF9zHl5XaN0p5V4J9XvP+WBuiuXyIgqvc=
github.com/zyedidia/highlight v0.0.0-20170330143449-201131ce5cf5/go.mod h1:c1r+Ob9tUTPB0FKWO1+x+Hsc/zNa45WdGq7Y38Ybip0=
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d h1:zmDMkh22zXOB7gz8jFaI4GpI7llsPgzm38/jG0UgxjE=
@@ -54,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

@@ -35,6 +35,13 @@ func (h *RawPane) HandleEvent(event tcell.Event) {
}
h.Buf.Insert(h.Cursor.Loc, reflect.TypeOf(event).String()[7:])
switch e := event.(type) {
case *tcell.EventKey:
h.Buf.Insert(h.Cursor.Loc, fmt.Sprintf(": %s", e.Name()))
}
h.Buf.Insert(h.Cursor.Loc, fmt.Sprintf(": %q\n", event.EscSeq()))
h.Relocate()
}

View File

@@ -837,19 +837,18 @@ func (b *Buffer) MoveLinesUp(start int, end int) {
}
l := string(b.LineBytes(start - 1))
if end == len(b.lines) {
b.Insert(
b.insert(
Loc{
util.CharacterCount(b.lines[end-1].data),
end - 1,
},
"\n"+l,
)
} else {
b.Insert(
Loc{0, end},
l+"\n",
[]byte{'\n'},
)
}
b.Insert(
Loc{0, end},
l+"\n",
)
b.Remove(
Loc{0, start - 1},
Loc{0, start},
@@ -858,7 +857,7 @@ func (b *Buffer) MoveLinesUp(start int, end int) {
// MoveLinesDown moves the range of lines down one row
func (b *Buffer) MoveLinesDown(start int, end int) {
if start < 0 || start >= end || end >= len(b.lines)-1 {
if start < 0 || start >= end || end >= len(b.lines) {
return
}
l := string(b.LineBytes(end))

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

@@ -518,6 +518,13 @@ func (w *BufWindow) displayBuffer() {
draw := func(r rune, combc []rune, style tcell.Style, showcursor bool) {
if nColsBeforeStart <= 0 {
_, origBg, _ := style.Decompose()
_, defBg, _ := config.DefStyle.Decompose()
// syntax highlighting with non-default background takes precedence
// over cursor-line and color-column
dontOverrideBackground := origBg != defBg
for _, c := range cursors {
if c.HasSelection() &&
(bloc.GreaterEqual(c.CurSelection[0]) && bloc.LessThan(c.CurSelection[1]) ||
@@ -530,7 +537,7 @@ func (w *BufWindow) displayBuffer() {
}
}
if b.Settings["cursorline"].(bool) && w.active &&
if b.Settings["cursorline"].(bool) && w.active && !dontOverrideBackground &&
!c.HasSelection() && c.Y == bloc.Y {
if s, ok := config.Colorscheme["cursor-line"]; ok {
fg, _, _ := s.Decompose()
@@ -562,7 +569,7 @@ func (w *BufWindow) displayBuffer() {
}
if s, ok := config.Colorscheme["color-column"]; ok {
if colorcolumn != 0 && vloc.X-w.gutterOffset+w.StartCol == colorcolumn {
if colorcolumn != 0 && vloc.X-w.gutterOffset+w.StartCol == colorcolumn && !dontOverrideBackground {
fg, _, _ := s.Decompose()
style = style.Background(fg)
}

View File

@@ -16,6 +16,16 @@ import (
// For rendering, micro will display the combining characters. It's not perfect
// but it's pretty good.
var minMark = rune(unicode.Mark.R16[0].Lo)
func isMark(r rune) bool {
// Fast path
if r < minMark {
return false
}
return unicode.In(r, unicode.Mark)
}
// DecodeCharacter returns the next character from an array of bytes
// A character is a rune along with any accompanying combining runes
func DecodeCharacter(b []byte) (rune, []rune, int) {
@@ -24,7 +34,7 @@ func DecodeCharacter(b []byte) (rune, []rune, int) {
c, s := utf8.DecodeRune(b)
var combc []rune
for unicode.In(c, unicode.Mark) {
for isMark(c) {
combc = append(combc, c)
size += s
@@ -43,7 +53,7 @@ func DecodeCharacterInString(str string) (rune, []rune, int) {
c, s := utf8.DecodeRuneInString(str)
var combc []rune
for unicode.In(c, unicode.Mark) {
for isMark(c) {
combc = append(combc, c)
size += s
@@ -61,7 +71,7 @@ func CharacterCount(b []byte) int {
for len(b) > 0 {
r, size := utf8.DecodeRune(b)
if !unicode.In(r, unicode.Mark) {
if !isMark(r) {
s++
}
@@ -77,7 +87,7 @@ func CharacterCountInString(str string) int {
s := 0
for _, r := range str {
if !unicode.In(r, unicode.Mark) {
if !isMark(r) {
s++
}
}

View File

@@ -5,6 +5,16 @@ import (
"unicode/utf8"
)
var minMark = rune(unicode.Mark.R16[0].Lo)
func isMark(r rune) bool {
// Fast path
if r < minMark {
return false
}
return unicode.In(r, unicode.Mark)
}
// DecodeCharacter returns the next character from an array of bytes
// A character is a rune along with any accompanying combining runes
func DecodeCharacter(b []byte) (rune, []rune, int) {
@@ -13,7 +23,7 @@ func DecodeCharacter(b []byte) (rune, []rune, int) {
c, s := utf8.DecodeRune(b)
var combc []rune
for unicode.In(c, unicode.Mark) {
for isMark(c) {
combc = append(combc, c)
size += s
@@ -32,7 +42,7 @@ func DecodeCharacterInString(str string) (rune, []rune, int) {
c, s := utf8.DecodeRuneInString(str)
var combc []rune
for unicode.In(c, unicode.Mark) {
for isMark(c) {
combc = append(combc, c)
size += s
@@ -50,7 +60,7 @@ func CharacterCount(b []byte) int {
for len(b) > 0 {
r, size := utf8.DecodeRune(b)
if !unicode.In(r, unicode.Mark) {
if !isMark(r) {
s++
}
@@ -66,7 +76,7 @@ func CharacterCountInString(str string) int {
s := 0
for _, r := range str {
if !unicode.In(r, unicode.Mark) {
if !isMark(r) {
s++
}
}

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

@@ -11,115 +11,115 @@ can change it!
| Key | Description of function |
|---------- |-------------------------------------------------------------------------------------------------- |
| Ctrl+E | Open a command prompt for running commands (see `> help commands` for a list of valid commands). |
| Ctrl-e | Open a command prompt for running commands (see `> help commands` for a list of valid commands). |
| Tab | In command prompt, it will autocomplete if possible. |
| Ctrl+B | Run a shell command (this will close micro while your command executes). |
| Ctrl-b | Run a shell command (this will close micro while your command executes). |
### Navigation
| Key | Description of function |
|---------------------------- |------------------------------------------------------------------------------------------ |
| Arrows | Move the cursor around |
| Shift+arrows | Move and select text |
| Alt(Ctrl on Mac)+LeftArrow | Move to the beginning of the current line |
| Alt(Ctrl on Mac)+RightArrow | Move to the end of the current line |
| Shift-arrows | Move and select text |
| Alt(Ctrl on Mac)-LeftArrow | Move to the beginning of the current line |
| Alt(Ctrl on Mac)-RightArrow | Move to the end of the current line |
| Home | Move to the beginning of text on the current line |
| End | Move to the end of the current line |
| Ctrl(Alt on Mac)+LeftArrow | Move cursor one word left |
| Ctrl(Alt on Mac)+RightArrow | Move cursor one word right |
| Alt+{ | Move cursor to previous empty line, or beginning of document |
| Alt+} | Move cursor to next empty line, or end of document |
| Ctrl(Alt on Mac)-LeftArrow | Move cursor one word left |
| Ctrl(Alt on Mac)-RightArrow | Move cursor one word right |
| Alt-{ | Move cursor to previous empty line, or beginning of document |
| Alt-} | Move cursor to next empty line, or end of document |
| PageUp | Move cursor up one page |
| PageDown | Move cursor down one page |
| Ctrl+Home or Ctrl+UpArrow | Move cursor to start of document |
| Ctrl+End or Ctrl+DownArrow | Move cursor to end of document |
| Ctrl+L | Jump to a line in the file (prompts with #) |
| Ctrl+W | Cycle between splits in the current tab (use `> vsplit` or `> hsplit` to create a split) |
| Ctrl-Home or Ctrl-UpArrow | Move cursor to start of document |
| Ctrl-End or Ctrl-DownArrow | Move cursor to end of document |
| Ctrl-l | Jump to a line in the file (prompts with #) |
| Ctrl-w | Cycle between splits in the current tab (use `> vsplit` or `> hsplit` to create a split) |
### Tabs
| Key | Description of function |
|-------- |------------------------- |
| Ctrl+T | Open a new tab |
| Alt+, | Previous tab |
| Alt+. | Next tab |
| Ctrl-t | Open a new tab |
| Alt-, | Previous tab |
| Alt-. | Next tab |
### Find Operations
| Key | Description of function |
|---------- |------------------------------------------ |
| Ctrl+F | Find (opens prompt) |
| Ctrl+N | Find next instance of current search |
| Ctrl+P | Find previous instance of current search |
| Ctrl-f | Find (opens prompt) |
| Ctrl-n | Find next instance of current search |
| Ctrl-p | Find previous instance of current search |
### File Operations
| Key | Description of function |
|---------- |------------------------------------------------------------------ |
| Ctrl+Q | Close current file (quits micro if this is the last file open) |
| Ctrl+O | Open a file (prompts for filename) |
| Ctrl+S | Save current file |
| Ctrl-q | Close current file (quits micro if this is the last file open) |
| Ctrl-o | Open a file (prompts for filename) |
| Ctrl-s | Save current file |
### Text operations
| Key | Description of function |
|------------------------------------ |------------------------------------------ |
| Ctrl(Alt on Mac)+Shift+RightArrow | Select word right |
| Ctrl(Alt on Mac)+Shift+LeftArrow | Select word left |
| Alt(Ctrl on Mac)+Shift+LeftArrow | Select to start of current line |
| Alt(Ctrl on Mac)+Shift+RightArrow | Select to end of current line |
| Shift+Home | Select to start of current line |
| Shift+End | Select to end of current line |
| Ctrl+Shift+UpArrow | Select to start of file |
| Ctrl+Shift+DownArrow | Select to end of file |
| Ctrl+X | Cut selected text |
| Ctrl+C | Copy selected text |
| Ctrl+V | Paste |
| Ctrl+K | Cut current line |
| Ctrl+D | Duplicate current line |
| 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+Backspace or Alt+Ctrl+H | Delete word left |
| Ctrl+A | Select all |
| Ctrl(Alt on Mac)-Shift-RightArrow | Select word right |
| Ctrl(Alt on Mac)-Shift-LeftArrow | Select word left |
| Alt(Ctrl on Mac)-Shift-LeftArrow | Select to start of current line |
| Alt(Ctrl on Mac)-Shift-RightArrow | Select to end of current line |
| Shift-Home | Select to start of current line |
| Shift-End | Select to end of current line |
| Ctrl-Shift-UpArrow | Select to start of file |
| Ctrl-Shift-DownArrow | Select to end of file |
| Ctrl-x | Cut selected text |
| Ctrl-c | Copy selected text |
| Ctrl-v | Paste |
| Ctrl-k | Cut current line |
| Ctrl-d | Duplicate current line |
| Ctrl-z | Undo |
| Ctrl-y | Redo |
| Alt-UpArrow | Move current line or selected lines up |
| Alt-DownArrow | Move current line or selected lines down |
| Alt-Backspace or Alt-Ctrl-h | Delete word left |
| Ctrl-a | Select all |
### Macros
| Key | Description of function |
|---------- |---------------------------------------------------------------------------------- |
| Ctrl+U | Toggle macro recording (press Ctrl+U to start recording and press again to stop) |
| Ctrl+J | Run latest recorded macro |
| Ctrl-u | Toggle macro recording (press Ctrl-u to start recording and press again to stop) |
| Ctrl-j | Run latest recorded macro |
### Multiple cursors
| Key | Description of function |
|------------------ |---------------------------------------------------------------------------------------------- |
| Alt+N | Create new multiple cursor from selection (will select current word if no current selection) |
| AltShiftUp | Spawn a new cursor on the line above the current one |
| AltShiftDown | Spawn a new cursor on the line below the current one |
| Alt+P | Remove latest multiple cursor |
| Alt+C | Remove all multiple cursors (cancel) |
| Alt+X | Skip multiple cursor selection |
| Alt+M | Spawn a new cursor at the beginning of every line in the current selection |
| Ctrl+MouseLeft | Place a multiple cursor at any location |
| Alt-n | Create new multiple cursor from selection (will select current word if no current selection) |
| Alt-Shift-Up | Spawn a new cursor on the line above the current one |
| Alt-Shift-Down | Spawn a new cursor on the line below the current one |
| Alt-p | Remove latest multiple cursor |
| Alt-c | Remove all multiple cursors (cancel) |
| Alt-x | Skip multiple cursor selection |
| Alt-m | Spawn a new cursor at the beginning of every line in the current selection |
| Ctrl-MouseLeft | Place a multiple cursor at any location |
### Other
| Key | Description of function |
|---------- |-------------------------------------------------------------------------------------- |
| Ctrl+G | Open help file |
| Ctrl+H | Backspace (old terminals do not support the backspace key and use Ctrl+H instead) |
| Ctrl+R | Toggle the line number ruler |
| Ctrl-g | Open help file |
| Ctrl-h | Backspace (old terminals do not support the backspace key and use Ctrl+H instead) |
| Ctrl-r | Toggle the line number ruler |
### Emacs style actions
| Key | Description of function |
|---------- |-------------------------- |
| Alt+F | Next word |
| Alt+B | Previous word |
| Alt+A | Move to start of line |
| Alt+E | Move to end of line |
| Alt-f | Next word |
| Alt-b | Previous word |
| Alt-a | Move to start of line |
| Alt-e | Move to end of line |
### Function keys.

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.
@@ -73,21 +79,27 @@ You can also bind a key to execute a command in command mode (see
}
```
**Note for macOS**: By default, macOS terminals do not forward alt events and
instead insert unicode characters. To fix this, do the following:
* iTerm2: select `Esc+` for `Left Option Key` in `Preferences->Profiles->Keys`.
* Terminal.app: Enable `Use Option key as Meta key` in `Preferences->Profiles->Keyboard`.
Now when you press `Alt-p` the `pwd` command will be executed which will show
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).
@@ -351,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
@@ -444,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",
@@ -474,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
@@ -520,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

@@ -6,24 +6,58 @@ local buffer = import("micro/buffer")
local ft = {}
ft["apacheconf"] = "# %s"
ft["bat"] = ":: %s"
ft["c"] = "// %s"
ft["c++"] = "// %s"
ft["cmake"] = "# %s"
ft["conf"] = "# %s"
ft["crystal"] = "# %s"
ft["css"] = "/* %s */"
ft["d"] = "// %s"
ft["dart"] = "// %s"
ft["dockerfile"] = "# %s"
ft["elm"] = "-- %s"
ft["fish"] = "# %s"
ft["gdscript"] = "# %s"
ft["glsl"] = "// %s"
ft["go"] = "// %s"
ft["python"] = "# %s"
ft["python3"] = "# %s"
ft["haskell"] = "-- %s"
ft["html"] = "<!-- %s -->"
ft["ini"] = "; %s"
ft["java"] = "// %s"
ft["javascript"] = "// %s"
ft["jinja2"] = "{# %s #}"
ft["julia"] = "# %s"
ft["kotlin"] = "// %s"
ft["lua"] = "-- %s"
ft["markdown"] = "<!-- %s -->"
ft["nginx"] = "# %s"
ft["nim"] = "# %s"
ft["objc"] = "// %s"
ft["pascal"] = "{ %s }"
ft["perl"] = "# %s"
ft["php"] = "// %s"
ft["rust"] = "// %s"
ft["shell"] = "# %s"
ft["lua"] = "-- %s"
ft["javascript"] = "// %s"
ft["pony"] = "// %s"
ft["powershell"] = "# %s"
ft["proto"] = "// %s"
ft["python"] = "# %s"
ft["python3"] = "# %s"
ft["ruby"] = "# %s"
ft["d"] = "// %s"
ft["rust"] = "// %s"
ft["scala"] = "// %s"
ft["shell"] = "# %s"
ft["sql"] = "-- %s"
ft["swift"] = "// %s"
ft["elm"] = "-- %s"
ft["tex"] = "% %s"
ft["toml"] = "# %s"
ft["twig"] = "{# %s #}"
ft["v"] = "// %s"
ft["xml"] = "<!-- %s -->"
ft["yaml"] = "# %s"
ft["zig"] = "// %s"
ft["zscript"] = "// %s"
ft["zsh"] = "# %s"
function onBufferOpen(buf)
if buf.Settings["commenttype"] == nil then
@@ -38,7 +72,7 @@ end
function commentLine(bp, lineN)
local line = bp.Buf:Line(lineN)
local commentType = bp.Buf.Settings["commenttype"]
local commentRegex = "^%s*" .. commentType:gsub("%*", "%*"):gsub("%-", "%-"):gsub("%.", "%."):gsub("%+", "%+"):gsub("%]", "%]"):gsub("%[", "%["):gsub("%%s", "(.*)")
local commentRegex = "^%s*" .. commentType:gsub("%%","%%%%"):gsub("%$","%$"):gsub("%)","%)"):gsub("%(","%("):gsub("%?","%?"):gsub("%*", "%*"):gsub("%-", "%-"):gsub("%.", "%."):gsub("%+", "%+"):gsub("%]", "%]"):gsub("%[", "%["):gsub("%%%%s", "(.*)")
local sel = -bp.Cursor.CurSelection
local curpos = -bp.Cursor.Loc
local index = string.find(commentType, "%%s") - 1
@@ -98,7 +132,8 @@ function comment(bp, args)
end
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
local trimmed = s:gsub("^%s*(.-)%s*$", "%1"):gsub("%%","%%%%")
return trimmed
end
function string.starts(String,Start)
@@ -108,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
{
@@ -23,23 +25,58 @@ selected.
The comment type will be auto detected based on the filetype,
but it is only available for certain filetypes:
* apacheconf: `# %s`
* bat: `:: %s`
* c: `// %s`
* c++: `// %s`
* cmake: `# %s`
* conf: `# %s`
* crystal: `# %s`
* css: `/* %s */`
* d: `// %s`
* dart: `// %s`
* dockerfile: `# %s`
* elm: `-- %s`
* fish: `# %s`
* gdscript: `# %s`
* glsl: `// %s`
* go: `// %s`
* haskell: `-- %s`
* html: `<!-- %s -->`
* ini: `; %s`
* java: `// %s`
* javascript: `// %s`
* jinja2: `{# %s #}`
* julia: `# %s`
* kotlin: `// %s`
* lua: `-- %s`
* markdown: `<!-- %s -->`
* nginx: `# %s`
* nim: `# %s`
* objc: `// %s`
* pascal: `{ %s }`
* perl: `# %s`
* php: `// %s`
* pony: `// %s`
* powershell: `# %s`
* proto: `// %s`
* python: `# %s`
* python3: `# %s`
* ruby: `# %s`
* rust: `// %s`
* scala: `// %s`
* shell: `# %s`
* sql: `-- %s`
* swift: `// %s`
* tex: `% %s`
* toml: `# %s`
* twig: `{# %s #}`
* v: `// %s`
* xml: `<!-- %s -->`
* yaml: `# %s`
* zig: `// %s`
* zscript: `// %s`
* zsh: `# %s`
If your filetype is not available here, you can simply modify
the `commenttype` option:
@@ -57,4 +94,3 @@ Or in your `settings.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()
}
}
}
}