mirror of
https://github.com/micro-editor/micro.git
synced 2026-10-12 02:18:55 +00:00
add languages to fenced code blocks in docs (#4227)
This commit is contained in:
@@ -73,7 +73,7 @@ To uninstall micro, simply remove the binary, and the configuration directory at
|
||||
|
||||
#### Third-party quick-install script
|
||||
|
||||
```bash
|
||||
```sh
|
||||
curl https://getmic.ro | bash
|
||||
```
|
||||
|
||||
@@ -83,13 +83,13 @@ The script will place the micro binary in the current directory. From there, you
|
||||
|
||||
With [Eget](https://github.com/zyedidia/eget) installed, you can easily get a pre-built binary:
|
||||
|
||||
```
|
||||
```sh
|
||||
eget micro-editor/micro
|
||||
```
|
||||
|
||||
Use `--tag VERSION` to download a specific tagged version.
|
||||
|
||||
```
|
||||
```sh
|
||||
eget --tag nightly micro-editor/micro # download the nightly version (compiled every day at midnight UTC)
|
||||
eget --tag v2.0.8 micro-editor/micro # download version 2.0.8 rather than the latest release
|
||||
```
|
||||
@@ -102,7 +102,7 @@ See [Eget](https://github.com/zyedidia/eget) for more information.
|
||||
|
||||
You can install micro using Homebrew on Mac:
|
||||
|
||||
```
|
||||
```sh
|
||||
brew install micro
|
||||
```
|
||||
|
||||
@@ -112,7 +112,7 @@ the section on [macOS terminals](https://github.com/micro-editor/micro#macos-ter
|
||||
|
||||
On Linux, you can install micro through [snap](https://snapcraft.io/docs/installing-snapd)
|
||||
|
||||
```
|
||||
```sh
|
||||
snap install micro --classic
|
||||
```
|
||||
|
||||
@@ -163,7 +163,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.19 or greater and Go modules are enabled.
|
||||
|
||||
```
|
||||
```sh
|
||||
git clone https://github.com/micro-editor/micro
|
||||
cd micro
|
||||
make build
|
||||
@@ -184,7 +184,7 @@ and doesn't disable debug mode.
|
||||
By default, the micro binary is linked statically to increase the portability of the prebuilt binaries.
|
||||
This behavior can simply be overridden by providing `CGO_ENABLED=1` to the build target.
|
||||
|
||||
```
|
||||
```sh
|
||||
CGO_ENABLED=1 make build
|
||||
```
|
||||
|
||||
@@ -231,7 +231,7 @@ than the Windows default.
|
||||
Cygwin, Mingw, and Plan9 are unfortunately not officially supported. In Cygwin and Mingw, micro will often work when run using
|
||||
the `winpty` utility:
|
||||
|
||||
```
|
||||
```sh
|
||||
winpty micro.exe ...
|
||||
```
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ place them in `~/.config/micro/syntax` and Micro will use those instead.
|
||||
|
||||
You must start the syntax file by declaring the filetype:
|
||||
|
||||
```
|
||||
```yaml
|
||||
filetype: go
|
||||
```
|
||||
|
||||
@@ -280,7 +280,7 @@ filetype: go
|
||||
|
||||
Then you must provide information about how to detect the filetype:
|
||||
|
||||
```
|
||||
```yaml
|
||||
detect:
|
||||
filename: "\\.go$"
|
||||
```
|
||||
@@ -290,7 +290,7 @@ Micro will match this regex against a given filename to detect the filetype.
|
||||
In addition to the `filename` regex (or even instead of it) you can provide
|
||||
a `header` regex that will check the first line of the file. For example:
|
||||
|
||||
```
|
||||
```yaml
|
||||
detect:
|
||||
filename: "\\.ya?ml$"
|
||||
header: "%YAML"
|
||||
@@ -316,7 +316,7 @@ filetype will be preferred over other matching filetypes.
|
||||
For example, to distinguish C++ header files from C and Objective-C header files
|
||||
that have the same `.h` extension:
|
||||
|
||||
```
|
||||
```yaml
|
||||
detect:
|
||||
filename: "\\.c(c|pp|xx)$|\\.h(h|pp|xx)?$"
|
||||
signature: "namespace|template|public|protected|private"
|
||||
@@ -331,7 +331,7 @@ lines and may have rules of its own inside the region.
|
||||
|
||||
Here are some example patterns in Go:
|
||||
|
||||
```
|
||||
```yaml
|
||||
rules:
|
||||
- special: "\\b(break|case|continue|default|go|goto|range|return)\\b"
|
||||
- statement: "\\b(else|for|if|switch)\\b"
|
||||
@@ -343,7 +343,7 @@ the ones defined above them.
|
||||
|
||||
And here are some example regions for Go:
|
||||
|
||||
```
|
||||
```yaml
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
@@ -375,7 +375,7 @@ string ends at the correct place.
|
||||
You may also explicitly mark skip regexes if you don't want them to be
|
||||
highlighted. For example:
|
||||
|
||||
```
|
||||
```yaml
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
@@ -387,7 +387,7 @@ highlighted. For example:
|
||||
You may also include rules from other syntax files as embedded languages. For
|
||||
example, the following is possible for html:
|
||||
|
||||
```
|
||||
```yaml
|
||||
- default:
|
||||
start: "<script.*?>"
|
||||
end: "</script.*?>"
|
||||
@@ -417,7 +417,7 @@ For example, if you work with various config files that use the `#` sign to mark
|
||||
the beginning of a comment, you can use the following custom `default.yaml` to
|
||||
highlight those comments by default:
|
||||
|
||||
```
|
||||
```yaml
|
||||
filetype: unknown
|
||||
|
||||
detect:
|
||||
|
||||
+11
-11
@@ -28,7 +28,7 @@ Each key is bound to an action.
|
||||
For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the
|
||||
following in the `bindings.json` file.
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Ctrl-y": "Undo",
|
||||
"Ctrl-z": "Redo"
|
||||
@@ -47,7 +47,7 @@ In addition to editing your `~/.config/micro/bindings.json`, you can run
|
||||
You can also chain commands when rebinding. For example, if you want `Alt-s` to
|
||||
save and quit you can bind it like so:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Alt-s": "Save,Quit"
|
||||
}
|
||||
@@ -60,7 +60,7 @@ will abort the chain if the action preceding it succeeds, and the `&` will
|
||||
abort the chain if the action preceding it fails. For example, in the default
|
||||
bindings, tab is bound as
|
||||
|
||||
```
|
||||
```jsonc
|
||||
"Tab": "Autocomplete|IndentSelection|InsertTab"
|
||||
```
|
||||
|
||||
@@ -82,7 +82,7 @@ callbacks returned true.
|
||||
You can also bind a key to execute a command in command mode (see
|
||||
`help commands`). Simply prepend the binding with `command:`. For example:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Alt-p": "command:pwd"
|
||||
}
|
||||
@@ -102,7 +102,7 @@ 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 `Ctrl-g` to `> help`:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Ctrl-g": "command-edit:help "
|
||||
}
|
||||
@@ -117,7 +117,7 @@ cursor placement).
|
||||
You can also bind a key to a Lua function provided by a plugin, or by your own
|
||||
`~/.config/micro/init.lua`. For example:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Alt-q": "lua:foo.bar"
|
||||
}
|
||||
@@ -150,7 +150,7 @@ The return value of the lua function defines whether the action has succeeded.
|
||||
This is used when chaining lua functions with other actions. They can be chained
|
||||
the same way as regular actions as described above, for example:
|
||||
|
||||
```
|
||||
```jsonc
|
||||
"Alt-q": "lua:initlua.bar|Quit"
|
||||
```
|
||||
|
||||
@@ -177,7 +177,7 @@ sequences you define. Then from micro you can directly bind those escape
|
||||
sequences to actions. For example, to bind `CtrlBackspace` you can instruct
|
||||
your terminal to send `\x1bctrlback` and then bind it in `bindings.json`:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"\u001bctrlback": "DeleteWordLeft"
|
||||
}
|
||||
@@ -522,7 +522,7 @@ A select few keybindings are different on MacOS compared to other
|
||||
operating systems. This is because different OSes have different
|
||||
conventions for text editing defaults.
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Up": "CursorUp",
|
||||
"Down": "CursorDown",
|
||||
@@ -646,7 +646,7 @@ conventions for text editing defaults.
|
||||
Keybindings can be specified for different pane types as well. For example, to
|
||||
make a binding that only affects the command bar, use the `command` subgroup:
|
||||
|
||||
```
|
||||
```jsonc
|
||||
{
|
||||
"command": {
|
||||
"Ctrl-w": "WordLeft"
|
||||
@@ -658,7 +658,7 @@ The possible pane types are `buffer` (normal buffer), `command` (command bar),
|
||||
and `terminal` (terminal pane). The defaults for the command and terminal panes
|
||||
are given below:
|
||||
|
||||
```
|
||||
```jsonc
|
||||
{
|
||||
"terminal": {
|
||||
"<Ctrl-q><Ctrl-q>": "Exit",
|
||||
|
||||
@@ -556,7 +556,7 @@ at `~/.config/micro`), and should contain only options which have been modified
|
||||
from their default setting. Here is the full list of options in json format,
|
||||
so that you can see what the formatting should look like.
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"autoclose": true,
|
||||
"autoindent": true,
|
||||
@@ -659,7 +659,7 @@ In the `settings.json` file you can also put set options locally by specifying
|
||||
either a glob or a filetype. Here is an example which has `tabstospaces` on for
|
||||
all files except Go files, and `tabsize` 4 for all files except Ruby files:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"ft:go": {
|
||||
"tabstospaces": false
|
||||
@@ -674,7 +674,7 @@ all files except Go files, and `tabsize` 4 for all files except Ruby files:
|
||||
|
||||
Or similarly you can match with globs:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"glob:*.go": {
|
||||
"tabstospaces": false
|
||||
@@ -689,7 +689,7 @@ Or similarly you can match with globs:
|
||||
|
||||
You can also omit the `glob:` prefix before globs:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"*.go": {
|
||||
"tabstospaces": false
|
||||
|
||||
@@ -519,7 +519,7 @@ If you'd like to publish a plugin you've made as an official plugin, you should
|
||||
upload your plugin online (preferably to Github) and add a `repo.json` file.
|
||||
This file will contain the metadata for your plugin. Here is an example:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
[{
|
||||
"Name": "pluginname",
|
||||
"Description": "Here is a nice concise description of my plugin",
|
||||
|
||||
@@ -29,7 +29,7 @@ the current buffer. Also micro will not save this local change to the
|
||||
`settings.json` file. For example, if you want the `tabsize` to be 2 only in
|
||||
Ruby files, and 4 otherwise, you could put the following in `settings.json`:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"*.rb": {
|
||||
"tabsize": 2
|
||||
@@ -51,7 +51,7 @@ Keybindings work in much the same way as options. You configure them using the
|
||||
For example if you would like to bind `Ctrl-r` to redo you could put the
|
||||
following in `bindings.json`:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Ctrl-r": "Redo"
|
||||
}
|
||||
@@ -102,7 +102,7 @@ end
|
||||
Alternatively, you could get rid of the `TryBindKey` line, and put this line in
|
||||
the `bindings.json` file:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Ctrl-r": "lua:initlua.gorun"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ and `CtrlUnderscore`, which is equivalent in most terminals
|
||||
to `Ctrl-/`. You can easily modify that in your `bindings.json`
|
||||
file:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"Alt-g": "lua:comment.comment"
|
||||
}
|
||||
@@ -88,7 +88,7 @@ set comment.type "/* %s */"
|
||||
|
||||
Or in your `settings.json`:
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"*.c": {
|
||||
"comment.type": "/* %s */"
|
||||
|
||||
@@ -13,7 +13,7 @@ You can read more about how to write syntax files (and colorschemes) in the [col
|
||||
Micro used to use the `.micro` filetype for syntax files which is no longer supported. If you have `.micro`
|
||||
syntax files that you would like to convert to the new filetype, you can use the [`syntax_converter.go`](./syntax_converter.go) program (also located in this directory):
|
||||
|
||||
```
|
||||
```sh
|
||||
$ go run syntax_converter.go c.micro > c.yaml
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user