Commit 0aff3b1f authored by Torsten Nielsen's avatar Torsten Nielsen
Browse files

Add more config of editors for YAML

parent 8cb07a2c
......@@ -299,7 +299,9 @@ Python virtual environments give you the freedom to test whatever version of mod
Setting up Editors for YAML and/or Ansible
------------------------------------------
A very simple setup for vim (`~/.vimrc`) or neovim (`~/.config/nvim/init.vim`):
### Vim or Neovim
A very simple setup for vim (`~/.vimrc`) or neovim (`~/.config/nvim/init.vim` or alternatively [$XDG_CONFIG_HOME/nvim/init.vim](https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html) ):
syntax on
filetype plugin indent on
......@@ -308,13 +310,35 @@ A very simple setup for vim (`~/.vimrc`) or neovim (`~/.config/nvim/init.vim`):
"cul CUrrent Line highlighting
autocmd FileType yaml setlocal autoindent expandtab ts=2 sw=2 cuc cul
### Nano editor
Simple config for nano editor (`~/.nanorc`):
Simple config for nano editor (`~/.config/nano/nanorc`):
set autoindent
set tabsize 2
set tabstospaces
A more elaborate example config for nano is included i this repo: `nanorc`.
### Micro editor
There is a [new editor micro](https://micro-editor.github.io/), with sane defaults. It has mouse-support and even "understands" yaml right out of the box. It's programmed in Go and has extensions written in Lua.
$ sudo apt install micro
$ micro -plugin install nordcolors
$ ls ~/.config/micro/plug/nordcolors/
colorschemes help LICENSE nordcolors.lua pics README.md repo.json
A small config for micro editor (`~/.config/micro/settings.json`):
{
"ft:yaml": {
"tabsize": 2
}
}
"Inside" the micro editor, try `Ctrl-e` and on the new cmd-line: `set colorscheme <Space> <TAB>` or try `Ctrl-g` (again to get out of help) and `Ctrl-q` to quit.
Note for users of the VS Code editor (and friends)
--------------------------------------------------
......
{
"ft:yaml": {
"tabsize": 2
}
}
## ~/.config/nano/nanorc
## See also /etc/nanorc, /usr/share/nano and
## https://wiki.archlinux.org/title/Nano
## Autoindent
set autoindent
## Display line numbers to the left
set linenumbers
## Enable mouse support
set mouse
## Spread overlong lines over multiple screen lines.
set softwrap
## YAML specific settings
## Set tabsize and convert them to spaces
set tabsize 2
set tabstospaces
## Remove blanks at end of lines:
set trimblanks
## From https://github.com/serialhex/nano-highlight/blob/master/yaml.nanorc
# Supports `YAML` files
syntax "YAML" "\.ya?ml$"
header "^(---|===)" "%YAML"
## Keys
color magenta "^\s*[\$A-Za-z0-9_-]+\:"
color brightmagenta "^\s*@[\$A-Za-z0-9_-]+\:"
## Values
color white ":\s.+$"
## Booleans
icolor brightcyan " (y|yes|n|no|true|false|on|off)$"
## Numbers
color brightred " [[:digit:]]+(\.[[:digit:]]+)?"
## Arrays
color red "\[" "\]" ":\s+[|>]" "^\s*- "
## Reserved
color green "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
## Comments
color brightwhite "#.*$"
## Errors
color ,red ":\w.+$"
color ,red ":'.+$"
color ,red ":".+$"
color ,red "\s+$"
## Non closed quote
color ,red "['\"][^['\"]]*$"
## Closed quotes
color yellow "['\"].*['\"]"
## Equal sign
color brightgreen ":( |$)"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment