X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fhelp%2Ftutorial.md;h=8bddbe5e50ba2c3aaebcb249d98592aaf0495226;hb=bd9307483d444dc8a1a80ba7b9cf79236ce1088a;hp=f720a4c9d2ce3bcef820371366bf307c2f839e11;hpb=efe1ab5db62fe89b9bbd2096ce68492a788fc8c7;p=micro.git diff --git a/runtime/help/tutorial.md b/runtime/help/tutorial.md index f720a4c9..8bddbe5e 100644 --- a/runtime/help/tutorial.md +++ b/runtime/help/tutorial.md @@ -1,15 +1,17 @@ # Tutorial -This is a brief intro to micro's configuration system that will give some -simple examples showing how to configure settings, rebind keys, -and use `init.lua` to configure micro to your liking. +This is a brief intro to micro's configuration system that will give some simple +examples showing how to configure settings, rebind keys, and use `init.lua` to +configure micro to your liking. Hopefully you'll find this useful. +See `> help defaultkeys` for a list an explanation of the default keybindings. + ### Plugins -Micro has a plugin manager which can automatically download plugins for you. -To see the plugins 'official' plugins, go to github.com/micro-editor/plugin-channel. +Micro has a plugin manager which can automatically download plugins for you. To +see the 'official' plugins, go to github.com/micro-editor/plugin-channel. For example, if you'd like to install the snippets plugin (listed in that repo), just press `CtrlE` to execute a command, and type `plugin install snippets`. @@ -20,23 +22,23 @@ topic. ### Settings In micro, your settings are stored in `~/.config/micro/settings.json`, a file -that is created the first time you run micro. It is a json file which holds -all 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. +that is created the first time you run micro. It is a json file which holds all +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. Simply 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 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. - -You can also set options locally which means that the setting will only have -the value you give it in the buffer you set it in. For example, if you have -two splits open, and you type `> setlocal tabsize 2`, the tabsize will only -be 2 in the current buffer. Also micro will not save this local change to the +future, I will use `> set option value` to indicate pressing CtrlE). 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. + +You can also set options locally which means that the setting will only have the +value you give it in the buffer you set it in. For example, if you have two +splits open, and you type `> setlocal tabsize 2`, the tabsize will only be 2 in +the current buffer. Also micro will not save this local change to the `settings.json` file. However, you can still set options locally in 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`: +`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 { @@ -54,8 +56,8 @@ If you would like to know more about all the available options, see the ### Keybindings -Keybindings work in much the same way as options. You configure them using -the `~/.config/micro/bindings.json` file. +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 following in `bindings.json`: @@ -78,8 +80,8 @@ what actions are available, see the `keybindings` help topic (`> help keybinding ### Configuration with Lua If you need more power than the json files provide, you can use the `init.lua` -file. Create it in `~/.config/micro`. This file is a lua file that is run -when micro starts and is essentially a one-file plugin. +file. Create it in `~/.config/micro`. This file is a lua file that is run when +micro starts and is essentially a one-file plugin. I'll show you how to use the `init.lua` file by giving an example of how to create a binding to `CtrlR` which will execute `go run` on the current file, @@ -98,8 +100,8 @@ end BindKey("CtrlR", "init.gorun") ``` -Alternatively, you could get rid of the `BindKey` line, and put this line in -the `bindings.json` file: +Alternatively, you could get rid of the `BindKey` line, and put this line in the +`bindings.json` file: ```json { @@ -107,5 +109,5 @@ the `bindings.json` file: } ``` -For more information about plugins and the lua system that micro uses, see -the `plugins` help topic (`> help plugins`). +For more information about plugins and the lua system that micro uses, see the +`plugins` help topic (`> help plugins`).