Merge branch 'master' into view-refactor

This commit is contained in:
Zachary Yedidia 2017-03-26 20:40:03 -04:00
commit 12d74b99e8
47 changed files with 1668 additions and 136 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ binaries/
tmp.sh tmp.sh
test/ test/
.idea/ .idea/
packages/

View File

@ -1,6 +1,6 @@
Micro is licensed under the MIT "Expat" License: Micro is licensed under the MIT "Expat" License:
Copyright (c) 2016: Zachary Yedidia. Copyright (c) 2016: Zachary Yedidia, et al.
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@ -88,7 +88,7 @@ If your operating system does not have a binary release, but does run Go, you ca
Make sure that you have Go version 1.5 or greater (Go 1.4 will work if your version supports CGO) and that your `GOPATH` env variable is set (I recommand setting it to `~/go` if you don't have one). Make sure that you have Go version 1.5 or greater (Go 1.4 will work if your version supports CGO) and that your `GOPATH` env variable is set (I recommand setting it to `~/go` if you don't have one).
``` ```
go get -d github.com/zyedidia/micro go get -d github.com/zyedidia/micro/...
cd $GOPATH/src/github.com/zyedidia/micro cd $GOPATH/src/github.com/zyedidia/micro
make install make install
``` ```

View File

@ -588,14 +588,20 @@ func (v *View) IndentSelection(usePlugin bool) bool {
} }
if v.Cursor.HasSelection() { if v.Cursor.HasSelection() {
startY := v.Cursor.CurSelection[0].Y start := v.Cursor.CurSelection[0]
endY := v.Cursor.CurSelection[1].Move(-1, v.Buf).Y end := v.Cursor.CurSelection[1]
endX := v.Cursor.CurSelection[1].Move(-1, v.Buf).X if end.Y < start.Y {
start, end = end, start
}
startY := start.Y
endY := end.Move(-1, v.Buf).Y
endX := end.Move(-1, v.Buf).X
for y := startY; y <= endY; y++ { for y := startY; y <= endY; y++ {
tabsize := len(v.Buf.IndentString()) tabsize := len(v.Buf.IndentString())
v.Buf.Insert(Loc{0, y}, v.Buf.IndentString()) v.Buf.Insert(Loc{0, y}, v.Buf.IndentString())
if y == startY && v.Cursor.CurSelection[0].X > 0 { if y == startY && start.X > 0 {
v.Cursor.SetSelectionStart(v.Cursor.CurSelection[0].Move(tabsize, v.Buf)) v.Cursor.SetSelectionStart(start.Move(tabsize, v.Buf))
} }
if y == endY { if y == endY {
v.Cursor.SetSelectionEnd(Loc{endX + tabsize + 1, endY}) v.Cursor.SetSelectionEnd(Loc{endX + tabsize + 1, endY})
@ -643,17 +649,23 @@ func (v *View) OutdentSelection(usePlugin bool) bool {
} }
if v.Cursor.HasSelection() { if v.Cursor.HasSelection() {
startY := v.Cursor.CurSelection[0].Y start := v.Cursor.CurSelection[0]
endY := v.Cursor.CurSelection[1].Move(-1, v.Buf).Y end := v.Cursor.CurSelection[1]
endX := v.Cursor.CurSelection[1].Move(-1, v.Buf).X if end.Y < start.Y {
start, end = end, start
}
startY := start.Y
endY := end.Move(-1, v.Buf).Y
endX := end.Move(-1, v.Buf).X
for y := startY; y <= endY; y++ { for y := startY; y <= endY; y++ {
for x := 0; x < len(v.Buf.IndentString()); x++ { for x := 0; x < len(v.Buf.IndentString()); x++ {
if len(GetLeadingWhitespace(v.Buf.Line(y))) == 0 { if len(GetLeadingWhitespace(v.Buf.Line(y))) == 0 {
break break
} }
v.Buf.Remove(Loc{0, y}, Loc{1, y}) v.Buf.Remove(Loc{0, y}, Loc{1, y})
if y == startY && v.Cursor.CurSelection[0].X > 0 { if y == startY && start.X > 0 {
v.Cursor.SetSelectionStart(v.Cursor.CurSelection[0].Move(-1, v.Buf)) v.Cursor.SetSelectionStart(start.Move(-1, v.Buf))
} }
if y == endY { if y == endY {
v.Cursor.SetSelectionEnd(Loc{endX - x, endY}) v.Cursor.SetSelectionEnd(Loc{endX - x, endY})
@ -779,7 +791,7 @@ func (v *View) FindNext(usePlugin bool) bool {
if v.Cursor.HasSelection() { if v.Cursor.HasSelection() {
searchStart = ToCharPos(v.Cursor.CurSelection[1], v.Buf) searchStart = ToCharPos(v.Cursor.CurSelection[1], v.Buf)
lastSearch = v.Cursor.GetSelection() // lastSearch = v.Cursor.GetSelection()
} else { } else {
searchStart = ToCharPos(v.Cursor.Loc, v.Buf) searchStart = ToCharPos(v.Cursor.Loc, v.Buf)
} }

View File

@ -414,8 +414,8 @@ func DefaultBindings() map[string]string {
"CtrlV": "Paste", "CtrlV": "Paste",
"CtrlA": "SelectAll", "CtrlA": "SelectAll",
"CtrlT": "AddTab", "CtrlT": "AddTab",
"CtrlRightSq": "PreviousTab", "Alt,": "PreviousTab",
"CtrlBackslash": "NextTab", "Alt.": "NextTab",
"Home": "StartOfLine", "Home": "StartOfLine",
"End": "EndOfLine", "End": "EndOfLine",
"CtrlHome": "CursorStart", "CtrlHome": "CursorStart",
@ -444,6 +444,7 @@ func DefaultBindings() map[string]string {
// Integration with file managers // Integration with file managers
"F1": "ToggleHelp", "F1": "ToggleHelp",
"F2": "Save", "F2": "Save",
"F3": "Find",
"F4": "Quit", "F4": "Quit",
"F7": "Find", "F7": "Find",
"F10": "Quit", "F10": "Quit",

View File

@ -326,6 +326,13 @@ func VSplit(args []string) {
home, _ := homedir.Dir() home, _ := homedir.Dir()
filename = strings.Replace(filename, "~", home, 1) filename = strings.Replace(filename, "~", home, 1)
file, err := os.Open(filename) file, err := os.Open(filename)
fileInfo, _ := os.Stat(filename)
if err == nil && fileInfo.IsDir() {
messenger.Error(filename, " is a directory")
return
}
defer file.Close() defer file.Close()
var buf *Buffer var buf *Buffer
@ -349,6 +356,13 @@ func HSplit(args []string) {
home, _ := homedir.Dir() home, _ := homedir.Dir()
filename = strings.Replace(filename, "~", home, 1) filename = strings.Replace(filename, "~", home, 1)
file, err := os.Open(filename) file, err := os.Open(filename)
fileInfo, _ := os.Stat(filename)
if err == nil && fileInfo.IsDir() {
messenger.Error(filename, " is a directory")
return
}
defer file.Close() defer file.Close()
var buf *Buffer var buf *Buffer
@ -382,10 +396,24 @@ func NewTab(args []string) {
filename := args[0] filename := args[0]
home, _ := homedir.Dir() home, _ := homedir.Dir()
filename = strings.Replace(filename, "~", home, 1) filename = strings.Replace(filename, "~", home, 1)
file, _ := os.Open(filename) file, err := os.Open(filename)
fileInfo, _ := os.Stat(filename)
if err == nil && fileInfo.IsDir() {
messenger.Error(filename, " is a directory")
return
}
defer file.Close() defer file.Close()
tab := NewTabFromView(NewView(NewBuffer(file, filename))) var buf *Buffer
if err != nil {
buf = NewBuffer(strings.NewReader(""), filename)
} else {
buf = NewBuffer(file, filename)
}
tab := NewTabFromView(NewView(buf))
tab.SetNum(len(tabs)) tab.SetNum(len(tabs))
tabs = append(tabs, tab) tabs = append(tabs, tab)
curTab = len(tabs) - 1 curTab = len(tabs) - 1

File diff suppressed because one or more lines are too long

View File

@ -244,6 +244,13 @@ func (v *View) Open(filename string) {
home, _ := homedir.Dir() home, _ := homedir.Dir()
filename = strings.Replace(filename, "~", home, 1) filename = strings.Replace(filename, "~", home, 1)
file, err := os.Open(filename) file, err := os.Open(filename)
fileInfo, _ := os.Stat(filename)
if err == nil && fileInfo.IsDir() {
messenger.Error(filename, " is a directory")
return
}
defer file.Close() defer file.Close()
var buf *Buffer var buf *Buffer
@ -718,12 +725,6 @@ func (v *View) DisplayView() {
screenX = v.x screenX = v.x
if v.x != 0 {
// Draw the split divider
screen.SetContent(screenX, yOffset+visualLineN, '|', nil, defStyle.Reverse(true))
screenX++
}
// If there are gutter messages we need to display the '>>' symbol here // If there are gutter messages we need to display the '>>' symbol here
if hasGutterMessages { if hasGutterMessages {
// msgOnLine stores whether or not there is a gutter message on this line in particular // msgOnLine stores whether or not there is a gutter message on this line in particular
@ -891,8 +892,12 @@ func (v *View) DisplayView() {
} }
if v.x != 0 && visualLineN < v.Height { if v.x != 0 && visualLineN < v.Height {
dividerStyle := defStyle
if style, ok := colorscheme["divider"]; ok {
dividerStyle = style
}
for i := visualLineN + 1; i < v.Height; i++ { for i := visualLineN + 1; i < v.Height; i++ {
screen.SetContent(v.x, yOffset+i, '|', nil, defStyle.Reverse(true)) screen.SetContent(v.x, yOffset+i, '|', nil, dividerStyle.Reverse(true))
} }
} }
} }

View File

@ -12,6 +12,7 @@ color-link underlined "#D33682,#1D1F21"
color-link error "bold #FF4444,#1D1F21" color-link error "bold #FF4444,#1D1F21"
color-link todo "bold #FF8844,#1D1F21" color-link todo "bold #FF8844,#1D1F21"
color-link statusline "#1D1F21,#C5C8C6" color-link statusline "#1D1F21,#C5C8C6"
color-link tabbar "#1D1F21,#C5C8C6"
color-link indent-char "#505050,#1D1F21" color-link indent-char "#505050,#1D1F21"
color-link line-number "#656866,#232526" color-link line-number "#656866,#232526"
color-link current-line-number "#656866,#1D1F21" color-link current-line-number "#656866,#1D1F21"
@ -19,3 +20,7 @@ color-link gutter-error "#FF4444,#1D1F21"
color-link gutter-warning "#EEEE77,#1D1F21" color-link gutter-warning "#EEEE77,#1D1F21"
color-link cursor-line "#2D2F31" color-link cursor-line "#2D2F31"
color-link color-column "#2D2F31" color-link color-column "#2D2F31"
#No extended types (bool in C, etc.)
color-link type.extended "default"
#Plain brackets
color-link symbol.brackets "default"

View File

@ -12,10 +12,13 @@ color-link special "167,231"
color-link error "231, 160" color-link error "231, 160"
color-link underlined "underline 241,231" color-link underlined "underline 241,231"
color-link todo "246,231" color-link todo "246,231"
color-link statusline "241,254" color-link statusline "241,254"
color-link tabbar "241,254"
color-link gutter-error "197,231" color-link gutter-error "197,231"
color-link gutter-warning "134,231" color-link gutter-warning "134,231"
color-link line-number "246,254" color-link line-number "246,254"
color-link cursor-line "254" color-link cursor-line "254"
color-link color-column "254" color-link color-column "254"
#No extended types (bool in C, &c.) and plain brackets
color-link type.extended "default"
color-link symbol.brackets "default"

View File

@ -0,0 +1,40 @@
#CaptainMcClellan's personal color scheme.
#16 colour version.
color-link comment "bold black"
color-link constant "cyan"
color-link constant.bool "bold cyan"
color-link constant.bool.true "bold green"
color-link constant.bool.false "bold red"
color-link constant.string "yellow"
color-link constant.string.url "underline blue, white"
#color-link constant.number "constant"
color-link constant.specialChar "bold magenta"
color-link identifier "bold red"
color-link identifier.macro "bold red"
color-link identifier.var "bold blue"
#color-link identifier.class "bold green"
color-link identifier.class "bold white"
color-link statement "bold yellow"
color-link symbol "red"
color-link symbol.brackets "blue"
color-link symbol.tag "bold blue"
color-link symbol.tag.extended "bold green"
color-link preproc "bold cyan"
color-link type "green"
color-link type.keyword "bold green"
color-link special "magenta"
color-link ignore "default"
color-link error "bold ,brightred"
color-link todo "underline black,brightyellow"
color-link indent-char ",brightgreen"
color-link line-number "green"
color-link line-number.scrollbar "green"
color-link statusline "white,blue"
color-link tabbar "white,blue"
color-link current-line-number "red"
color-link current-line-number.scroller "red"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link color-column "cyan"
color-link underlined.url "underline blue, white"
color-link divider "blue"

View File

@ -0,0 +1,37 @@
#CaptainMcClellan's personal color scheme.
#Paper version
color-link default "black,white"
color-link comment "bold black"
color-link constant "cyan"
color-link constant.bool "bold cyan"
color-link constant.bool.true "bold green"
color-link constant.bool.false "bold red"
color-link constant.string "bold yellow"
color-link constant.string.url "underline blue, white"
color-link constant.number "constant"
color-link constant.specialChar "bold magenta"
color-link identifier "bold red"
color-link identifier.macro "bold red"
color-link identifier.var "bold blue"
color-link identifier.class "bold green"
color-link preproc "bold cyan"
color-link statement "bold yellow"
color-link symbol "red"
color-link symbol.brackets "blue"
color-link type "green"
color-link type.keyword "bold green"
color-link special "magenta"
color-link ignore "default"
color-link error ",brightred"
color-link todo "black,brightyellow"
color-link indent-char ",brightgreen"
color-link line-number "green"
color-link line-number.scrollbar "green"
color-link statusline "white,blue"
color-link tabbar "white,blue"
color-link current-line-number "red"
color-link current-line-number.scroller "red"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link color-column "cyan"
color-link underlined.url "underline blue, white"

View File

@ -0,0 +1,36 @@
#CaptainMcClellan's personal colour scheme.
#Full colour edition.
color-link default "#aaaaaa,#1e2124"
color-link comment "bold #555555"
color-link constant "#008888"
#color-link constant.string "#888800"
color-link constant.string "#a85700"
color-link constant.specialChar "bold #ccccff"
color-link identifier "bold #e34234"
color-link identifier.macro "bold #e34234"
color-link identifier.var "bold #5757ff"
color-link identifier.class "bold #ffffff"
color-link statement "bold #ffff55"
color-link symbol "#722f37"
color-link symbol.brackets "#4169e1"
color-link symbol.tag "#5757ff"
color-link preproc "bold #55ffff"
color-link type "#3eb489"
color-link type.keyword "bold #bdecb6"
color-link special "#b57edc"
color-link ignore "default"
color-link error "bold ,#e34234"
color-link todo "bold underline #888888,#f26522"
color-link indent-char ",#bdecb6"
color-link line-number "#bdecb6,#36393e"
color-link line-number.scrollbar "#3eb489"
color-link statusline "#aaaaaa,#8a496b"
color-link tabbar "#aaaaaa,#8a496b"
color-link current-line-number "bold #e34234,#424549"
color-link current-line-number.scroller "red"
color-link gutter-error ",#e34234"
color-link gutter-warning "#e34234"
color-link color-column "#f26522"
color-link constant.bool "bold #55ffff"
color-link constant.bool.true "bold #85ff85"
color-link constant.bool.false "bold #ff8585"

View File

@ -0,0 +1,25 @@
#A colorscheme based on Code::Blocks IDE
#but with a white background.
color-link default "black,white"
color-link comment "bold black"
color-link constant "blue"
color-link constant.number "bold magenta"
color-link constant.string "bold blue"
color-link identifier "black"
color-link preproc "green"
color-link statement "blue"
color-link symbol "red"
color-link symbol.brackets "blue"
color-link type "blue"
color-link special "magenta"
color-link ignore "default"
color-link error "bold white,brightred"
color-link todo "bold black,brightyellow"
color-link indent-char "bold black"
color-link line-number "black,white"
color-link statusline "white,red"
color-link tabbar "white,red"
color-link current-line-number "red,black"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link color-column "black"

View File

@ -0,0 +1,23 @@
#Theme based on Code::Blocks IDE's default syntax highlighting.
color-link comment "bold black"
color-link constant "blue"
color-link constant.string "bold blue"
color-link constant.number "bold magenta"
color-link identifier "default"
color-link preproc "green"
color-link statement "blue"
color-link symbol "red"
color-link symbol.brackets "blue"
color-link type "blue"
color-link special "magenta"
color-link ignore "default"
color-link error ",brightred"
color-link todo "bold black,brightyellow"
color-link indent-char "bold black"
color-link line-number "black,white"
color-link statusline "white,red"
color-link tabbar "white,red"
color-link current-line-number "red"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link color-column "white"

View File

@ -14,6 +14,7 @@ color-link underlined "#D33682,#282828"
color-link error "bold #CB4B16,#282828" color-link error "bold #CB4B16,#282828"
color-link todo "bold #D33682,#282828" color-link todo "bold #D33682,#282828"
color-link statusline "#282828,#F8F8F2" color-link statusline "#282828,#F8F8F2"
color-link tabbar "#282828,#f8f8f2"
color-link indent-char "#505050,#282828" color-link indent-char "#505050,#282828"
color-link line-number "#AAAAAA,#323232" color-link line-number "#AAAAAA,#323232"
color-link current-line-number "#AAAAAA,#282828" color-link current-line-number "#AAAAAA,#282828"
@ -21,3 +22,6 @@ color-link gutter-error "#CB4B16,#282828"
color-link gutter-warning "#E6DB74,#282828" color-link gutter-warning "#E6DB74,#282828"
color-link cursor-line "#323232" color-link cursor-line "#323232"
color-link color-column "#323232" color-link color-column "#323232"
#No extended types; plain brackets
color-link type.extended "default"
color-link symbol.brackets "default"

View File

@ -0,0 +1,30 @@
#Flamepoint theme
#By CaptainMcClellan
color-link default ""
color-link comment ""
color-link constant ""
color-link constant.bool ""
color-link constant.bool.true ""
color-link constant.bool.false ""
color-link constant.number ""
color-link constant.specialChar ""
color-link constant.string ""
color-link constant.string.url "underline"
color-link identifier ""
color-link identifier.var ""
color-link preproc ""
color-link special ""
color-link statement ""
color-link symbol ""
color-link symbol.brackets ""
color-link symbol.tag ""
color-link type ""
color-link type.keyword ""
color-link error ""
color-link todo ""
color-link cursor-line ""
color-link statusline ""
color-link tabbar ""
color-link color-column ""
color-link gutter-error ""
color-link gutter-warning ""

View File

@ -0,0 +1 @@
#Funky Cactus theme in true colour.

View File

@ -0,0 +1,31 @@
#Funky Cactus theme
color-link comment "bold black"
color-link constant "cyan"
color-link constant.bool "bold cyan"
color-link constant.bool.true "bold green"
color-link constant.bool.false "bold red"
color-link constant.string "yellow"
color-link constant.number "constant"
color-link constant.specialChar "bold magenta"
color-link identifier "bold red"
color-link identifier.macro "bold red"
color-link identifier.var "bold blue"
color-link identifier.class "bold green"
color-link preproc "bold cyan"
color-link statement "bold yellow"
color-link symbol "red"
color-link symbol.brackets "blue"
color-link type "green"
color-link type.keyword "bold green"
color-link special "magenta"
color-link ignore "default"
color-link error "bold ,brightred"
color-link todo "underline ,brightyellow"
color-link indent-char "bold ,brightgreen"
color-link line-number "green"
color-link statusline "black,green"
color-link tabbar "black,magenta"
color-link current-line-number "bold magenta"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link color-column "bold green"

View File

@ -0,0 +1,23 @@
#Gameboy theme
color-link default "#3f3f3f,#bfc180"
color-link comment "#7d7343"
color-link constant "#7d7343"
color-link identifier "#ddde7d"
color-link preproc "#ddde7d,#7d7343"
color-link special "#7d7343"
color-link statement "#7d7343"
color-link symbol "#7d7343"
color-link type "#7d7343"
color-link error "#ddde7d,#7d7343"
color-link todo "#7d7343,#ddde7d"
color-link statusline "#ddde7d,#7d7343"
color-link tabbar "#ddde7d,#7d7343"
color-link color-column "#7d7343"
color-link line-number "#ddde7d,#7d7343"
color-link current-line-number "#3f3f3f,#bfc180"
color-link gutter-error "#ddde7d,#7d7343"
color-link gutter-warning "default"
#3f3f3f
#7d7343
#bfc180
#ddde76

View File

@ -0,0 +1,21 @@
#Geany Alternate theme
color-link default "#000000,#fefefe"
color-link comment "#808080"
color-link constant "default"
color-link constant.bool "#003030"
color-link constant.number "#300008"
color-link constant.string "#008000"
color-link identifier "default"
color-link preproc "#bbbb77"
color-link special "#003030"
color-link statement "#003030"
color-link symbol "#300008"
color-link symbol.tag "bold #4e9d71"
color-link type "#003030"
color-link error "#a52a2a"
color-link todo "#ffa500"
color-link line-number "#000000,#d0d0d0"
color-link current-line-number "#000000,#d0d0d0"
color-link color-column "#c2ebc2"
color-link cursor-line "#f0f0f0"
color-link type.extended "default"

View File

@ -0,0 +1,23 @@
#Geany
color-link comment "red"
color-link constant "default"
color-link constant.number
color-link constant.string "bold yellow"
color-link identifier "default"
color-link preproc "cyan"
color-link special "blue"
color-link statement "blue"
color-link symbol "default"
color-link symbol.tag "bold blue"
color-link type "blue"
color-link type.extended "default"
color-link error "red"
color-link todo "bold cyan"
color-link indent-char "bold black"
color-link line-number ""
color-link current-line-number ""
color-link statusline "black,white"
color-link tabbar "black,white"
color-link color-column "bold geren"
color-link gutter-error ",red"
color-link gutter-warning "red"

View File

@ -0,0 +1,24 @@
#True color theme based on Github's syntax highlighting.
#Warning, this is based on how it rendered in my Firefox!
#Yours may look different.
color-link comment "bold #969896"
color-link constant "#0086B9"
color-link constant.number "#0086B9"
color-link constant.specialChar "bold #1836BD"
color-link constant.string "bold #1836BD"
color-link constant.bool "#0086B9"
color-link identifier "#A71D5D"
color-link preproc "bold #A71D5D"
color-link special "#A71D5D"
color-link statement "#A71D5D"
color-link symbol "default"
color-link type "#A71D5D"
color-link error "bold ,#E34234"
color-link todo "white"
color-link indent-char "default"
color-link line-number "bold #969896"
color-link current-line-number "bold #969896"
color-link gutter-error "bold ,#E34234"
color-link gutter-warning "bold #f26522"
color-link statusline "bold #c8c9cb,#24292e"
color-link tabbar "bold #c8c9cb,#24292e"

View File

@ -0,0 +1,24 @@
#Theme based on Github's syntax highlighting.
color-link comment "bold black"
color-link constant "cyan"
color-link constant.number "cyan"
color-link constant.specialChar "bold blue"
color-link constant.string "bold blue"
color-link constant.bool "cyan"
color-link identifier "magenta"
color-link preproc "bold magenta"
color-link special "magenta"
color-link statement "magenta"
color-link symbol "default"
color-link type "magenta"
color-link error "bold ,brightred"
color-link todo "white"
color-link indent-char "default"
color-link line-number "bold black"
color-link current-line-number "bold black"
color-link gutter-error ",red"
color-link gutter-warning "bold yellow"
color-link statusline "bold white,black"
color-link tabbar "bold white,black"
#Plain brackets.
#color-link symbol.brackets "default"

View File

@ -17,3 +17,5 @@ color-link line-number "#665c54,#282828"
color-link current-line-number "#665c54,#3c3836" color-link current-line-number "#665c54,#3c3836"
color-link cursor-line "#3c3836" color-link cursor-line "#3c3836"
color-link color-column "#79740e" color-link color-column "#79740e"
color-link statusline "#ebdbb2,#665c54"
color-link tabbar "#ebdbb2,#665c54"

View File

@ -15,3 +15,5 @@ color-link line-number "243,237"
color-link current-line-number "172,237" color-link current-line-number "172,237"
color-link cursor-line "237" color-link cursor-line "237"
color-link color-column "237" color-link color-column "237"
color-link statusline "223,237"
color-link tabbar "223,237"

View File

@ -0,0 +1,25 @@
#Midnight Commander inspired theme.
color-link default "white,blue"
color-link comment "bold black"
color-link constant "bold white"
color-link constant.string "bold yellow"
color-link identifier "bold red"
color-link statement "bold cyan"
color-link symbol "white"
color-link symbol.brackets "white"
color-link symbol.tag "bold green"
color-link preproc "black,cyan"
color-link type "green"
color-link special "magenta"
color-link ignore "default"
color-link error ",brightred"
color-link todo ",brightyellow"
color-link indent-char ",cyan"
color-link line-number "green"
color-link statusline "black,cyan"
color-link tabbar "black,cyan"
color-link current-line-number "black,cyan"
color-link cursor-line "black,cyan"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link color-column "cyan"

View File

@ -0,0 +1,5 @@
#Monochrome Paper theme.
#Edit your files on a white background without colors.
color-link default "black,white"
color-link statusline "white,black"
color-link tabbar "white,black"

View File

@ -0,0 +1,3 @@
#Monochrome
#This makes micro use only the terminal's default
# foreground and background colours.

View File

@ -13,6 +13,7 @@ color-link underlined "#D33682,#282828"
color-link error "bold #CB4B16,#282828" color-link error "bold #CB4B16,#282828"
color-link todo "bold #D33682,#282828" color-link todo "bold #D33682,#282828"
color-link statusline "#282828,#F8F8F2" color-link statusline "#282828,#F8F8F2"
color-link tabbar "#282828,#F8F8F2"
color-link indent-char "#505050,#282828" color-link indent-char "#505050,#282828"
color-link line-number "#AAAAAA,#323232" color-link line-number "#AAAAAA,#323232"
color-link current-line-number "#AAAAAA,#282828" color-link current-line-number "#AAAAAA,#282828"
@ -20,3 +21,6 @@ color-link gutter-error "#CB4B16,#282828"
color-link gutter-warning "#E6DB74,#282828" color-link gutter-warning "#E6DB74,#282828"
color-link cursor-line "#323232" color-link cursor-line "#323232"
color-link color-column "#323232" color-link color-column "#323232"
#No extended types; Plain brackets.
color-link type.extended "default"
color-link symbol.brackets "default"

View File

@ -0,0 +1,30 @@
#Colorscheme styled after default Debian nano.
color-link comment "bold blue"
color-link comment.bright "cyan"
color-link constant "red"
color-link constant.bool "yellow"
color-link constant.bool.true "bold green"
color-link constant.bool.false "bold red"
color-link constant.number "default"
color-link constant.specialChar "bold magenta"
color-link constant.string "bold yellow"
color-link identifier "bold blue"
color-link identifier.macro "bold red"
color-link statement "bold green"
color-link symbol "green"
#color-link symbol.tag "blue"
color-link preproc "brightcyan"
color-link type "green"
color-link special "magenta"
color-link ignore "default"
color-link error "white,black"
color-link todo "bold cyan"
color-link indent-char ",green"
color-link line-number "default"
color-link current-line-number "default"
color-link gutter-error ",white"
color-link gutter-warning "white"
color-link cursor-line "default"
color-link color-column "white"
#No extended types ( bool in C ); Plain brackets
color-link type.extended "default"

View File

@ -0,0 +1,30 @@
#NES
#A color theme only using NES pallette colours
color-link default ""
color-link comment ""
color-link constant ""
color-link constant.bool ""
color-link constant.bool.true ""
color-link constant.bool.false ""
color-link constant.number ""
color-link constant.specialChar ""
color-link constant.string ""
color-link constant.string.url "underline"
color-link identifier ""
color-link identifier.var ""
color-link preproc ""
color-link special ""
color-link statement ""
color-link symbol ""
color-link symbol.brackets ""
color-link symbol.tag ""
color-link type ""
color-link type.keyword ""
color-link error ""
color-link todo ""
color-link cursor-line ""
color-link statusline ""
color-link tabbar ""
color-link color-column ""
color-link gutter-error ""
color-link gutter-warning ""

View File

@ -0,0 +1,22 @@
#Paper theme, true color edition
#Edit on an *actual* white background!
color-link default "#000000,#efefef"
color-link comment ""
color-link constant ""
color-link constant.string ""
color-link constant.string.url "underline #0000dd"
color-link identifier ""
color-link identifier.var ""
color-link special ""
color-link statement ""
color-link symbol ""
color-link symbol.brackets ""
color-link symbol.tag ""
color-link type ""
color-link statusline ""
color-link tabbar ""
color-link error ""
color-link todo ""
color-link color-column ""
color-link gutter-error ""
color-link gutter-warning ""

View File

@ -0,0 +1,27 @@
#Paper theme, Edit on a white background.
color-link default "black,white"
color-link comment "bold black"
color-link constant "cyan"
color-link constant.string "bold green"
color-link identifier "blue"
color-link identifier.macro "bold red"
color-link identifier.var "bold blue"
color-link identifier.class "bold green"
color-link statement "green"
color-link symbol "red"
color-link symbol.brackets "default"
color-link symbol.tag "bold blue"
color-link preproc "bold cyan"
color-link type "green"
color-link special "magenta"
color-link ignore "default"
color-link error ",brightred"
color-link todo ",brightyellow"
color-link indent-char ",brightgreen"
color-link line-number "black"
color-link statusline "white,black"
color-link tabbar "white,black"
color-link current-line-number "blue"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link color-column "black"

View File

@ -14,5 +14,12 @@ color-link line-number "yellow"
color-link current-line-number "red" color-link current-line-number "red"
color-link gutter-error ",red" color-link gutter-error ",red"
color-link gutter-warning "red" color-link gutter-warning "red"
color-link cursor-line "white" #Cursor line causes readability issues. Disabled for now.
#color-link cursor-line "white,black"
color-link color-column "white" color-link color-column "white"
#No extended types. (bool in C)
color-link type.extended "default"
#No bracket highlighting.
color-link symbol.brackets "default"
#Color shebangs the comment color
color-link preproc.shebang "comment"

View File

@ -11,6 +11,7 @@ color-link underlined "#D33682,#002833"
color-link error "bold #CB4B16,#002833" color-link error "bold #CB4B16,#002833"
color-link todo "bold #D33682,#002833" color-link todo "bold #D33682,#002833"
color-link statusline "#003541,#839496" color-link statusline "#003541,#839496"
color-link tabbar "#003541,#839496"
color-link indent-char "#586E75,#002833" color-link indent-char "#586E75,#002833"
color-link line-number "#586E75,#003541" color-link line-number "#586E75,#003541"
color-link current-line-number "#586E75,#002833" color-link current-line-number "#586E75,#002833"
@ -18,3 +19,5 @@ color-link gutter-error "#003541,#CB4B16"
color-link gutter-warning "#CB4B16,#002833" color-link gutter-warning "#CB4B16,#002833"
color-link cursor-line "#003541" color-link cursor-line "#003541"
color-link color-column "#003541" color-link color-column "#003541"
color-link type.extended "default"
color-link symbol.brackets "default"

View File

@ -1,19 +1,22 @@
color-link comment "brightgreen" color-link comment "bold brightgreen"
color-link constant "cyan" color-link constant "cyan"
color-link identifier "blue" color-link identifier "blue"
color-link statement "green" color-link statement "green"
color-link symbol "green" color-link symbol "green"
color-link preproc "brightred" color-link preproc "bold brightred"
color-link type "yellow" color-link type "yellow"
color-link special "red" color-link special "red"
color-link underlined "magenta" color-link underlined "magenta"
color-link error "bold brightred" color-link error "bold brightred"
color-link todo "bold magenta" color-link todo "bold magenta"
color-link statusline "black,brightblue" color-link statusline "black,brightblue"
color-link tabbar "black,brightblue"
color-link indent-char "black" color-link indent-char "black"
color-link line-number "brightgreen,black" color-link line-number "bold brightgreen,black"
color-link current-line-number "brightgreen,default" color-link current-line-number "bold brightgreen,default"
color-link gutter-error "black,brightred" color-link gutter-error "black,brightred"
color-link gutter-warning "brightred,default" color-link gutter-warning "brightred,default"
color-link cursor-line "black" color-link cursor-line "black"
color-link color-column "black" color-link color-column "black"
color-link type.extended "default"
color-link symbol.brackets "default"

View File

@ -0,0 +1,23 @@
#Symbian
color-link default "#000000,#ff8a00"
color-link comment "#8c0000"
color-link constant "#8c0000"
color-link identifier "#ffff8c"
color-link preproc "#ffff8c,#8c0000"
color-link special "#8c0000"
color-link statement "#8c0000"
color-link symbol "#8c0000"
color-link type "#8c0000"
color-link error "#ffff8c,#8c0000"
color-link todo "#8c0000,#ffff8c"
color-link statusline "#ffff8c,#8c0000"
color-link tabbar "#ffff8c,#8c0000"
color-link color-column "#8c0000"
color-link line-number "#ffff8c,#8c0000"
color-link current-line-number "#000000,#ff8a00"
color-link gutter-error "#ffff8c,#8c0000"
color-link gutter-warning "default"
#000000
#8c0000
#ff8a00
#ffff8c

View File

@ -13,6 +13,7 @@ color-link underlined "188,237"
color-link error "115,236" color-link error "115,236"
color-link todo "bold 254,237" color-link todo "bold 254,237"
color-link statusline "186,236" color-link statusline "186,236"
color-link tabbar "186,236"
color-link indent-char "238,237" color-link indent-char "238,237"
color-link line-number "248,238" color-link line-number "248,238"
color-link gutter-error "237,174" color-link gutter-error "237,174"

View File

@ -12,6 +12,11 @@ Micro comes with a number of colorschemes by default. Here is the list:
* simple: this is the simplest colorscheme. It uses 16 colors which are * simple: this is the simplest colorscheme. It uses 16 colors which are
set by your terminal set by your terminal
* mc: A 16-color theme based on the look and feel of GNU Midnight Commander.
This will look great used in conjunction with Midnight Commander.
* nano: A 16-color theme loosely based on GNU nano's syntax highlighting.
* monokai: this is the monokai colorscheme; you may recognize it as * monokai: this is the monokai colorscheme; you may recognize it as
Sublime Text's default colorscheme. It requires true color to Sublime Text's default colorscheme. It requires true color to
look perfect, but the 256 color approximation looks very good as well. look perfect, but the 256 color approximation looks very good as well.
@ -29,15 +34,47 @@ Micro comes with a number of colorschemes by default. Here is the list:
* atom-dark-tc: this colorscheme is based off of Atom's "dark" colorscheme. * atom-dark-tc: this colorscheme is based off of Atom's "dark" colorscheme.
It requires true color to look good. It requires true color to look good.
* cmc-16: A very nice 16-color theme. Written by contributor CaptainMcClellan
(Collin Warren.) Licensed under the same license as the rest of the themes.
* cmc-paper: Basically cmc-16, but on a white background. ( Actually light grey on most
ANSI (16-color) terminals.)
* cmc-tc: A true colour variant of the cmc theme.
It requires true color to look its best. Use cmc-16 if your terminal doesn't support true color.
* codeblocks: A colorscheme based on the Code::Blocks IDE's default syntax highlighting.
* codeblocks-paper: Same as codeblocks, but on a white background. ( Actually light grey. )
* github-tc: A colorscheme based on Github's syntax highlighting. Requires true color to look its best.
* paper-tc: A nice minimalist theme with a light background, good for editing documents on.
Requires true color to look its best. Not to be confused with `-paper` suffixed themes.
* geany: Colorscheme based on geany's default highlighting.
* geany-alt-tc: Based on an alternate theme bundled with geany.
* flamepoint-tc: A fire inspired, high intensity true color theme written by CaptainMcClellan.
As with all the other `-tc` suffixed themes, it looks its best on a
To enable one of these colorschemes just press CtrlE in micro and type `set colorscheme solarized`. To enable one of these colorschemes just press CtrlE in micro and type `set colorscheme solarized`.
(or whichever one you choose). (or whichever one you choose). You can also use `set colorscheme monochrome` if you'd prefer
to have just the terminal's default foreground and background colors.
Note: This provides no syntax highlighting!
See `help gimmickcolors` for a list of some true colour themes that are more
just for fun than for serious use. ( Though feel free if you want! )
--- ---
### Creating a Colorscheme
Micro's colorschemes are also extremely simple to create. The default ones can be found Micro's colorschemes are also extremely simple to create. The default ones can be found
[here](https://github.com/zyedidia/micro/tree/master/runtime/colorschemes). [here](https://github.com/zyedidia/micro/tree/master/runtime/colorschemes).
They are only about 18 lines in total. They are only about 18-30 lines in total.
Basically to create the colorscheme you need to link highlight groups with actual colors. Basically to create the colorscheme you need to link highlight groups with actual colors.
This is done using the `color-link` command. This is done using the `color-link` command.
@ -84,7 +121,8 @@ If the user's terminal supports true color, then you can also specify colors exa
their hex codes. If the terminal is not true color but micro is told to use a true color colorscheme their hex codes. If the terminal is not true color but micro is told to use a true color colorscheme
it will attempt to map the colors to the available 256 colors. it will attempt to map the colors to the available 256 colors.
Generally colorschemes which require true color terminals to look good are marked with a `-tc` suffix. Generally colorschemes which require true color terminals to look good are marked with a `-tc` suffix
and colorschemes which supply a white background are marked with a `-paper` suffix.
--- ---
@ -102,22 +140,74 @@ Here is a list of the colorscheme groups that you can use:
* underlined * underlined
* error * error
* todo * todo
* statusline (color of the statusline) * statusline ( Color of the statusline)
* indent-char (color of the character which indicates tabs if the option is enabled) * tabbar ( Color of the tabbar that lists open files.)
* indent-char ( Color of the character which indicates tabs if the option is enabled)
* line-number * line-number
* gutter-error * gutter-error
* gutter-warning * gutter-warning
* cursor-line * cursor-line
* current-line-number * current-line-number
* color-column * color-column
* ignore
* divider ( Color of the divider between vertical splits. )
Colorschemes can be placed in the `~/.config/micro/colorschemes` directory to be used. Colorschemes must be placed in the `~/.config/micro/colorschemes` directory to be used.
---
In addition to the main colorscheme groups, there are subgroups that you can
specify by adding `.subgroup` to the group. If you're creating your own
custom syntax files, you can make use of your own subgroups.
If micro can't match the subgroup, it'll default to the root group, so
it's safe and recommended to use subgroups in your custom syntax files.
For example if `constant.string` is found in your colorscheme, micro will
use that for highlighting strings. If it's not found, it will use constant
instead. Micro tries to match the largest set of groups it can find in the
colorscheme definitions, so if, for examle `constant.bool.true` is found then
micro will use that. If `constant.bool.true` is not found but `constant.bool`
is found micro will use `constant.bool`. If not, it uses `constant`.
Here's a list of subgroups used in micro's built-in syntax files.
* comment.bright ( Some filetypes have distinctions between types of comments.)
* constant.bool
* constant.bool.true
* constant.bool.false
* constant.number
* constant.specialChar
* constant.string
* constant.string.url
* identifier.class ( Also used for functions. )
* identifier.macro
* identifier.var
* preproc.shebang ( The #! at the beginning of a file that tells the os what script interpreter to use. )
* symbol.brackets ( {}()[] and sometimes <> )
* symbol.operator ( Color operator symbols differently. )
* symbol.tag ( For html tags, among other things.)
* type.keyword ( If you want a special highlight for keywords like `private` )
In the future, plugins may also be able to use color groups for styling.
### Syntax files ### Syntax files
The syntax files specify how to highlight certain languages. The syntax files specify how to highlight certain languages.
<<<<<<< HEAD
Syntax files are specified in the yaml format. Syntax files are specified in the yaml format.
=======
Micro's builtin syntax highlighting tries very hard to be sane, sensible
and provide ample coverage of the meaningful elements of a language. Micro has
syntax files built int for over 100 languages now. However, there may be
situations where you find Micro's highlighting to be insufficient or not to
your liking. Good news is you can create syntax files (.micro extension), place them in
`~/.config/micro/syntax` and Micro will use those instead.
The first statement in a syntax file will probably the syntax statement. This tells micro
what language the syntax file is for and how to detect a file in that language.
>>>>>>> master
#### Filetype defintion #### Filetype defintion
@ -209,3 +299,7 @@ for html:
rules: rules:
- include: "css" - include: "css"
``` ```
Note: The format of syntax files will be changing with the view refactor.
If this help file still retains this note but the syntax files are yaml
please open an issue.

141
runtime/help/defaultkeys.md Normal file
View File

@ -0,0 +1,141 @@
#Default Keys
Below are simple charts of the default hotkeys and their functions.
For more information about binding custom hotkeys or changing
default bindings, please run `>help keybindings`
Please remember that *all* keys here are rebindable!
If you don't like it, you can change it!
(We are not responsible for you forgetting what you bind keys to.
Do not open an issue because you forgot your keybindings.)
#Power user
+--------+---------------------------------------------------------+
| Ctrl+E | Switch to the micro command prompt to run a command. |
| | (See `>help commands` for a list of commands. ) |
+--------+---------------------------------------------------------+
| Ctrl+B | Run shell commands in micro's current working directory.|
+--------+---------------------------------------------------------+
#Navigation
+--------+---------------------------------------------------------+
| Key | Description of function |
|--------+---------------------------------------------------------+
| Arrows | Move the cursor around your current document. |
| | (Yes this is rebindable to the vim keys if you want.) |
+--------+---------------------------------------------------------+
| Shift+ | Move and select text. |
| Arrows | |
+--------+---------------------------------------------------------+
| Home | Move to the beginning of the current line. (Naturally.) |
+--------+---------------------------------------------------------+
| End | Move to the end of the current line. |
+--------+---------------------------------------------------------+
| PageUp | Move cursor up lines quickly. |
+--------+---------------------------------------------------------+
| PageDn | Move cursor down lines quickly. |
+--------+---------------------------------------------------------+
| Ctrl+L | Jump to line in current file. ( Prompts for line # ) |
+--------+---------------------------------------------------------+
| Ctrl+W | Move between splits open in current tab. |
| | (See vsplit and hsplit in `>help commands`) |
+--------+---------------------------------------------------------+
| Ctrl+T | Open a new tab. |
+--------+---------------------------------------------------------+
| Alt+, | Move to the previous tab in the tablist. |
| | (This works like moving between file buffers in nano) |
+--------+---------------------------------------------------------+
| Alt+. | Move to the next tab in the tablist. |
+--------+---------------------------------------------------------+
#Find Operations
+--------+---------------------------------------------------------+
| Ctrl+F | Find text in current file. ( Prompts for text to find.) |
+--------+---------------------------------------------------------+
| Ctrl+N | Find next instance of current search in current file. |
+--------+---------------------------------------------------------+
| Ctrl+P | Find prev instance of current search in current file. |
+--------+---------------------------------------------------------+
#File Operations
+--------+---------------------------------------------------------+
| Ctrl+Q | Close current file. ( Quits micro if last file open. ) |
+--------+---------------------------------------------------------+
| Ctrl+O | Open a file. ( Prompts you to input filename. ) |
+--------+---------------------------------------------------------+
| Ctrl+S | Save current file. |
+--------+---------------------------------------------------------+
#Text operations
+--------+---------------------------------------------------------+
| Ctrl+A | Select all text in current file. |
+--------+---------------------------------------------------------+
| Ctrl+X | Cut selected text. |
+--------+---------------------------------------------------------+
| Ctrl+C | Copy selected text. |
+--------+---------------------------------------------------------+
| Ctrl+V | Paste selected text. |
+--------+---------------------------------------------------------+
| Ctrl+K | Cut current line. ( Can then be pasted with Ctrl+V) |
+--------+---------------------------------------------------------+
| Ctrl+D | Duplicate current line. |
+--------+---------------------------------------------------------+
| Ctrl+Z | Undo actions. |
+--------+---------------------------------------------------------+
| Ctrl+Y | Redo actions. |
+--------+---------------------------------------------------------+
#Other
+--------+---------------------------------------------------------+
| Ctrl+G | Open the help file. |
+--------+---------------------------------------------------------+
| Ctrl+H | Alternate backspace. |
| | (Some old terminals don't support the Backspace key .) |
+--------+---------------------------------------------------------+
| Ctrl+R | Toggle the line number ruler. ( On the lefthand side.) |
+--------+---------------------------------------------------------+
#Emacs style actions
+--------+---------------------------------------------------------+
| Alt+F | Move to the end of the next word. (To the next space.) |
+--------+---------------------------------------------------------+
| Alt+B | Move to the beginning of the previous word. |
+--------+---------------------------------------------------------+
| Alt+A | Alternate Home key. ( Move to beginning of line. ) |
+--------+---------------------------------------------------------+
| Alt+E | Alternate End key. ( Move to the end of line.) |
+--------+---------------------------------------------------------+
| Alt+P | Move cursor up. ( Same as up key. ) |
+--------+---------------------------------------------------------+
| Alt+N | Move cursor down. ( Same as down key. ) |
+--------+---------------------------------------------------------+
#Function keys.
Warning! The function keys may not work in all terminals!
+--------+---------------------------------------------------------+
| F1 | Open help. |
+--------+---------------------------------------------------------+
| F2 | Save current file. |
+--------+---------------------------------------------------------+
| F3 | Find in current file. ( Same as Ctrl+F ) |
+--------+---------------------------------------------------------+
| F4 | Close current file. (Quit if only file.) |
+--------+---------------------------------------------------------+
| F7 | Find in current file. (Same as Ctrl+F) |
+--------+---------------------------------------------------------+
| F10 | Close current file. |
+--------+---------------------------------------------------------+
#Macros
Micro supports the use of keyboard macros. Simply press Ctrl+U to
begin recording a macro and press Ctrl+U to stop recording.
Press Ctrl+J to run your recorded macro.

View File

@ -0,0 +1,14 @@
# Gimmick colors
We have included a few colorschemes that are for fun:
* funky-cactus: I don't know why I made this. (Written by CaptainMcClellan)
* gameboy-tc: Colorscheme based on the olive green original Gameboy!
* nes-tc: A colorscheme and syntax highlighting using only colors in the
Nintendo Entertainment System color palette.
* symbian-tc: Colorscheme based on SymbOS's GUI.
* matrix: Pretend it's 1981 with a colorscheme based on a monochrome
IBM 5151. ( Does not include the ghosting and trailing. )
Check the plugin repo periodically for gimmick-color extension packs
and genuine additional themes.

View File

@ -1,5 +1,6 @@
# Micro help text # Micro help text
Thank you for downloading and using micro.
Micro is a terminal-based text editor that aims to be easy to use and intuitive, 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. while also taking advantage of the full capabilities of modern terminals.
@ -14,7 +15,9 @@ and you can see which commands are available by pressing tab, or by
viewing the help topic `> help commands`. When I write `> ...` I mean press viewing the help topic `> help commands`. When I write `> ...` I mean press
CtrlE and then type whatever is there. CtrlE and then type whatever is there.
Move the cursor around with the mouse or the arrow keys. Move the cursor around with the mouse or the arrow keys. Type `>help defaultkeys` to
get a quick, easy overview of the default hotkeys and what they do. For more info
on rebinding keys, see type `>help keybindings`
If the colorscheme doesn't look good, you can change it with `> set colorscheme ...`. If the colorscheme doesn't look good, you can change it with `> set colorscheme ...`.
You can press tab to see the available colorschemes, or see more information with You can press tab to see the available colorschemes, or see more information with
@ -34,6 +37,7 @@ Here are the possible help topics that you can read:
* tutorial: A brief tutorial which gives an overview of all the other help topics * tutorial: A brief tutorial which gives an overview of all the other help topics
* keybindings: Gives a full list of the default keybindings as well as how to rebind them * keybindings: Gives a full list of the default keybindings as well as how to rebind them
* defaultkeys: Gives a more straight-forward list of the hotkey commands and what they do.
* commands: Gives a list of all the commands and what they do * commands: Gives a list of all the commands and what they do
* options: Gives a list of all the options you can customize * options: Gives a list of all the options you can customize
* plugins: Explains how micro's plugin system works and how to create your own plugins * plugins: Explains how micro's plugin system works and how to create your own plugins

View File

@ -1,89 +1,15 @@
# Keybindings # Keybindings
Here are the default keybindings in json format. You can rebind them to your liking, following the same format. Micro has a plethora of hotkeys that make it easy and powerful to use and all
hotkeys are fully customizable to your liking.
Custom keybindings are stored internally in micro if changed with the `>bind` command or
you can also be added in the file `~/.config/micro/bindings.json` as discussed below.
For a list of the default keybindings in the json format used by micro, please see
the end of this file. For a more user-friendly list with explanations of what the default
hotkeys are and what they do, please see `>help defaultkeys`
```json If `~/.config/micro/bindings.json` does not exist, you can simply create it.
{ Micro will know what to do with it.
"Up": "CursorUp",
"Down": "CursorDown",
"Right": "CursorRight",
"Left": "CursorLeft",
"ShiftUp": "SelectUp",
"ShiftDown": "SelectDown",
"ShiftLeft": "SelectLeft",
"ShiftRight": "SelectRight",
"AltLeft": "WordLeft",
"AltRight": "WordRight",
"AltShiftRight": "SelectWordRight",
"AltShiftLeft": "SelectWordLeft",
"AltUp": "MoveLinesUp",
"AltDown": "MoveLinesDown",
"CtrlLeft": "StartOfLine",
"CtrlRight": "EndOfLine",
"CtrlShiftLeft": "SelectToStartOfLine",
"CtrlShiftRight": "SelectToEndOfLine",
"CtrlUp": "CursorStart",
"CtrlDown": "CursorEnd",
"CtrlShiftUp": "SelectToStart",
"CtrlShiftDown": "SelectToEnd",
"Enter": "InsertNewline",
"Space": "InsertSpace",
"CtrlH": "Backspace",
"Backspace": "Backspace",
"Alt-CtrlH": "DeleteWordLeft",
"Alt-Backspace": "DeleteWordLeft",
"Tab": "IndentSelection,InsertTab",
"Backtab": "OutdentSelection",
"CtrlO": "OpenFile",
"CtrlS": "Save",
"CtrlF": "Find",
"CtrlN": "FindNext",
"CtrlP": "FindPrevious",
"CtrlZ": "Undo",
"CtrlY": "Redo",
"CtrlC": "Copy",
"CtrlX": "Cut",
"CtrlK": "CutLine",
"CtrlD": "DuplicateLine",
"CtrlV": "Paste",
"CtrlA": "SelectAll",
"CtrlT": "AddTab",
"CtrlRightSq": "PreviousTab",
"CtrlBackslash": "NextTab",
"Home": "StartOfLine",
"End": "EndOfLine",
"CtrlHome": "CursorStart",
"CtrlEnd": "CursorEnd",
"PageUp": "CursorPageUp",
"PageDown": "CursorPageDown",
"CtrlG": "ToggleHelp",
"CtrlR": "ToggleRuler",
"CtrlL": "JumpLine",
"Delete": "Delete",
"CtrlB": "ShellMode",
"CtrlQ": "Quit",
"CtrlE": "CommandMode",
"CtrlW": "NextSplit",
"CtrlU": "ToggleMacro",
"CtrlJ": "PlayMacro",
// Emacs-style keybindings
"Alt-f": "WordRight",
"Alt-b": "WordLeft",
"Alt-a": "StartOfLine",
"Alt-e": "EndOfLine",
"Alt-p": "CursorUp",
"Alt-n": "CursorDown",
// Integration with file managers
"F1": "ToggleHelp",
"F2": "Save",
"F4": "Quit",
"F7": "Find",
"F10": "Quit",
"Esc": "Escape",
}
```
You can use the alt keys + arrows to move word by word. You can use the alt keys + arrows to move word by word.
Ctrl left and right move the cursor to the start and end of the line, and Ctrl left and right move the cursor to the start and end of the line, and
@ -106,6 +32,9 @@ following in the `bindings.json` file.
} }
``` ```
In addition to editing your `~/.config/micro/bindings.json`, you can run
`>bind <keycombo> <action>` For a list of bindable actions, see below.
You can also chain commands when rebinding. For example, if you want Alt-s to save You can also chain commands when rebinding. For example, if you want Alt-s to save
and quit you can bind it like so: and quit you can bind it like so:
@ -332,6 +261,93 @@ Escape
Enter Enter
``` ```
# Default keybinding configuration.
```json
{
"Up": "CursorUp",
"Down": "CursorDown",
"Right": "CursorRight",
"Left": "CursorLeft",
"ShiftUp": "SelectUp",
"ShiftDown": "SelectDown",
"ShiftLeft": "SelectLeft",
"ShiftRight": "SelectRight",
"AltLeft": "WordLeft",
"AltRight": "WordRight",
"AltShiftRight": "SelectWordRight",
"AltShiftLeft": "SelectWordLeft",
"AltUp": "MoveLinesUp",
"AltDown": "MoveLinesDown",
"CtrlLeft": "StartOfLine",
"CtrlRight": "EndOfLine",
"CtrlShiftLeft": "SelectToStartOfLine",
"CtrlShiftRight": "SelectToEndOfLine",
"CtrlUp": "CursorStart",
"CtrlDown": "CursorEnd",
"CtrlShiftUp": "SelectToStart",
"CtrlShiftDown": "SelectToEnd",
"Enter": "InsertNewline",
"Space": "InsertSpace",
"CtrlH": "Backspace",
"Backspace": "Backspace",
"Alt-CtrlH": "DeleteWordLeft",
"Alt-Backspace": "DeleteWordLeft",
"Tab": "IndentSelection,InsertTab",
"Backtab": "OutdentSelection",
"CtrlO": "OpenFile",
"CtrlS": "Save",
"CtrlF": "Find",
"CtrlN": "FindNext",
"CtrlP": "FindPrevious",
"CtrlZ": "Undo",
"CtrlY": "Redo",
"CtrlC": "Copy",
"CtrlX": "Cut",
"CtrlK": "CutLine",
"CtrlD": "DuplicateLine",
"CtrlV": "Paste",
"CtrlA": "SelectAll",
"CtrlT": "AddTab",
"Alt,": "PreviousTab",
"Alt.": "NextTab",
"Home": "StartOfLine",
"End": "EndOfLine",
"CtrlHome": "CursorStart",
"CtrlEnd": "CursorEnd",
"PageUp": "CursorPageUp",
"PageDown": "CursorPageDown",
"CtrlG": "ToggleHelp",
"CtrlR": "ToggleRuler",
"CtrlL": "JumpLine",
"Delete": "Delete",
"CtrlB": "ShellMode",
"CtrlQ": "Quit",
"CtrlE": "CommandMode",
"CtrlW": "NextSplit",
"CtrlU": "ToggleMacro",
"CtrlJ": "PlayMacro",
// Emacs-style keybindings
"Alt-f": "WordRight",
"Alt-b": "WordLeft",
"Alt-a": "StartOfLine",
"Alt-e": "EndOfLine",
"Alt-p": "CursorUp",
"Alt-n": "CursorDown",
// Integration with file managers
"F1": "ToggleHelp",
"F2": "Save",
"F3": "Find",
"F4": "Quit",
"F7": "Find",
"F10": "Quit",
"Esc": "Escape",
}
```
#Final notes
Note: On some old terminal emulators and on Windows machines, `CtrlH` should be used Note: On some old terminal emulators and on Windows machines, `CtrlH` should be used
for backspace. for backspace.

22
runtime/syntax/LICENSE Normal file
View File

@ -0,0 +1,22 @@
Micro's syntax files are licensed under the MIT "Expat" License:
Copyright (c) 2016: Zachary Yedidia, Collin Warren, et al.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
# Syntax Files # Syntax Files
Here are micro's syntax files. Here are micro's syntax files.
@ -25,3 +26,45 @@ Most the the syntax files here have been converted using that tool.
Note that the tool isn't perfect and though it is unlikely, you may run into some small issues that you will have to fix manually Note that the tool isn't perfect and though it is unlikely, you may run into some small issues that you will have to fix manually
(about 4 files from this directory had issues after being converted). (about 4 files from this directory had issues after being converted).
=======
# Micro syntax highlighting files
These are the syntax highlighting files for micro. To install them, just
put all the syntax files in `~/.config/micro/syntax`.
They are taken from Nano, specifically from [this repository](https://github.com/scopatz/nanorc).
Micro syntax files are almost identical to Nano's, except for some key differences:
* Micro does not use `icolor`. Instead, for a case insensitive match, use the case insensitive flag (`i`) in the regular expression
* For example, `icolor green ".*"` would become `color green "(?i).*"`
# Using with colorschemes
Not all of these files have been converted to use micro's colorscheme feature. Most of them just hardcode the colors, which can be problematic depending on the colorscheme you use.
Here is a list of the files that have been converted to properly use colorschemes:
* vi
* go
* c
* d
* markdown
* html
* lua
* swift
* rust
* java
* javascript
* pascal
* python
* ruby
* sh
* git
* tex
* solidity
# License
Because the nano syntax files I have modified are distributed under the GNU GPLv3 license, these files are also distributed
under that license. See [LICENSE](LICENSE).
>>>>>>> master

62
tools/build-deb.sh Executable file
View File

@ -0,0 +1,62 @@
# Builds two .deb packages, for x86 (i386) and x86_64 (amd64)
# These packages are the bare minimum, which means that they can be installed
# But they do not feature everything yet.
# This does not mean that the editor itself is affected.
function getControl() {
echo Section: editors
echo Package: micro
echo Version: $2
echo Priority: extra
echo Maintainer: \"Zachary Yedidia\" \<zyedidia@gmail.com\>
echo Standards-Version: 3.9.8
echo Homepage: https://micro-editor.github.io/
echo Architecture: $1
echo "Description: A modern and intuitive terminal-based text editor"
echo " This package contains a modern alternative to other terminal-based"
echo " Editors. It is easy to Use, highly customizable via themes and plugins"
echo " and it supports mouse input"
}
function installFiles() {
TO="$1/$2/usr/share/doc/micro/"
mkdir -p $TO
cp ../LICENSE $TO
cp ../LICENSE-THIRD-PARTY $TO
cp ../README.md $TO
}
version=$1
if [ "$1" == "" ]
then
version=$(go run build-version.go)
fi
echo "Building packages for Version '$version'"
echo "Running Cross-Compile"
./cross-compile.sh $version
echo "Beginning package build process"
PKGPATH="../packages/deb"
rm -fr ../packages
mkdir -p $PKGPATH/amd64/DEBIAN/
mkdir -p $PKGPATH/i386/DEBIAN/
getControl "amd64" "$version" > $PKGPATH/amd64/DEBIAN/control
tar -xzf "../binaries/micro-$version-linux64.tar.gz" "micro-$version/micro"
mkdir -p $PKGPATH/amd64/usr/local/bin/
mv "micro-$version/micro" "$PKGPATH/amd64/usr/local/bin/"
getControl "i386" "$version" > $PKGPATH/i386/DEBIAN/control
tar -xzf "../binaries/micro-$version-linux32.tar.gz" "micro-$version/micro"
mkdir -p $PKGPATH/i386/usr/local/bin/
mv "micro-$version/micro" "$PKGPATH/i386/usr/local/bin/"
rm -rf "micro-$version"
installFiles $PKGPATH "amd64"
installFiles $PKGPATH "i386"
dpkg -b "$PKGPATH/amd64/" "../packages/micro-$version-amd64.deb"
dpkg -b "$PKGPATH/i386/" "../packages/micro-$version-i386.deb"