micro icon indicating copy to clipboard operation
micro copied to clipboard

create user.micro merge to each colorscheme without create them under user colorscheme folder

Open vincentaxhe opened this issue 1 year ago • 5 comments

I have implement org highlight with syntax/org.yaml

filetype: org

detect:
    filename: "\\.org$"

rules:
      # headlines
    - headline:  "^\\*+ .*"
    - priority:  "^\\*+ (\\[.+\\] |[A-Z]+ )+"

      # comment
    - comment: "# .*"

      # tables
    - table: "[[:space:]]*\\|.+\\|"

      # bold italic delete underline mono
    - emphasize: "\\*[^ *][^*]*[^ *]\\*"
    - italic: "/[^ ].*[^ ]/"
    - delete: "\\+[^ ].*[^ ]\\+"
    - underline: "_[^ ].*[^ ]_"
    - mono: "[=~][^ =~].*[^ =~][^=~]"

      # lists
    - list: "^([[:space:]]*[+-] |^[[:space:]]*[0-9a-zA-Z]+[).] )(\\[.\\] )?"

      # links
    - link: "\\[(\\[[^]]+\\]){1,2}\\]"

      # urls
    - url: "https?://[^ )>]+"

      # block
    - block:
        start: "^#\\+begin_.*"
        end: "^#\\+end_[^ ]*"
        rules: []
    - block: "^#\\+.*"

and create colorscheme/user.micro

color-link headline "bold #282828,#E6DB74"
color-link priority "#CB4B16,#282828"
color-link table "#66D9EF,#282828"
color-link emphasize "bold #AE81FF,#282828"
color-link italic "#E6DB74,#282828"
color-link mono "#ABE674,#282828"
color-link delete "#505050,#282828"
color-link underline "#BDE6AD,#282828"
color-link list "#F92672,#282828"
color-link link "#CB4B16,#282828"
color-link url "bold #CB4B16,#282828"
color-link block "#C6EF74,#282828"

and copy every buildin colorscheme file to micro user colorscheme folder, then append 'include "user"' to every .micro file. is there a way to avoid create so much duplicated files and merge user.micro to any colorscheme selected, maybe an option?

vincentaxhe avatar Oct 03 '24 04:10 vincentaxhe

is there a way to avoid create so much duplicated files and merge user.micro to any colorscheme selected, maybe an option?

Yes, I made a plugin for myself that does exactly that. Allows you to have a main colorscheme and add a list of includes at the end. It is a work in progress/hack (colorschemes need a rework in micro) but it works. If you are still interested, I can release it and you can try it.

usfbih8u avatar Jan 06 '25 18:01 usfbih8u

yeah, I want to look into the approach

vincentaxhe avatar Jan 07 '25 04:01 vincentaxhe

yeah, I want to look into the approach

https://github.com/usfbih8u/micro-concat-colorschemes

usfbih8u avatar Jan 08 '25 19:01 usfbih8u

@vincentaxhe, the plugin never worked. It only worked for me because while trying to come up with a solution, I left settings.json in a weird state that reset the colorscheme selected always at startup (I can not reproduce it anymore).

When I tested it again for publishing, it did not fail. I suppose you get hit with the message "'concat-colorscheme' is not a valid colorscheme.", at least when you open the second instance.

The solution is to create a colorscheme with the includes, like the plugin did at runtime, and forget about the plugin. If you want to change the colorscheme, you will have to do it manually.

Your micro colorscheme should look like this:

include "atom-dark"
include "special-color1"
include "special-color2"

usfbih8u avatar Feb 06 '25 01:02 usfbih8u

I'm sorry, I just did not care it anymore, I have done the work, it works and reliable.

vincentaxhe avatar Feb 06 '25 03:02 vincentaxhe