You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.8 KiB

  1. # Theme Guide for F-Sy-H
  2. `fast-theme` tool is used to select a theme. There are 6 shipped themes, they can be listed with `fast-theme -l`.
  3. Themes are basic [INI files](https://github.com/zdharma/fast-syntax-highlighting/tree/master/themes) where each
  4. key is a *style*.
  5. Besides shipped themes, user can point this tool to any other theme, by simple `fast-theme ~/mytheme.ini`. To
  6. obtain template to work on when creating own theme, issue `fast-theme --copy-shipped-theme {theme-name}`.
  7. To alter just a few styles and not create a whole new theme, use **overlay**. What is overlay? It is in the same
  8. format as full theme, but can have only a few styles defined, and these styles will overwrite styles in main-theme.
  9. Example overlay file:
  10. ```ini
  11. ; overlay.ini
  12. [base]
  13. commandseparator = yellow,bold
  14. comment = 17
  15. [command-point]
  16. function = green
  17. command = 180
  18. ```
  19. File name `overlay.ini` is treated specially.
  20. When specifing path, following short-hands can be used:
  21. ```
  22. XDG: = ~/.config/fsh (respects $XDG_CONFIG_HOME env var)
  23. LOCAL: = /usr/local/share/fsh/
  24. HOME: = ~/.fsh/
  25. OPT: = /opt/local/share/fsh/
  26. ```
  27. So for example, issue `fast-theme XDG:overlay` to load `~/.config/fsh/overlay.ini` as overlay. The `.ini`
  28. extension is optional.
  29. ## Secondary Theme
  30. Each theme has key `secondary`, e.g. for theme `free`:
  31. ```ini
  32. ; free.ini
  33. [base]
  34. default = none
  35. unknown-token = red,bold
  36. ; ...
  37. ; ...
  38. ; ...
  39. secondary = zdharma
  40. ```
  41. Secondary theme (`zdharma` in the example) will be used for highlighting of argument for `eval`
  42. and of `$( ... )` interior (i.e. of interior of command substitution). Basically, recursive
  43. highlighting uses alternate theme to make the highlighted code distinct:
  44. ![sshot](https://raw.githubusercontent.com/zdharma/fast-syntax-highlighting/master/images/cmdsubst.png)
  45. In the above screen-shot the interior of `$( ... )` uses different colors than the rest of the
  46. code. Example for `eval`:
  47. ![image](https://raw.githubusercontent.com/zdharma/fast-syntax-highlighting/master/images/eval_cmp.png)
  48. First line doesn't use recursive highlighting, highlights `eval` argument as regular string.
  49. Second line switches theme to `zdharma` and does full recursive highlighting of eval argument.
  50. ## Custom Working Directory
  51. Set `$FAST_WORK_DIR` before loading the plugin to have e.g. processed theme files (ready to
  52. load, in Zsh format, not INI) kept under specified location. This is handy if e.g. you install
  53. Fast-Syntax-Highlighting system-wide (e.g. from AUR on ArchLinux) and want to have per-user
  54. theme setup.
  55. You can use "~" in the path, e.g. `FAST_WORK_DIR=~/.fsh` and also the `XDG:`, `LOCAL:`, `OPT:`,
  56. etc. short-hands, so e.g. `FAST_WORK_DIR=XDG` or `FAST_WORK_DIR=XDG:` is allowed (in this case
  57. it will be changed to `$HOME/.config/fsh` by default by F-Sy-H loader).