diff --git a/bashrc b/bashrc index ab0c80d..7fe53e2 100644 --- a/bashrc +++ b/bashrc @@ -4,8 +4,8 @@ # If not running interactively, don't do anything case $- in - *i*) ;; - *) return;; +*i*) ;; +*) return ;; esac # don't put duplicate lines or lines starting with space in the history. @@ -32,12 +32,12 @@ shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) + debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; +xterm-color | *-256color) color_prompt=yes ;; esac # uncomment for a colored prompt, if the terminal has the capability; turned @@ -46,42 +46,42 @@ esac #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi fi if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; +xterm* | rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; *) - ;; + ;; esac # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='eza -l' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' - #alias grep='grep --color=auto' - #alias fgrep='fgrep --color=auto' - #alias egrep='egrep --color=auto' + #alias grep='grep --color=auto' + #alias fgrep='fgrep --color=auto' + #alias egrep='egrep --color=auto' fi # colored GCC warnings and errors @@ -98,7 +98,7 @@ fi # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases + . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable @@ -112,6 +112,17 @@ if ! shopt -oq posix; then fi fi -if [ -z "${TMUX}" ] && [ $(tty) == "/dev/pts/0" ]; then - exec tmux new-session +if [ -z "${TMUX}" ] && [ $(tty) == "/dev/pts/0" ]; then + exec tmux new-session fi + +eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)" +PATH=$PATH:/home/tsindt/bin:/home/tsindt/.cargo/bin + +eval "$(oh-my-posh init bash --config gruvbox)" + +# eval "$(/home/tsindt/bin shellenv bash)" + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash + +EDITOR=nvim diff --git a/config/mc/ini b/config/mc/ini new file mode 100644 index 0000000..459ed94 --- /dev/null +++ b/config/mc/ini @@ -0,0 +1,144 @@ +[Midnight-Commander] +verbose=true +shell_patterns=true +auto_save_setup=true +preallocate_space=false +auto_menu=false +use_internal_view=true +use_internal_edit=false +clear_before_exec=true +confirm_delete=true +confirm_overwrite=true +confirm_execute=false +confirm_history_cleanup=true +confirm_exit=false +confirm_directory_hotlist_delete=false +confirm_view_dir=false +safe_delete=false +safe_overwrite=false +use_8th_bit_as_meta=false +mouse_move_pages_viewer=true +mouse_close_dialog=false +fast_refresh=false +drop_menus=false +wrap_mode=true +old_esc_mode=true +cd_symlinks=true +show_all_if_ambiguous=false +use_file_to_guess_type=true +alternate_plus_minus=false +only_leading_plus_minus=true +show_output_starts_shell=false +xtree_mode=false +file_op_compute_totals=true +classic_progressbar=true +use_netrc=true +ftpfs_always_use_proxy=false +ftpfs_use_passive_connections=true +ftpfs_use_passive_connections_over_proxy=false +ftpfs_use_unix_list_options=true +ftpfs_first_cd_then_ls=true +ignore_ftp_chattr_errors=true +editor_fill_tabs_with_spaces=false +editor_return_does_auto_indent=false +editor_backspace_through_tabs=false +editor_fake_half_tabs=true +editor_option_save_position=true +editor_option_auto_para_formatting=false +editor_option_typewriter_wrap=false +editor_edit_confirm_save=true +editor_syntax_highlighting=true +editor_persistent_selections=true +editor_drop_selection_on_copy=true +editor_cursor_beyond_eol=false +editor_cursor_after_inserted_block=false +editor_visible_tabs=true +editor_visible_spaces=true +editor_line_state=false +editor_simple_statusbar=false +editor_check_new_line=false +editor_show_right_margin=false +editor_group_undo=true +editor_state_full_filename=true +editor_ask_filename_before_edit=false +nice_rotating_dash=true +shadows=true +mcview_remember_file_position=false +auto_fill_mkdir_name=true +copymove_persistent_attr=true +pause_after_run=1 +mouse_repeat_rate=100 +double_click_speed=250 +old_esc_mode_timeout=1000000 +max_dirt_limit=10 +num_history_items_recorded=60 +vfs_timeout=60 +ftpfs_directory_timeout=900 +ftpfs_retry_seconds=30 +shell_directory_timeout=900 +editor_tab_spacing=8 +editor_word_wrap_line_length=72 +editor_option_save_mode=0 +editor_backup_extension=~ +editor_filesize_threshold=64M +editor_stop_format_chars=-+*\\,.;:&> +mcview_eof= +skin=default + +[Layout] +output_lines=0 +left_panel_size=50 +top_panel_size=0 +message_visible=true +keybar_visible=true +xterm_title=true +command_prompt=true +menubar_visible=true +free_space=true +horizontal_split=false +vertical_equal=true +horizontal_equal=true + +[Misc] +timeformat_recent=%d. %b %H:%M +timeformat_old=%d. %b %Y +ftp_proxy_host=gate +ftpfs_password=anonymous@ +display_codepage=UTF-8 +source_codepage=Other_8_bit +autodetect_codeset= +spell_language=en +clipboard_store= +clipboard_paste= + +[Colors] +base_color= +tmux-256color= +color_terminals= + +[Panels] +show_mini_info=true +kilobyte_si=false +mix_all_files=false +show_backups=true +show_dot_files=true +fast_reload=false +fast_reload_msg_shown=false +mark_moves_down=true +reverse_files_only=true +auto_save_setup_panels=false +navigate_with_arrows=false +panel_scroll_pages=true +panel_scroll_center=false +mouse_move_pages=true +filetype_mode=true +permission_mode=false +torben_fj_mode=false +quick_search_mode=2 +select_flags=6 + +[Panelize] +Nach *.orig nach dem Patchen suchen=find . -name \\*.orig -print +Nach dem Patchen nach Ablehnungen suchen=find . -name \\*.rej -print +Geänderte Git-Dateien=git ls-files --modified +SUID- und SGID-Programme suchen=find . \\( \\( -perm -04000 -a -perm /011 \\) -o \\( -perm -02000 -a -perm /01 \\) \\) -print diff --git a/config/mc/panels.ini b/config/mc/panels.ini new file mode 100644 index 0000000..e69de29 diff --git a/config/micro/bindings.json b/config/micro/bindings.json new file mode 100644 index 0000000..c1e45bd --- /dev/null +++ b/config/micro/bindings.json @@ -0,0 +1,5 @@ +{ + "Ctrl-y": "Undo", + "Ctrl-z": "Redo", + "Alt-t": "command:tree" +} diff --git a/config/micro/buffers/history b/config/micro/buffers/history new file mode 100644 index 0000000..683c08b Binary files /dev/null and b/config/micro/buffers/history differ diff --git a/config/micro/colorschemes/atom-dark.micro b/config/micro/colorschemes/atom-dark.micro new file mode 100644 index 0000000..0f46299 --- /dev/null +++ b/config/micro/colorschemes/atom-dark.micro @@ -0,0 +1,33 @@ +color-link default "#C5C8C6,#1D1F21" +color-link comment "#7C7C7C,#1D1F21" +color-link identifier "#F9EE98,#1D1F21" +color-link constant "#FF73FD,#1D1F21" +color-link constant.string "#A8FF60,#1D1F21" +color-link statement "#96CBFE,#1D1F21" +color-link symbol "#96CBFE,#1D1F21" +color-link preproc "#62B1FE,#1D1F21" +color-link type "#C6C5FE,#1D1F21" +color-link special "#A6E22E,#1D1F21" +color-link underlined "#D33682,#1D1F21" +color-link error "bold #FF4444,#1D1F21" +color-link todo "bold #FF8844,#1D1F21" +color-link hlsearch "#000000,#B4EC85" +color-link statusline "#1D1F21,#C5C8C6" +color-link tabbar "#1D1F21,#C5C8C6" +color-link indent-char "#505050,#1D1F21" +color-link line-number "#656866,#232526" +color-link current-line-number "#656866,#1D1F21" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#FF4444,#1D1F21" +color-link gutter-warning "#EEEE77,#1D1F21" +color-link cursor-line "#2D2F31" +color-link color-column "#2D2F31" +#color-link symbol.brackets "#96CBFE,#1D1F21" +#No extended types (bool in C, etc.) +#color-link type.extended "default" +#Plain brackets +color-link match-brace "#1D1F21,#62B1FE" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/bubblegum.micro b/config/micro/colorschemes/bubblegum.micro new file mode 100644 index 0000000..dcc2276 --- /dev/null +++ b/config/micro/colorschemes/bubblegum.micro @@ -0,0 +1,31 @@ +color-link default "241,231" +color-link comment "246,231" +color-link constant "130,231" +color-link constant.string "136,231" +color-link constant.number "131,231" +color-link identifier "133,231" +color-link statement "32,231" +color-link symbol "32,231" +color-link preproc "28,231" +color-link type "61,231" +color-link special "167,231" +color-link error "231, 160" +color-link underlined "underline 241,231" +color-link todo "246,231" +color-link hlsearch "231,136" +color-link statusline "241,254" +color-link tabbar "241,254" +color-link diff-added "34" +color-link diff-modified "214" +color-link diff-deleted "160" +color-link gutter-error "197,231" +color-link gutter-warning "134,231" +color-link line-number "246,254" +color-link cursor-line "254" +color-link color-column "254" +#No extended types (bool in C, &c.) and plain brackets +color-link type.extended "241,231" +color-link symbol.brackets "241,231" +color-link match-brace "231,28" +color-link tab-error "210" +color-link trailingws "210" diff --git a/config/micro/colorschemes/cmc-16.micro b/config/micro/colorschemes/cmc-16.micro new file mode 100644 index 0000000..0a50096 --- /dev/null +++ b/config/micro/colorschemes/cmc-16.micro @@ -0,0 +1,47 @@ +#CaptainMcClellan's personal color scheme. +#16 colour version. +color-link comment "bold black" +color-link constant "cyan" +color-link constant.bool "bold cyan" +color-link constant.bool.true "bold green" +color-link constant.bool.false "bold red" +color-link constant.string "yellow" +color-link constant.string.url "underline blue, white" +#color-link constant.number "constant" +color-link constant.specialChar "bold magenta" +color-link identifier "bold red" +color-link identifier.macro "bold red" +color-link identifier.var "bold blue" +#color-link identifier.class "bold green" +color-link identifier.class "bold white" +color-link statement "bold yellow" +color-link symbol "red" +color-link symbol.brackets "blue" +color-link symbol.tag "bold blue" +color-link symbol.tag.extended "bold green" +color-link preproc "bold cyan" +color-link type "green" +color-link type.keyword "bold green" +color-link special "magenta" +color-link ignore "default" +color-link error "bold ,brightred" +color-link todo "underline black,brightyellow" +color-link hlsearch "white,darkgreen" +color-link indent-char ",brightgreen" +color-link line-number "green" +color-link line-number.scrollbar "green" +color-link statusline "white,blue" +color-link tabbar "white,blue" +color-link current-line-number "red" +color-link current-line-number.scroller "red" +color-link diff-added "green" +color-link diff-modified "yellow" +color-link diff-deleted "red" +color-link gutter-error ",red" +color-link gutter-warning "red" +color-link color-column "cyan" +color-link underlined.url "underline blue, white" +color-link divider "blue" +color-link match-brace "black,cyan" +color-link tab-error "brightred" +color-link trailingws "brightred" diff --git a/config/micro/colorschemes/cmc-tc.micro b/config/micro/colorschemes/cmc-tc.micro new file mode 100644 index 0000000..b0502c6 --- /dev/null +++ b/config/micro/colorschemes/cmc-tc.micro @@ -0,0 +1,43 @@ +#CaptainMcClellan's personal colour scheme. +#Full colour edition. +color-link default "#aaaaaa,#1e2124" +color-link comment "bold #555555" +color-link constant "#008888" +#color-link constant.string "#888800" +color-link constant.string "#a85700" +color-link constant.specialChar "bold #ccccff" +color-link identifier "bold #e34234" +color-link identifier.macro "bold #e34234" +color-link identifier.var "bold #5757ff" +color-link identifier.class "bold #ffffff" +color-link statement "bold #ffff55" +color-link symbol "#722f37" +color-link symbol.brackets "#4169e1" +color-link symbol.tag "#5757ff" +color-link preproc "bold #55ffff" +color-link type "#3eb489" +color-link type.keyword "bold #bdecb6" +color-link special "#b57edc" +color-link ignore "default" +color-link error "bold ,#e34234" +color-link todo "bold underline #888888,#f26522" +color-link hlsearch "#b7b7b7,#32593d" +color-link indent-char ",#bdecb6" +color-link line-number "#bdecb6,#36393e" +color-link line-number.scrollbar "#3eb489" +color-link statusline "#aaaaaa,#8a496b" +color-link tabbar "#aaaaaa,#8a496b" +color-link current-line-number "bold #e34234,#424549" +color-link current-line-number.scroller "red" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error ",#e34234" +color-link gutter-warning "#e34234" +color-link color-column "#f26522" +color-link constant.bool "bold #55ffff" +color-link constant.bool.true "bold #85ff85" +color-link constant.bool.false "bold #ff8585" +color-link match-brace "#1e2124,#55ffff" +color-link tab-error "#d75f5f" +color-link trailingws "#d75f5f" diff --git a/config/micro/colorschemes/darcula.micro b/config/micro/colorschemes/darcula.micro new file mode 100644 index 0000000..7103e84 --- /dev/null +++ b/config/micro/colorschemes/darcula.micro @@ -0,0 +1,34 @@ +color-link default "#CCCCCC,#242424" +color-link comment "#707070,#242424" +color-link identifier "#FFC66D,#242424" +color-link constant "#7A9EC2,#242424" +color-link constant.string "#6A8759,#242424" +color-link constant.string.char "#6A8759,#242424" +color-link statement "#CC8242,#242424" +color-link symbol "#CCCCCC,#242424" +color-link preproc "#CC8242,#242424" +color-link type "#CC8242,#242424" +color-link special "#CC8242,#242424" +color-link underlined "#D33682,#242424" +color-link error "bold #CB4B16,#242424" +color-link todo "bold #D33682,#242424" +color-link hlsearch "#CCCCCC,#32593D" +color-link statusline "#242424,#CCCCCC" +color-link tabbar "#242424,#CCCCCC" +color-link indent-char "#4F4F4F,#242424" +color-link line-number "#666666,#2C2C2C" +color-link current-line-number "#666666,#242424" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#CB4B16,#242424" +color-link gutter-warning "#E6DB74,#242424" +color-link cursor-line "#2C2C2C" +color-link color-column "#2C2C2C" +#No extended types; Plain brackets. +color-link type.extended "default" +#color-link symbol.brackets "default" +color-link symbol.tag "#AE81FF,#242424" +color-link match-brace "#242424,#7A9EC2" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/default.micro b/config/micro/colorschemes/default.micro new file mode 100644 index 0000000..2f7fdfc --- /dev/null +++ b/config/micro/colorschemes/default.micro @@ -0,0 +1 @@ +include "monokai" diff --git a/config/micro/colorschemes/dracula-tc.micro b/config/micro/colorschemes/dracula-tc.micro new file mode 100644 index 0000000..af0509c --- /dev/null +++ b/config/micro/colorschemes/dracula-tc.micro @@ -0,0 +1,49 @@ +color-link default "#F8F8F2,#282A36" +color-link comment "#6272A4" + +color-link identifier "#50FA7B" +color-link identifier.class "#8BE9FD" +color-link identifier.var "#F8F8F2" + +color-link constant "#BD93F9" +color-link constant.number "#F8F8F2" +color-link constant.string "#F1FA8C" + +color-link symbol "#FF79C6" +color-link symbol.brackets "#F8F8F2" +color-link symbol.tag "#AE81FF" + +color-link type "italic #8BE9FD" +color-link type.keyword "#FF79C6" + +color-link special "#FF79C6" +color-link statement "#FF79C6" +color-link preproc "#FF79C6" + +color-link underlined "#FF79C6" +color-link error "bold #FF5555" +color-link todo "bold #FF79C6" + +color-link hlsearch "#282A36,#50FA7B" + +color-link diff-added "#50FA7B" +color-link diff-modified "#FFB86C" +color-link diff-deleted "#FF5555" + +color-link gutter-error "#FF5555" +color-link gutter-warning "#E6DB74" + +color-link statusline "#282A36,#F8F8F2" +color-link tabbar "#282A36,#F8F8F2" +color-link indent-char "#6272A4" +color-link line-number "#6272A4" +color-link current-line-number "#F8F8F2" + +color-link cursor-line "#44475A,#F8F8F2" +color-link color-column "#44475A" +color-link type.extended "default" + +color-link match-brace "#282A36,#FF79C6" + +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/dukedark-tc.micro b/config/micro/colorschemes/dukedark-tc.micro new file mode 100644 index 0000000..52ec847 --- /dev/null +++ b/config/micro/colorschemes/dukedark-tc.micro @@ -0,0 +1,38 @@ +color-link color-column "#001e28" +color-link comment "#608b4e,#001e28" +color-link constant.bool "#fd971f,#001e28" +color-link constant "#fd971f,#001e28" +color-link constant.string "#a0f000,#001e28" +color-link constant.string.char "#a0f000,#001e28" +color-link constant.string.url "#a0f000,#001e28" +color-link current-line-number "bold #fd971f,#001e28" +color-link cursor-line "#001923" +color-link default "#ffffff,#001e28" +color-link diff-added "#00c8a0,#001e28" +color-link diff-modified "#fd971f,#001e28" +color-link diff-deleted "#cb4b16,#001e28" +color-link divider "#001e28,#d0d0d0" +color-link error "#cb4b16,#001e28" +color-link gutter-error "#cb4b16,#001e28" +color-link gutter-warning "#fce94f,#001e28" +color-link hlsearch "#ffffff,#005028" +color-link identifier "#00c8a0,#001e28" +color-link identifier.class "#00c8a0,#001e28" +color-link indent-char "#a0a0a0,#001e28" +color-link line-number "#a0a0a0,#001923" +color-link preproc "bold #5aaae6,#001e28" +color-link special "#a6e22e,#001e28" +color-link statement "bold #5aaae6,#001e28" +color-link statusline "#ffffff,#0078c8" +color-link symbol "#00c8a0,#001e28" +color-link symbol.brackets "#ffffff,#001e28" +color-link symbol.tag "bold #5aaae6,#001e28" +color-link tabbar "#001e28,#ffffff" +color-link todo "#fce94f,#001e28" +color-link type "bold #3cc83c,#001e28" +color-link type.keyword "bold #5aaae6,#001e28" +color-link type.extended "#ffffff,#001e28" +color-link underlined "#608b4e,#001e28" +color-link match-brace "#001e28,#5aaae6" +color-link tab-error "#d75f5f" +color-link trailingws "#d75f5f" diff --git a/config/micro/colorschemes/dukelight-tc.micro b/config/micro/colorschemes/dukelight-tc.micro new file mode 100644 index 0000000..c694ffb --- /dev/null +++ b/config/micro/colorschemes/dukelight-tc.micro @@ -0,0 +1,38 @@ +color-link color-column "#f0f0f0" +color-link comment "#3f7f5f,#f0f0f0" +color-link constant.bool "#641e00,#f0f0f0" +color-link constant "#641e00,#f0f0f0" +color-link constant.string "#0000ff,#f0f0f0" +color-link constant.string.char "#0000ff,#f0f0f0" +color-link constant.string.url "#0000ff,#f0f0f0" +color-link current-line-number "bold #004080,#f0f0f0" +color-link cursor-line "#e6e6e6" +color-link default "#000000,#f0f0f0" +color-link diff-added "#008040,#f0f0f0" +color-link diff-modified "#641e00,#f0f0f0" +color-link diff-deleted "#500000,#f0f0f0" +color-link divider "#f0f0f0,#004080" +color-link error "#500000,#f0f0f0" +color-link gutter-error "#500000,#f0f0f0" +color-link gutter-warning "#dcc800,#f0f0f0" +color-link hlsearch "#000000,#b8d8e8" +color-link identifier "bold #0078a0,#f0f0f0" +color-link identifier.class "bold #0078a0,#f0f0f0" +color-link indent-char "#404040,#f0f0f0" +color-link line-number "#404040,#e6e6e6" +color-link preproc "bold #780050,#f0f0f0" +color-link special "bold #0078a0,#f0f0f0" +color-link statement "bold #780050,#f0f0f0" +color-link statusline "#ffffff,#0078c8" +color-link symbol "bold #0078a0,#f0f0f0" +color-link symbol.brackets "#000000,#f0f0f0" +color-link symbol.tag "bold #780050,#f0f0f0" +color-link tabbar "#f0f0f0,#004080" +color-link todo "#dcc800,#f0f0f0" +color-link type "bold #004080,#f0f0f0" +color-link type.keyword "bold #780050,#f0f0f0" +color-link type.extended "#000000,#f0f0f0" +color-link underlined "#3f7f5f,#f0f0f0" +color-link match-brace "#f0f0f0,#780050" +color-link tab-error "#ff8787" +color-link trailingws "#ff8787" diff --git a/config/micro/colorschemes/dukeubuntu-tc.micro b/config/micro/colorschemes/dukeubuntu-tc.micro new file mode 100644 index 0000000..b34cc2c --- /dev/null +++ b/config/micro/colorschemes/dukeubuntu-tc.micro @@ -0,0 +1,38 @@ +color-link color-column "#2d0023" +color-link comment "#886484,#2d0023" +color-link constant.bool "#fd971f,#2d0023" +color-link constant "#fd971f,#2d0023" +color-link constant.string "#a0f000,#2d0023" +color-link constant.string.char "#a0f000,#2d0023" +color-link constant.string.url "#a0f000,#2d0023" +color-link current-line-number "bold #fd971f,#2d0023" +color-link cursor-line "#230019" +color-link default "#ffffff,#2d0023" +color-link diff-added "#00c8a0,#2d0023" +color-link diff-modified "#fd971f,#2d0023" +color-link diff-deleted "#cb4b16,#2d0023" +color-link divider "#2d0023,#d0d0d0" +color-link error "#cb4b16,#2d0023" +color-link gutter-error "#cb4b16,#2d0023" +color-link gutter-warning "#fce94f,#2d0023" +color-link hlsearch "#ffffff,#005028" +color-link identifier "#00c8a0,#2d0023" +color-link identifier.class "#00c8a0,#2d0023" +color-link indent-char "#a0a0a0,#2d0023" +color-link line-number "#a0a0a0,#230019" +color-link preproc "bold #5aaae6,#2d0023" +color-link special "#a6e22e,#2d0023" +color-link statement "bold #5aaae6,#2d0023" +color-link statusline "#ffffff,#0078c8" +color-link symbol "#00c8a0,#2d0023" +color-link symbol.brackets "#ffffff,#2d0023" +color-link symbol.tag "bold #5aaae6,#2d0023" +color-link tabbar "#2d0023,#ffffff" +color-link todo "#fce94f,#2d0023" +color-link type "bold #3cc83c,#2d0023" +color-link type.keyword "bold #5aaae6,#2d0023" +color-link type.extended "#ffffff,#2d0023" +color-link underlined "#886484,#2d0023" +color-link match-brace "#2d0023,#5aaae6" +color-link tab-error "#d75f5f" +color-link trailingws "#d75f5f" diff --git a/config/micro/colorschemes/geany.micro b/config/micro/colorschemes/geany.micro new file mode 100644 index 0000000..43ced31 --- /dev/null +++ b/config/micro/colorschemes/geany.micro @@ -0,0 +1,29 @@ +#Geany +color-link comment "red" +color-link constant "default" +color-link constant.string "bold yellow" +color-link identifier "default" +color-link preproc "cyan" +color-link special "blue" +color-link statement "blue" +color-link symbol "default" +color-link symbol.tag "bold blue" +color-link type "blue" +color-link type.extended "default" +color-link error "red" +color-link todo "bold cyan" +color-link hlsearch "black,brightcyan" +color-link indent-char "bold black" +color-link line-number "" +color-link current-line-number "" +color-link statusline "black,white" +color-link tabbar "black,white" +color-link color-column "bold geren" +color-link diff-added "green" +color-link diff-modified "yellow" +color-link diff-deleted "red" +color-link gutter-error ",red" +color-link gutter-warning "red" +color-link match-brace "black,cyan" +color-link tab-error "brightred" +color-link trailingws "brightred" diff --git a/config/micro/colorschemes/gotham.micro b/config/micro/colorschemes/gotham.micro new file mode 100644 index 0000000..d067a81 --- /dev/null +++ b/config/micro/colorschemes/gotham.micro @@ -0,0 +1,29 @@ +color-link default "#99D1CE,#0C1014" +color-link comment "#245361,#0C1014" +color-link identifier "#599CAB,#0C1014" +color-link constant "#D26937,#0C1014" +color-link constant.string "#2AA889,#0C1014" +color-link constant.string.char "#D3EBE9,#0C1014" +color-link statement "#599CAB,#0C1014" +color-link preproc "#C23127,#0C1014" +color-link type "#D26937,#0C1014" +color-link special "#D26937,#0C1014" +color-link underlined "#EDB443,#0C1014" +color-link error "bold #C23127,#0C1014" +color-link todo "bold #888CA6,#0C1014" +color-link hlsearch "#091F2E,#EDB443" +color-link statusline "#091F2E,#599CAB" +color-link indent-char "#505050,#0C1014" +color-link line-number "#245361,#11151C" +color-link current-line-number "#599CAB,#11151C" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#C23127,#11151C" +color-link gutter-warning "#EDB443,#11151C" +color-link cursor-line "#091F2E" +color-link color-column "#11151C" +color-link symbol "#99D1CE,#0C1014" +color-link match-brace "#0C1014,#D26937" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/gruvbox-tc.micro b/config/micro/colorschemes/gruvbox-tc.micro new file mode 100644 index 0000000..65d72b1 --- /dev/null +++ b/config/micro/colorschemes/gruvbox-tc.micro @@ -0,0 +1,29 @@ +color-link default "#ebdbb2,#282828" +color-link comment "#928374,#282828" +color-link symbol "#d79921,#282828" +color-link constant "#d3869b,#282828" +color-link constant.string "#b8bb26,#282828" +color-link constant.string.char "#b8bb26,#282828" +color-link identifier "#8ec07c,#282828" +color-link statement "#fb4934,#282828" +color-link preproc "#fb4934,235" +color-link type "#fb4934,#282828" +color-link special "#d79921,#282828" +color-link underlined "underline #458588,#282828" +color-link error "#9d0006,#282828" +color-link todo "bold #ebdbb2,#282828" +color-link hlsearch "#282828,#fabd2f" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#fb4934,#282828" +color-link gutter-warning "#d79921,#282828" +color-link line-number "#665c54,#3c3836" +color-link current-line-number "#d79921,#282828" +color-link cursor-line "#3c3836" +color-link color-column "#79740e" +color-link statusline "#ebdbb2,#665c54" +color-link tabbar "#ebdbb2,#665c54" +color-link match-brace "#282828,#d3869b" +color-link tab-error "#d75f5f" +color-link trailingws "#d75f5f" diff --git a/config/micro/colorschemes/gruvbox.micro b/config/micro/colorschemes/gruvbox.micro new file mode 100644 index 0000000..46cc09c --- /dev/null +++ b/config/micro/colorschemes/gruvbox.micro @@ -0,0 +1,26 @@ +color-link default "223,235" +color-link comment "243,235" +color-link constant "175,235" +color-link constant.string "142,235" +color-link identifier "109,235" +color-link statement "124,235" +color-link symbol "124,235" +color-link preproc "72,235" +color-link type "214,235" +color-link special "172,235" +color-link underlined "underline 109,235" +color-link error "235,124" +color-link todo "bold 223,235" +color-link hlsearch "235,214" +color-link diff-added "34" +color-link diff-modified "214" +color-link diff-deleted "160" +color-link line-number "243,237" +color-link current-line-number "172,235" +color-link cursor-line "237" +color-link color-column "237" +color-link statusline "223,237" +color-link tabbar "223,237" +color-link match-brace "235,72" +color-link tab-error "167" +color-link trailingws "167" diff --git a/config/micro/colorschemes/material-tc.micro b/config/micro/colorschemes/material-tc.micro new file mode 100644 index 0000000..711fb00 --- /dev/null +++ b/config/micro/colorschemes/material-tc.micro @@ -0,0 +1,36 @@ +color-link color-column "#263238" +color-link comment "#4F6875,#263238" +color-link constant "#F07178,#263238" +color-link constant.number "#F78C6A,#263238" +color-link constant.specialChar "#89DDF3,#263238" +color-link constant.string "#C3E88D,#263238" +color-link current-line-number "#80DEEA,#263238" +color-link cursor-line "#283942" +color-link default "#EEFFFF,#263238" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link divider "#263238,#80DEEA" +color-link error "bold #263238,#F07178" +color-link gutter-error "#EEFFFF,#F07178" +color-link gutter-warning "#EEFFFF,#FFF176" +color-link hlsearch "#FFFFFF,#546E7A" +color-link identifier "#82AAFF,#263238" +color-link identifier.macro "#FFCB6B,#263238" +color-link indent-char "#505050,#263238" +color-link line-number "#656866,#283942" +color-link preproc "#C792EA,#263238" +color-link scrollbar "#80DEEA,#283942" +color-link special "#C792EA,#263238" +color-link statement "#C792EA,#263238" +color-link statusline "#80DEEA,#3b4d56" +color-link symbol "#96CBFE,#263238" +color-link symbol.brackets "#89DDF3,#263238" +color-link symbol.operator "#C792EA,#263238" +color-link tabbar "#80DEEA,#3b4d56" +color-link todo "bold #C792EA,#263238" +color-link type "#FFCB6B,#263238" +color-link underlined "underline #EEFFFF,#263238" +color-link match-brace "#263238,#C792EA" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/monokai-dark.micro b/config/micro/colorschemes/monokai-dark.micro new file mode 100644 index 0000000..3a1e89c --- /dev/null +++ b/config/micro/colorschemes/monokai-dark.micro @@ -0,0 +1,28 @@ +color-link default "#D5D8D6,#1D0000" +color-link comment "#75715E" +color-link identifier "#66D9EF" +color-link constant "#AE81FF" +color-link constant.string "#E6DB74" +color-link constant.string.char "#BDE6AD" +color-link statement "#F92672" +color-link preproc "#CB4B16" +color-link type "#66D9EF" +color-link special "#A6E22E" +color-link underlined "#D33682" +color-link error "bold #CB4B16" +color-link todo "bold #D33682" +color-link hlsearch "#1D0000,#E6DB74" +color-link statusline "#282828,#F8F8F2" +color-link indent-char "#505050,#282828" +color-link line-number "#AAAAAA,#282828" +color-link current-line-number "#AAAAAA,#1D0000" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#CB4B16" +color-link gutter-warning "#E6DB74" +color-link cursor-line "#323232" +color-link color-column "#323232" +color-link match-brace "#1D0000,#AE81FF" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/monokai.micro b/config/micro/colorschemes/monokai.micro new file mode 100644 index 0000000..13c44b7 --- /dev/null +++ b/config/micro/colorschemes/monokai.micro @@ -0,0 +1,34 @@ +color-link default "#F8F8F2,#282828" +color-link comment "#75715E,#282828" +color-link identifier "#66D9EF,#282828" +color-link constant "#AE81FF,#282828" +color-link constant.string "#E6DB74,#282828" +color-link constant.string.char "#BDE6AD,#282828" +color-link statement "#F92672,#282828" +color-link symbol.operator "#F92672,#282828" +color-link preproc "#CB4B16,#282828" +color-link type "#66D9EF,#282828" +color-link special "#A6E22E,#282828" +color-link underlined "#D33682,#282828" +color-link error "bold #CB4B16,#282828" +color-link todo "bold #D33682,#282828" +color-link hlsearch "#282828,#E6DB74" +color-link statusline "#282828,#F8F8F2" +color-link tabbar "#282828,#F8F8F2" +color-link indent-char "#505050,#282828" +color-link line-number "#AAAAAA,#323232" +color-link current-line-number "#AAAAAA,#282828" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#CB4B16,#282828" +color-link gutter-warning "#E6DB74,#282828" +color-link cursor-line "#323232" +color-link color-column "#323232" +#No extended types; Plain brackets. +color-link type.extended "default" +#color-link symbol.brackets "default" +color-link symbol.tag "#AE81FF,#282828" +color-link match-brace "#282828,#AE81FF" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/one-dark.micro b/config/micro/colorschemes/one-dark.micro new file mode 100644 index 0000000..ed99432 --- /dev/null +++ b/config/micro/colorschemes/one-dark.micro @@ -0,0 +1,39 @@ +color-link default "#ABB2BF,#21252C" +color-link color-column "#282C34" +color-link comment "#5C6370" +color-link constant "#C678DD" +color-link constant.number "#E5C07B" +color-link constant.string "#98C379" +color-link constant.string.char "#BDE6AD" +color-link constant.specialChar "#DDF2A4" +color-link current-line-number "#C6C6C6,#21252C" +color-link cursor-line "#282C34" +color-link divider "#ABB2BF" +color-link error "#D2A8A1" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#9B859D" +color-link gutter-warning "#9B859D" +color-link hlsearch "#21252C,#E5C07B" +color-link identifier "#61AFEF" +color-link identifier.class "#C678DD" +color-link identifier.var "#C678DD" +color-link indent-char "#515151" +color-link line-number "#636D83,#282C34" +color-link preproc "#E0C589" +color-link special "#E0C589" +color-link statement "#C678DD" +color-link statusline "#282828,#ABB2BF" +color-link symbol "#AC885B" +color-link symbol.brackets "#ABB2BF" +color-link symbol.operator "#C678DD" +color-link symbol.tag "#AC885B" +color-link tabbar "#F2F0EC,#2D2D2D" +color-link todo "#8B98AB" +color-link type "#66D9EF" +color-link type.keyword "#C678DD" +color-link underlined "#8996A8" +color-link match-brace "#21252C,#C678DD" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/railscast.micro b/config/micro/colorschemes/railscast.micro new file mode 100644 index 0000000..01c0055 --- /dev/null +++ b/config/micro/colorschemes/railscast.micro @@ -0,0 +1,37 @@ +color-link default "#e6e1dc,#2b2b2b" +color-link comment "#bc9458,#2b2b2b" +color-link statement "#cc7833,#2b2b2b" +color-link constant "#a5c261,#2b2b2b" +color-link constant.bool "#6d9cbe,#2b2b2b" +color-link constant.specialChar "#459231,#2b2b2b" +color-link type "#6d9cbe,#2b2b2b" +color-link preproc "#cc7833,#2b2b2b" +color-link special "#cc7833,#2b2b2b" +color-link underlined "#cc7833,#2b2b2b" +color-link todo "bold #cc7833,#2b2b2b" +color-link error "bold #cc7833,#2b2b2b" +color-link gutter-error "#cc7833,#11151C" +color-link hlsearch "#e6e1dc,#474d5c" +color-link indent-char "#414141,#2b2b2b" +color-link line-number "#a1a1a1,#232323" +color-link current-line-number "#e6e1dc,#2b2b2b" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-warning "#a5c261,#11151C" +color-link symbol "#edb753,#2b2b2b" +color-link symbol.operator "#cc7833,#2b2b2b" +color-link symbol.brackets "#cc7833,#2b2b2b" +color-link identifier "#edb753,#2b2b2b" +color-link statusline "#b1b1b1,#232323" +color-link tabbar "bold #b1b1b1,#232323" +color-link cursor-line "#353535" +color-link color-column "#353535" +color-link space "underline #e6e1dc,#2b2b2b" +color-link tab-error "#d75f5f" +color-link trailingws "#d75f5f" + +#the Python syntax definition are wrong. This is not how you should do decorators! +color-link brightgreen "#edb753,#2b2b2b" + +color-link match-brace "#2b2b2b,#a5c261" diff --git a/config/micro/colorschemes/simple.micro b/config/micro/colorschemes/simple.micro new file mode 100644 index 0000000..707c04c --- /dev/null +++ b/config/micro/colorschemes/simple.micro @@ -0,0 +1,33 @@ +color-link comment "blue" +color-link constant "red" +color-link identifier "cyan" +color-link statement "yellow" +color-link symbol "yellow" +color-link preproc "magenta" +color-link type "green" +color-link special "magenta" +color-link ignore "default" +color-link error ",brightred" +color-link todo ",brightyellow" +color-link hlsearch "black,yellow" +color-link statusline "black,white" +color-link indent-char "black" +color-link line-number "yellow" +color-link current-line-number "red" +color-link diff-added "green" +color-link diff-modified "yellow" +color-link diff-deleted "red" +color-link gutter-error ",red" +color-link gutter-warning "red" +#Cursor line causes readability issues. Disabled for now. +#color-link cursor-line "white,black" +color-link color-column "white" +#No extended types. (bool in C) +color-link type.extended "default" +#No bracket highlighting. +color-link symbol.brackets "default" +#Color shebangs the comment color +color-link preproc.shebang "comment" +color-link match-brace ",magenta" +color-link tab-error "brightred" +color-link trailingws "brightred" diff --git a/config/micro/colorschemes/solarized-tc.micro b/config/micro/colorschemes/solarized-tc.micro new file mode 100644 index 0000000..8eae039 --- /dev/null +++ b/config/micro/colorschemes/solarized-tc.micro @@ -0,0 +1,31 @@ +color-link default "#839496,#002833" +color-link comment "#586E75,#002833" +color-link identifier "#268BD2,#002833" +color-link constant "#2AA198,#002833" +color-link constant.specialChar "#DC322F,#002833" +color-link statement "#859900,#002833" +color-link symbol "#859900,#002833" +color-link preproc "#CB4B16,#002833" +color-link type "#B58900,#002833" +color-link special "#268BD2,#002833" +color-link underlined "#D33682,#002833" +color-link error "bold #CB4B16,#002833" +color-link todo "bold #D33682,#002833" +color-link hlsearch "#002833,#B58900" +color-link statusline "#003541,#839496" +color-link tabbar "#003541,#839496" +color-link indent-char "#003541,#002833" +color-link line-number "#586E75,#003541" +color-link current-line-number "#586E75,#002833" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#003541,#CB4B16" +color-link gutter-warning "#CB4B16,#002833" +color-link cursor-line "#003541" +color-link color-column "#003541" +color-link type.extended "#839496,#002833" +color-link symbol.brackets "#839496,#002833" +color-link match-brace "#002833,#268BD2" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/solarized.micro b/config/micro/colorschemes/solarized.micro new file mode 100644 index 0000000..4d3923a --- /dev/null +++ b/config/micro/colorschemes/solarized.micro @@ -0,0 +1,30 @@ +color-link comment "bold brightgreen" +color-link constant "cyan" +color-link constant.specialChar "red" +color-link identifier "blue" +color-link statement "green" +color-link symbol "green" +color-link preproc "brightred" +color-link type "yellow" +color-link special "blue" +color-link underlined "magenta" +color-link error "bold brightred" +color-link todo "bold magenta" +color-link hlsearch "black,yellow" +color-link statusline "black,brightblue" +color-link tabbar "black,brightblue" +color-link indent-char "black" +color-link line-number "bold brightgreen,black" +color-link current-line-number "bold brightgreen,default" +color-link diff-added "green" +color-link diff-modified "yellow" +color-link diff-deleted "red" +color-link gutter-error "black,brightred" +color-link gutter-warning "brightred,default" +color-link cursor-line "black" +color-link color-column "black" +color-link type.extended "default" +color-link symbol.brackets "default" +color-link match-brace ",blue" +color-link tab-error "brightred" +color-link trailingws "brightred" diff --git a/config/micro/colorschemes/sunny-day.micro b/config/micro/colorschemes/sunny-day.micro new file mode 100644 index 0000000..24a3e76 --- /dev/null +++ b/config/micro/colorschemes/sunny-day.micro @@ -0,0 +1,29 @@ +color-link default "0,230" +color-link comment "244" +color-link constant.string "17" +color-link constant "88" +color-link identifier "22" +color-link statement "0,230" +color-link symbol "89" +color-link preproc "22" +color-link type "88" +color-link special "22" +color-link underlined "61,230" +color-link error "88" +color-link todo "210" +color-link hlsearch "0,253" +color-link statusline "233,229" +color-link tabbar "233,229" +color-link indent-char "229" +color-link line-number "244" +color-link diff-added "34" +color-link diff-modified "214" +color-link diff-deleted "160" +color-link gutter-error "88" +color-link gutter-warning "88" +color-link cursor-line "229" +#color-link color-column "196" +color-link current-line-number "246" +color-link match-brace "230,22" +color-link tab-error "210" +color-link trailingws "210" diff --git a/config/micro/colorschemes/twilight.micro b/config/micro/colorschemes/twilight.micro new file mode 100644 index 0000000..8135bb8 --- /dev/null +++ b/config/micro/colorschemes/twilight.micro @@ -0,0 +1,40 @@ +# Twilight color scheme +color-link default "#F8F8F8,#141414" +color-link color-column "#1B1B1B" +color-link comment "#5F5A60" +color-link constant "#CF6A4C" +#color-link constant.number "#CF6A4C" +color-link constant.specialChar "#DDF2A4" +color-link constant.string "#8F9D6A" +color-link current-line-number "#868686,#1B1B1B" +color-link cursor-line "#1B1B1B" +color-link divider "#1E1E1E" +color-link error "#D2A8A1" +color-link diff-added "#00AF00" +color-link diff-modified "#FFAF00" +color-link diff-deleted "#D70000" +color-link gutter-error "#9B859D" +color-link gutter-warning "#9B859D" +color-link hlsearch "#141414,#C0C000" +color-link identifier "#9B703F" +color-link identifier.class "#DAD085" +color-link identifier.var "#7587A6" +color-link indent-char "#515151" +color-link line-number "#868686,#1B1B1B" +color-link current-line-number "#868686,#141414" +color-link preproc "#E0C589" +color-link special "#E0C589" +color-link statement "#CDA869" +color-link statusline "#515151,#1E1E1E" +color-link symbol "#AC885B" +color-link symbol.brackets "#F8F8F8" +color-link symbol.operator "#CDA869" +color-link symbol.tag "#AC885B" +color-link tabbar "#F2F0EC,#2D2D2D" +color-link todo "#8B98AB" +color-link type "#F9EE98" +color-link type.keyword "#CDA869" +color-link underlined "#8996A8" +color-link match-brace "#141414,#E0C589" +color-link tab-error "#D75F5F" +color-link trailingws "#D75F5F" diff --git a/config/micro/colorschemes/zenburn.micro b/config/micro/colorschemes/zenburn.micro new file mode 100644 index 0000000..acbd83f --- /dev/null +++ b/config/micro/colorschemes/zenburn.micro @@ -0,0 +1,30 @@ +color-link default "188,237" +color-link comment "108,237" +color-link constant.string "174,237" +color-link constant.number "116,237" +color-link constant "181,237" +color-link identifier "223,237" +color-link statement "223,237" +color-link symbol "223,237" +color-link preproc "223,237" +color-link type "187,237" +color-link special "181,237" +color-link underlined "188,237" +color-link error "115,236" +color-link todo "bold 254,237" +color-link hlsearch "230,22" +color-link statusline "186,236" +color-link tabbar "186,236" +color-link indent-char "238,237" +color-link line-number "248,238" +color-link diff-added "34" +color-link diff-modified "214" +color-link diff-deleted "160" +color-link gutter-error "237,174" +color-link gutter-warning "174,237" +color-link cursor-line "238" +color-link color-column "238" +color-link current-line-number "188,237" +color-link match-brace "237,223" +color-link tab-error "167" +color-link trailingws "167" diff --git a/config/micro/plug/filemanager/.editorconfig b/config/micro/plug/filemanager/.editorconfig new file mode 100644 index 0000000..a34d753 --- /dev/null +++ b/config/micro/plug/filemanager/.editorconfig @@ -0,0 +1,17 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +indent_style = tab +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +# Ignore .md files, because 2 spaces at end-of-line has meaning +[*.md] +trim_trailing_whitespace = false diff --git a/config/micro/plug/filemanager/CHANGELOG.md b/config/micro/plug/filemanager/CHANGELOG.md new file mode 100644 index 0000000..46d51c4 --- /dev/null +++ b/config/micro/plug/filemanager/CHANGELOG.md @@ -0,0 +1,109 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [3.4.0] - 2018-10-22 + +### Fixed + +- Issues with Lua's `io.popen` on some systems by using Micro's built-in `RunShellCommand` instead, [thanks to @scottbilas](https://github.com/NicolaiSoeborg/filemanager-plugin/pull/38) + +### Added + +- Adds the option `filemanager-openonstart` to allow auto-opening the file tree when Micro is started (default OFF) + +### Changed + +- Update README's option's documentation + +## [3.3.1] - 2018-10-03 + +### Changed + +- Performance improvement by removing unnecessary refresh of the opened file, [thanks to @jackwilsdon](https://github.com/NicolaiSoeborg/filemanager-plugin/pull/37) + +## [3.3.0] - 2018-09-13 + +### Added + +- The ability to sort folders above files, [thanks to @cbrown1](https://github.com/NicolaiSoeborg/filemanager-plugin/pull/33) + +### Fixed + +- The displayed filenames are now correctly only showing their "basename" on Windows + +## [3.2.0] - 2018-02-15 + +### Added + +- The ability to go to parent directory with left arrow (when not minimizing). Thanks @avently +- The ability to jump to the `..` as a "parent directory". Thanks @avently + +## [3.1.2] - 2018-02-07 + +### Fixed + +- The minimum Micro version, which was incorrectly set to v1.4.0. Ref [issue #28](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/28) + +## [3.1.1] - 2018-02-04 + +### Fixed + +Ref https://github.com/zyedidia/micro/issues/992 for both of these fixes. + +- The syntax parser not loading correctly (mostly block comments) on opened files. **Requires Micro >= v1.4.0** +- An errant tab being inserted into the newly opened file. + +## [3.1.0] - 2018-01-30 + +### Added + +- The ability to hide dotfiles using the `filemanager-showdotfiles` option. +- The ability to hide files ignored in your VCS (aka `.gitignore`'d) using the `filemanager-showignored` option. Only works with Git at the moment. +- This `CHANGELOG.md` + +### Fixed + +- A bug with the `rm` command that caused weird, undefined behaviour to contents within the same dir as the file/dir deleted. +- Issue [#24](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/24) + +## [3.0.0] - 2018-01-10 + +### Fixed + +- Issues [#13](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/13), [#14](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/14), [#15](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/15), [#19](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/19), [#20](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/20) +- The broken syntax highlighting + +### Added + +- Directory expansion/compression below itself for viewing more akin to a file tree. +- The `rm` command, which deletes the file/directory under the cursor. +- The `touch` command, which creates a file with the passed filename. +- The `mkdir` command, which creates a directory with the passed filename. +- An API, of sorts, for the user to rebind their keys to if they dislike the defaults. +- An [editorconfig](http://editorconfig.org/) file. + +### Changed + +- The view that it spawns in to read-only, which requires Micro version >= 1.3.5 +- The functionality of some keybindings (when in the view) so they work safetly, or at all, with the plugin. +- From the `enter` key to `tab` for opening/going into files/dirs (a side-effect of using the read-only setting) + +### Removed + +- The ability to use a lot of keybindings that would otherwise mess with the view, and have no benifit. +- The pointless `.gitignore` file. + +[unreleased]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.4.0...HEAD +[3.4.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.3.1...v3.4.0 +[3.3.1]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.3.0...v3.3.1 +[3.3.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.2.0...v3.3.0 +[3.2.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.1.2...v3.2.0 +[3.1.2]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.1.1...v3.1.2 +[3.1.1]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.1.0...v3.1.1 +[3.1.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.0.0...v3.1.0 +[3.0.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v2.1.1...v3.0.0 diff --git a/config/micro/plug/filemanager/LICENSE b/config/micro/plug/filemanager/LICENSE new file mode 100644 index 0000000..ae6fb2f --- /dev/null +++ b/config/micro/plug/filemanager/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Nicolai Søborg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/micro/plug/filemanager/README.md b/config/micro/plug/filemanager/README.md new file mode 100644 index 0000000..79d983d --- /dev/null +++ b/config/micro/plug/filemanager/README.md @@ -0,0 +1,56 @@ +# Filemanager Plugin + +A simple plugin that allows for easy navigation of a file tree. + +![Example picture](./example.jpg?raw=true "Example") + +**Installation:** run `plugin install filemanager` and restart Micro. + +## Basics + +The top line always has the current directory's path to show you where you are.\ +The `..` near the top is used to move back a directory, from your current position. + +All directories have a `/` added to the end of it, and are syntax-highlighted as a `special` character.\ +If the directory is expanded, there will be a `+` to the left of it. If it is collapsed there will be a `-` instead. + +**NOTE:** If you change files without using the plugin, it can't know what you did. The only fix is to close and open the tree. + +### Options + +| Option | Purpose | Default | +| :--------------------------- | :----------------------------------------------------------- | :------ | +| `filemanager-showdotfiles` | Show dotfiles (hidden if false) | `true` | +| `filemanager-showignored` | Show gitignore'd files (hidden if false) | `true` | +| `filemanager-compressparent` | Collapse the parent dir when left is pressed on a child file | `true` | +| `filemanager-foldersfirst` | Sorts folders above any files | `true` | +| `filemanager-openonstart` | Automatically open the file tree when starting Micro | `false` | + +### Commands and Keybindings + +The keybindings below are the equivalent to Micro's defaults, and not actually set by the plugin. If you've changed any of those keybindings, then that key is used instead. + +If you want to [keybind](https://github.com/zyedidia/micro/blob/master/runtime/help/keybindings.md#rebinding-keys) any of the operations/commands, bind to the labeled API in the table below. + +| Command | Keybinding(s) | What it does | API for `bindings.json` | +| :------- | :------------------------- | :------------------------------------------------------------------------------------------ | :------------------------------------ | +| `tree` | - | Open/close the tree | `filemanager.toggle_tree` | +| - | Tab & MouseLeft | Open a file, or go into the directory. Goes back a dir if on `..` | `filemanager.try_open_at_cursor` | +| - | | Expand directory in tree listing | `filemanager.uncompress_at_cursor` | +| - | | Collapse directory listing | `filemanager.compress_at_cursor` | +| - | Shift ⬆ | Go to the target's parent directory | `filemanager.goto_parent_dir` | +| - | Alt Shift { | Jump to the previous directory in the view | `filemanager.goto_next_dir` | +| - | Alt Shift } | Jump to the next directory in the view | `filemanager.goto_prev_dir` | +| `rm` | - | Prompt to delete the target file/directory your cursor is on | `filemanager.prompt_delete_at_cursor` | +| `rename` | - | Rename the file/directory your cursor is on, using the passed name | `filemanager.rename_at_cursor` | +| `touch` | - | Make a new file under/into the file/directory your cursor is on, using the passed name | `filemanager.new_file` | +| `mkdir` | - | Make a new directory under/into the file/directory your cursor is on, using the passed name | `filemanager.new_dir` | + +#### Notes + +- `rename`, `touch`, and `mkdir` require a name to be passed when calling.\ + Example: `rename newnamehere`, `touch filenamehere`, `mkdir dirnamehere`.\ + If the passed name already exists in the current dir, it will cancel instead of overwriting (for safety). + +- The Ctrl w keybinding is to switch which buffer your cursor is on.\ + This isn't specific to the plugin, it's just part of Micro, but many people seem to not know this. diff --git a/config/micro/plug/filemanager/example.jpg b/config/micro/plug/filemanager/example.jpg new file mode 100644 index 0000000..ab5bf1c Binary files /dev/null and b/config/micro/plug/filemanager/example.jpg differ diff --git a/config/micro/plug/filemanager/filemanager.lua b/config/micro/plug/filemanager/filemanager.lua new file mode 100644 index 0000000..25f3c48 --- /dev/null +++ b/config/micro/plug/filemanager/filemanager.lua @@ -0,0 +1,1392 @@ +VERSION = "3.5.1" + +local micro = import("micro") +local config = import("micro/config") +local shell = import("micro/shell") +local buffer = import("micro/buffer") +local os = import("os") +local filepath = import("path/filepath") + +-- Clear out all stuff in Micro's messenger +local function clear_messenger() + -- messenger:Reset() + -- messenger:Clear() +end + +-- Holds the micro.CurPane() we're manipulating +local tree_view = nil +-- Keeps track of the current working directory +local current_dir = os.Getwd() +-- Keep track of current highest visible indent to resize width appropriately +local highest_visible_indent = 0 +-- Holds a table of paths -- objects from new_listobj() calls +local scanlist = {} + +-- Get a new object used when adding to scanlist +local function new_listobj(p, d, o, i) + return { + ["abspath"] = p, + ["dirmsg"] = d, + ["owner"] = o, + ["indent"] = i, + -- Since decreasing/increasing is common, we include these with the object + ["decrease_owner"] = function(self, minus_num) + self.owner = self.owner - minus_num + end, + ["increase_owner"] = function(self, plus_num) + self.owner = self.owner + plus_num + end + } +end + +-- Repeats a string x times, then returns it concatenated into one string +local function repeat_str(str, len) + -- Do NOT try to concat in a loop, it freezes micro... + -- instead, use a temporary table to hold values + local string_table = {} + for i = 1, len do + string_table[i] = str + end + -- Return the single string of repeated characters + return table.concat(string_table) +end + +-- A check for if a path is a dir +local function is_dir(path) + -- Used for checking if dir + local golib_os = import("os") + -- Returns a FileInfo on the current file/path + local file_info, stat_error = golib_os.Stat(path) + -- Wrap in nil check for file/dirs without read permissions + if file_info ~= nil then + -- Returns true/false if it's a dir + return file_info:IsDir() + else + -- Couldn't stat the file/dir, usually because no read permissions + micro.InfoBar():Error("Error checking if is dir: ", stat_error) + -- Nil since we can't read the path + return nil + end +end + +-- Returns a list of files (in the target dir) that are ignored by the VCS system (if exists) +-- aka this returns a list of gitignored files (but for whatever VCS is found) +local function get_ignored_files(tar_dir) + -- True/false if the target dir returns a non-fatal error when checked with 'git status' + local function has_git() + local git_rp_results = shell.ExecCommand('git -C "' .. tar_dir .. '" rev-parse --is-inside-work-tree') + return git_rp_results:match("^true%s*$") + end + local readout_results = {} + -- TODO: Support more than just Git, such as Mercurial or SVN + if has_git() then + -- If the dir is a git dir, get all ignored in the dir + local git_ls_results = + shell.ExecCommand('git -C "' .. tar_dir .. '" ls-files . --ignored --exclude-standard --others --directory') + -- Cut off the newline that is at the end of each result + for split_results in string.gmatch(git_ls_results, "([^\r\n]+)") do + -- git ls-files adds a trailing slash if it's a dir, so we remove it (if it is one) + readout_results[#readout_results + 1] = + (string.sub(split_results, -1) == "/" and string.sub(split_results, 1, -2) or split_results) + end + end + + -- Make sure we return a table + return readout_results +end + +-- Returns the basename of a path (aka a name without leading path) +local function get_basename(path) + if path == nil then + micro.Log("Bad path passed to get_basename") + return nil + else + -- Get Go's path lib for a basename callback + local golib_path = import("filepath") + return golib_path.Base(path) + end +end + +-- Returns true/false if the file is a dotfile +local function is_dotfile(file_name) + -- Check if the filename starts with a dot + if string.sub(file_name, 1, 1) == "." then + return true + else + return false + end +end + +-- Structures the output of the scanned directory content to be used in the scanlist table +-- This is useful for both initial creation of the tree, and when nesting with uncompress_target() +local function get_scanlist(dir, ownership, indent_n) + local golib_ioutil = import("ioutil") + -- Gets a list of all the files in the current dir + local dir_scan, scan_error = golib_ioutil.ReadDir(dir) + + -- dir_scan will be nil if the directory is read-protected (no permissions) + if dir_scan == nil then + micro.InfoBar():Error("Error scanning dir: ", scan_error) + return nil + end + + -- The list of files to be returned (and eventually put in the view) + local results = {} + local files = {} + + local function get_results_object(file_name) + local abs_path = filepath.Join(dir, file_name) + -- Use "+" for dir's, "" for files + local dirmsg = (is_dir(abs_path) and "+" or "") + return new_listobj(abs_path, dirmsg, ownership, indent_n) + end + + -- Save so we don't have to rerun GetOption a bunch + local show_dotfiles = config.GetGlobalOption("filemanager.showdotfiles") + local show_ignored = config.GetGlobalOption("filemanager.showignored") + local folders_first = config.GetGlobalOption("filemanager.foldersfirst") + + -- The list of VCS-ignored files (if any) + -- Only bother getting ignored files if we're not showing ignored + local ignored_files = (not show_ignored and get_ignored_files(dir) or {}) + -- True/false if the file is an ignored file + local function is_ignored_file(filename) + for i = 1, #ignored_files do + if ignored_files[i] == filename then + return true + end + end + return false + end + + -- Hold the current scan's filename in most of the loops below + local filename + + for i = 1, #dir_scan do + local showfile = true + filename = dir_scan[i]:Name() + -- If we should not show dotfiles, and this is a dotfile, don't show + if not show_dotfiles and is_dotfile(filename) then + showfile = false + end + -- If we should not show ignored files, and this is an ignored file, don't show + if not show_ignored and is_ignored_file(filename) then + showfile = false + end + if showfile then + -- This file is good to show, proceed + if folders_first and not is_dir(filepath.Join(dir, filename)) then + -- If folders_first and this is a file, add it to (temporary) files + files[#files + 1] = get_results_object(filename) + else + -- Otherwise, add to results + results[#results + 1] = get_results_object(filename) + end + end + end + if #files > 0 then + -- Append any files to results, now that all folders have been added + -- files will be > 0 only if folders_first and there are files + for i = 1, #files do + results[#results + 1] = files[i] + end + end + + -- Return the list of scanned files + return results +end + +-- A short "get y" for when acting on the scanlist +-- Needed since we don't store the first 3 visible indicies in scanlist +local function get_safe_y(optional_y) + -- Default to 0 so we can check against and see if it's bad + local y = 0 + -- Make the passed y optional + if optional_y == nil then + -- Default to cursor's Y loc if nothing was passed, instead of declaring another y + optional_y = tree_view.Cursor.Loc.Y + end + -- 0/1/2 would be the top "dir, separator, .." so check if it's past + if optional_y > 2 then + -- -2 to conform to our scanlist, since zero-based Go index & Lua's one-based + y = tree_view.Cursor.Loc.Y - 2 + end + return y +end + +-- Joins the target dir's leading path to the passed name +local function dirname_and_join(path, join_name) + -- The leading path to the dir we're in + local leading_path = filepath.Dir(path) + -- Joins with OS-specific slashes + return filepath.Join(leading_path, join_name) +end + +-- Hightlights the line when you move the cursor up/down +local function select_line(last_y) + -- Make last_y optional + if last_y ~= nil then + -- Don't let them move past ".." by checking the result first + if last_y > 1 then + -- If the last position was valid, move back to it + tree_view.Cursor.Loc.Y = last_y + end + elseif tree_view.Cursor.Loc.Y < 2 then + -- Put the cursor on the ".." if it's above it + tree_view.Cursor.Loc.Y = 2 + end + + -- Puts the cursor back in bounds (if it isn't) for safety + tree_view.Cursor:Relocate() + + -- Makes sure the cursor is visible (if it isn't) + -- (false) means no callback + tree_view:Center() + + -- Highlight the current line where the cursor is + tree_view.Cursor:SelectLine() +end + +-- Simple true/false if scanlist is currently empty +local function scanlist_is_empty() + if next(scanlist) == nil then + return true + else + return false + end +end + +local function refresh_view() + clear_messenger() + + tree_view:ResizePane(30) + -- If it's less than 30, just use 30 for width. Don't want it too small + + if tree_view:GetView().Width < 30 then + tree_view:ResizePane(30) + end + + if tree_view:GetView().Width > 31 then + tree_view:ResizePane(30) + end + + -- Delete everything in the view/buffer + tree_view.Buf.EventHandler:Remove(tree_view.Buf:Start(), tree_view.Buf:End()) + + -- Insert the top 3 things that are always there + -- Current dir + tree_view.Buf.EventHandler:Insert(buffer.Loc(0, 0), current_dir .. "\n") + -- An ASCII separator + tree_view.Buf.EventHandler:Insert(buffer.Loc(0, 1), repeat_str("─", tree_view:GetView().Width) .. "\n") + -- The ".." and use a newline if there are things in the current dir + tree_view.Buf.EventHandler:Insert(buffer.Loc(0, 2), (#scanlist > 0 and "..\n" or "..")) + + -- Holds the current basename of the path (purely for display) + local display_content + + -- NOTE: might want to not do all these concats in the loop, it can get slow + for i = 1, #scanlist do + -- The first 3 indicies are the dir/separator/"..", so skip them + if scanlist[i].dirmsg ~= "" then + -- Add the + or - to the left to signify if it's compressed or not + -- Add a forward slash to the right to signify it's a dir + display_content = scanlist[i].dirmsg .. " " .. get_basename(scanlist[i].abspath) .. "/" + else + -- Use the basename from the full path for display + -- Two spaces to align with any directories, instead of being "off" + display_content = " " .. get_basename(scanlist[i].abspath) + end + + if scanlist[i].owner > 0 then + -- Add a space and repeat it * the indent number + display_content = repeat_str(" ", 2 * scanlist[i].indent) .. display_content + end + + -- Newlines are needed for all inserts except the last + -- If you insert a newline on the last, it leaves a blank spot at the bottom + if i < #scanlist then + display_content = display_content .. "\n" + end + + -- Insert line-by-line to avoid out-of-bounds on big folders + -- +2 so we skip the 0/1/2 positions that hold the top dir/separator/.. + tree_view.Buf.EventHandler:Insert(buffer.Loc(0, i + 2), display_content) + end + + -- Resizes all views after messing with ours + tree_view:Tab():Resize() +end + +-- Moves the cursor to the ".." in tree_view +local function move_cursor_top() + -- 2 is the position of the ".." + tree_view.Cursor.Loc.Y = 2 + + -- select the line after moving + select_line() +end + +local function refresh_and_select() + -- Save the cursor position before messing with the view.. + -- because changing contents in the view causes the Y loc to move + local last_y = tree_view.Cursor.Loc.Y + -- Actually refresh + refresh_view() + -- Moves the cursor back to it's original position + select_line(last_y) +end + +-- Find everything nested under the target, and remove it from the scanlist +local function compress_target(y, delete_y) + -- Can't compress the top stuff, or if there's nothing there, so exit early + if y == 0 or scanlist_is_empty() then + return + end + -- Check if the target is a dir, since files don't have anything to compress + -- Also make sure it's actually an uncompressed dir by checking the gutter message + if scanlist[y].dirmsg == "-" then + local target_index, delete_index + -- Add the original target y to stuff to delete + local delete_under = {[1] = y} + local new_table = {} + local del_count = 0 + -- Loop through the whole table, looking for nested content, or stuff with ownership == y... + -- and delete matches. y+1 because we want to start under y, without actually touching y itself. + for i = 1, #scanlist do + delete_index = false + -- Don't run on y, since we don't always delete y + if i ~= y then + -- On each loop, check if the ownership matches + for x = 1, #delete_under do + -- Check for something belonging to a thing to delete + if scanlist[i].owner == delete_under[x] then + -- Delete the target if it has an ownership to our delete target + delete_index = true + -- Keep count of total deleted (can't use #delete_under because it's for deleted dir count) + del_count = del_count + 1 + -- Check if an uncompressed dir + if scanlist[i].dirmsg == "-" then + -- Add the index to stuff to delete, since it holds nested content + delete_under[#delete_under + 1] = i + end + -- See if we're on the "deepest" nested content + if scanlist[i].indent == highest_visible_indent and scanlist[i].indent > 0 then + -- Save the lower indent, since we're minimizing/deleting nested dirs + highest_visible_indent = highest_visible_indent - 1 + end + -- Nothing else to do, so break this inner loop + break + end + end + end + if not delete_index then + -- Save the index in our new table + new_table[#new_table + 1] = scanlist[i] + end + end + + scanlist = new_table + + if del_count > 0 then + -- Ownership adjusting since we're deleting an index + for i = y + 1, #scanlist do + -- Don't touch root file/dirs + if scanlist[i].owner > y then + -- Minus ownership, on everything below i, the number deleted + scanlist[i]:decrease_owner(del_count) + end + end + end + + -- If not deleting, then update the gutter message to be + to signify compressed + if not delete_y then + -- Update the dir message + scanlist[y].dirmsg = "+" + end + elseif config.GetGlobalOption("filemanager.compressparent") and not delete_y then + goto_parent_dir() + -- Prevent a pointless refresh of the view + return + end + + -- Put outside check above because we call this to delete targets as well + if delete_y then + local second_table = {} + -- Quickly remove y + for i = 1, #scanlist do + if i == y then + -- Reduce everything's ownership by 1 after y + for x = i + 1, #scanlist do + -- Don't touch root file/dirs + if scanlist[x].owner > y then + -- Minus 1 since we're just deleting y + scanlist[x]:decrease_owner(1) + end + end + else + -- Put everything but y into the temporary table + second_table[#second_table + 1] = scanlist[i] + end + end + -- Put everything (but y) back into scanlist, with adjusted ownership values + scanlist = second_table + end + + if tree_view:GetView().Width > (30 + highest_visible_indent) then + -- Shave off some width + tree_view:ResizePane(30) + end + + refresh_and_select() +end + +-- Prompts the user for deletion of a file/dir when triggered +-- Not local so Micro can access it +function prompt_delete_at_cursor() + local y = get_safe_y() + -- Don't let them delete the top 3 index dir/separator/.. + if y == 0 or scanlist_is_empty() then + micro.InfoBar():Error("You can't delete that") + -- Exit early if there's nothing to delete + return + end + + micro.InfoBar():YNPrompt("Do you want to delete the " .. (scanlist[y].dirmsg ~= "" and "dir" or "file") .. ' "' .. scanlist[y].abspath .. '"? ', function(yes, canceled) + if yes and not canceled then + -- Use Go's os.Remove to delete the file + local go_os = import("os") + -- Delete the target (if its a dir then the children too) + local remove_log = go_os.RemoveAll(scanlist[y].abspath) + if remove_log == nil then + micro.InfoBar():Message("Filemanager deleted: ", scanlist[y].abspath) + -- Remove the target (and all nested) from scanlist[y + 1] + -- true to delete y + compress_target(get_safe_y(), true) + else + micro.InfoBar():Error("Failed deleting file/dir: ", remove_log) + end + else + micro.InfoBar():Message("Nothing was deleted") + end + end) +end + +-- Changes the current dir in the top of the tree.. +-- then scans that dir, and prints it to the view +local function update_current_dir(path) + -- Clear the highest since this is a full refresh + highest_visible_indent = 0 + -- Set the width back to 30 + tree_view:ResizePane(30) + -- Update the current dir to the new path + current_dir = path + + -- Get the current working dir's files into our list of files + -- 0 ownership because this is a scan of the base dir + -- 0 indent because this is the base dir + local scan_results = get_scanlist(path, 0, 0) + -- Safety check with not-nil + if scan_results ~= nil then + -- Put in the new scan stuff + scanlist = scan_results + else + -- If nil, just empty it + scanlist = {} + end + + refresh_view() + -- Since we're going into a new dir, move cursor to the ".." by default + move_cursor_top() +end + +-- (Tries to) go back one "step" from the current directory +local function go_back_dir() + -- Use Micro's dirname to get everything but the current dir's path + local one_back_dir = filepath.Dir(current_dir) + -- Try opening, assuming they aren't at "root", by checking if it matches last dir + if one_back_dir ~= current_dir then + -- If filepath.Dir returns different, then they can move back.. + -- so we update the current dir and refresh + update_current_dir(one_back_dir) + end +end + +-- Tries to open the current index +-- If it's the top dir indicator, or separator, nothing happens +-- If it's ".." then it tries to go back a dir +-- If it's a dir then it moves into the dir and refreshes +-- If it's actually a file, open it in a new vsplit +-- THIS EXPECTS ZERO-BASED Y +local function try_open_at_y(y) + -- 2 is the zero-based index of ".." + if y == 2 then + go_back_dir() + elseif y > 2 and not scanlist_is_empty() then + -- -2 to conform to our scanlist "missing" first 3 indicies + y = y - 2 + if scanlist[y].dirmsg ~= "" then + -- if passed path is a directory, update the current dir to be one deeper.. + update_current_dir(scanlist[y].abspath) + else + -- If it's a file, then open it + micro.InfoBar():Message("Filemanager opened ", scanlist[y].abspath) + -- Opens the absolute path in new vertical view + micro.CurPane():VSplitIndex(buffer.NewBufferFromFile(scanlist[y].abspath), true) + -- Resizes all views after opening a file + -- tabs[curTab + 1]:Resize() + end + else + micro.InfoBar():Error("Can't open that") + end +end + +-- Opens the dir's contents nested under itself +local function uncompress_target(y) + -- Exit early if on the top 3 non-list items + if y == 0 or scanlist_is_empty() then + return + end + -- Only uncompress if it's a dir and it's not already uncompressed + if scanlist[y].dirmsg == "+" then + -- Get a new scanlist with results from the scan in the target dir + local scan_results = get_scanlist(scanlist[y].abspath, y, scanlist[y].indent + 1) + -- Don't run any of this if there's nothing in the dir we scanned, pointless + if scan_results ~= nil then + -- Will hold all the old values + new scan results + local new_table = {} + -- By not inserting in-place, some unexpected results can be avoided + -- Also, table.insert actually moves values up (???) instead of down + for i = 1, #scanlist do + -- Put the current val into our new table + new_table[#new_table + 1] = scanlist[i] + if i == y then + -- Fill in the scan results under y + for x = 1, #scan_results do + new_table[#new_table + 1] = scan_results[x] + end + -- Basically "moving down" everything below y, so ownership needs to increase on everything + for inner_i = y + 1, #scanlist do + -- When root not pushed by inserting, don't change its ownership + -- This also has a dual-purpose to make it not effect root file/dirs + -- since y is always >= 3 + if scanlist[inner_i].owner > y then + -- Increase each indicies ownership by the number of scan results inserted + scanlist[inner_i]:increase_owner(#scan_results) + end + end + end + end + + -- Update our scanlist with the new values + scanlist = new_table + end + + -- Change to minus to signify it's uncompressed + scanlist[y].dirmsg = "-" + + -- Check if we actually need to resize, or if we're nesting at the same indent + -- Also check if there's anything in the dir, as we don't need to expand on an empty dir + if scan_results ~= nil then + if scanlist[y].indent > highest_visible_indent and #scan_results >= 1 then + -- Save the new highest indent + highest_visible_indent = scanlist[y].indent + -- Increase the width to fit the new nested content + tree_view:ResizePane(30) + end + end + + refresh_and_select() + end +end + +-- Stat a path to check if it exists, returning true/false +local function path_exists(path) + local go_os = import("os") + -- Stat the file/dir path we created + -- file_stat should be non-nil, and stat_err should be nil on success + local file_stat, stat_err = go_os.Stat(path) + -- Check if what we tried to create exists + if stat_err ~= nil then + -- true/false if the file/dir exists + return go_os.IsExist(stat_err) + elseif file_stat ~= nil then + -- Assume it exists if no errors + return true + end + return false +end + +-- Prompts for a new name, then renames the file/dir at the cursor's position +-- Not local so Micro can use it +function rename_at_cursor(bp, args) + + if micro.CurPane() ~= tree_view then + micro.InfoBar():Message("Rename only works with the cursor in the tree!") + return + end + + -- Safety check they actually passed a name + if #args < 1 then + micro.InfoBar():Error('When using "rename" you need to input a new name') + return + end + + local new_name = args[1] + + -- +1 since Go uses zero-based indices + local y = get_safe_y() + -- Check if they're trying to rename the top stuff + if y == 0 then + -- Error since they tried to rename the top stuff + micro.InfoBar():Message("You can't rename that!") + return + end + + -- The old file/dir's path + local old_path = scanlist[y].abspath + -- Join the path into their supplied rename, so that we have an absolute path + local new_path = dirname_and_join(old_path, new_name) + -- Use Go's os package for renaming the file/dir + local golib_os = import("os") + -- Actually rename the file + local log_out = golib_os.Rename(old_path, new_path) + -- Output the log, if any, of the rename + if log_out ~= nil then + micro.Log("Rename log: ", log_out) + end + + -- Check if the rename worked + if not path_exists(new_path) then + micro.InfoBar():Error("Path doesn't exist after rename!") + return + end + + -- NOTE: doesn't alphabetically sort after refresh, but it probably should + -- Replace the old path with the new path + scanlist[y].abspath = new_path + -- Refresh the tree with our new name + refresh_and_select() +end + +-- Prompts the user for the file/dir name, then creates the file/dir using Go's os package +local function create_filedir(filedir_name, make_dir) + if micro.CurPane() ~= tree_view then + micro.InfoBar():Message("You can't create a file/dir if your cursor isn't in the tree!") + return + end + + -- Safety check they passed a name + if filedir_name == nil then + micro.InfoBar():Error('You need to input a name when using "touch" or "mkdir"!') + return + end + + -- The target they're trying to create on top of/in/at/whatever + local y = get_safe_y() + -- Holds the path passed to Go for the eventual new file/dir + local filedir_path + -- A true/false if scanlist is empty + local scanlist_empty = scanlist_is_empty() + + -- Check there's actually anything in the list, and that they're not on the ".." + if not scanlist_empty and y ~= 0 then + -- If they're inserting on a folder, don't strip its path + if scanlist[y].dirmsg ~= "" then + -- Join our new file/dir onto the dir + filedir_path = filepath.Join(scanlist[y].abspath, filedir_name) + else + -- The current index is a file, so strip its name and join ours onto it + filedir_path = dirname_and_join(scanlist[y].abspath, filedir_name) + end + else + -- if nothing in the list, or cursor is on top of "..", use the current dir + filedir_path = filepath.Join(current_dir, filedir_name) + end + + -- Check if the name is already taken by a file/dir + if path_exists(filedir_path) then + micro.InfoBar():Error("You can't create a file/dir with a pre-existing name") + return + end + + -- Use Go's os package for creating the files + local golib_os = import("os") + -- Create the dir or file + if make_dir then + -- Creates the dir + golib_os.Mkdir(filedir_path, golib_os.ModePerm) + micro.Log("Filemanager created directory: " .. filedir_path) + else + -- Creates the file + golib_os.Create(filedir_path) + micro.Log("Filemanager created file: " .. filedir_path) + end + + -- If the file we tried to make doesn't exist, fail + if not path_exists(filedir_path) then + micro.InfoBar():Error("The file/dir creation failed") + + return + end + + -- Creates a sort of default object, to be modified below + -- If creating a dir, use a "+" + local new_filedir = new_listobj(filedir_path, (make_dir and "+" or ""), 0, 0) + + -- Refresh with our new value(s) + local last_y + + -- Only insert to scanlist if not created into a compressed dir, since it'd be hidden if it was + -- Wrap the below checks so a y=0 doesn't break something + if not scanlist_empty and y ~= 0 then + -- +1 so it's highlighting the new file/dir + last_y = tree_view.Cursor.Loc.Y + 1 + + -- Only actually add the object to the list if it's not created on an uncompressed folder + if scanlist[y].dirmsg == "+" then + -- Exit early, since it was created into an uncompressed folder + + return + elseif scanlist[y].dirmsg == "-" then + -- Check if created on top of an uncompressed folder + -- Change ownership to the folder it was created on top of.. + -- otherwise, the ownership would be incorrect + new_filedir.owner = y + -- We insert under the folder, so increment the indent + new_filedir.indent = scanlist[y].indent + 1 + else + -- This triggers if the cursor is on top of a file... + -- so we copy the properties of it + new_filedir.owner = scanlist[y].owner + new_filedir.indent = scanlist[y].indent + end + + -- A temporary table for adding our new object, and manipulation + local new_table = {} + -- Insert the new file/dir, and update ownership of everything below it + for i = 1, #scanlist do + -- Don't use i as index, as it will be off by one on the next pass after below "i == y" + new_table[#new_table + 1] = scanlist[i] + if i == y then + -- Insert our new file/dir (below the last item) + new_table[#new_table + 1] = new_filedir + -- Increase ownership of everything below it, since we're inserting + -- Basically "moving down" everything below y, so ownership needs to increase on everything + for inner_i = y + 1, #scanlist do + -- When root not pushed by inserting, don't change its ownership + -- This also has a dual-purpose to make it not effect root file/dirs + -- since y is always >= 3 + if scanlist[inner_i].owner > y then + -- Increase each indicies ownership by 1 since we're only inserting 1 file/dir + scanlist[inner_i]:increase_owner(1) + end + end + end + end + -- Update the scanlist with the new object & updated ownerships + scanlist = new_table + else + -- The scanlist is empty (or cursor is on ".."), so we add on our new file/dir at the bottom + scanlist[#scanlist + 1] = new_filedir + -- Add current position so it takes into account where we are + last_y = #scanlist + tree_view.Cursor.Loc.Y + end + + refresh_view() + select_line(last_y) +end + +-- Triggered with "touch filename" +function new_file(bp, args) + + -- Safety check they actually passed a name + if #args < 1 then + micro.InfoBar():Error('When using "touch" you need to input a file name') + return + end + + local file_name = args[1] + + -- False because not a dir + create_filedir(file_name, false) +end + +-- Triggered with "mkdir dirname" +function new_dir(bp, args) + + -- Safety check they actually passed a name + if #args < 1 then + micro.InfoBar():Error('When using "mkdir" you need to input a dir name') + return + end + + local dir_name = args[1] + + -- True because dir + create_filedir(dir_name, true) +end + +-- open_tree setup's the view +local function open_tree() + -- Open a new Vsplit (on the very left) + micro.CurPane():VSplitIndex(buffer.NewBuffer("", "filemanager"), false) + -- Save the new view so we can access it later + tree_view = micro.CurPane() + + -- Set the width of tree_view to 30% & lock it + tree_view:ResizePane(30) + -- Set the type to unsavable + -- tree_view.Buf.Type = buffer.BTLog + tree_view.Buf.Type.Scratch = true + tree_view.Buf.Type.Readonly = true + + -- Set the various display settings, but only on our view (by using SetLocalOption instead of SetOption) + -- NOTE: Micro requires the true/false to be a string + -- Softwrap long strings (the file/dir paths) + tree_view.Buf:SetOptionNative("softwrap", true) + -- No line numbering + tree_view.Buf:SetOptionNative("ruler", false) + -- Is this needed with new non-savable settings from being "vtLog"? + tree_view.Buf:SetOptionNative("autosave", false) + -- Don't show the statusline to differentiate the view from normal views + tree_view.Buf:SetOptionNative("statusformatr", "") + tree_view.Buf:SetOptionNative("statusformatl", "filemanager") + tree_view.Buf:SetOptionNative("scrollbar", false) + + -- Fill the scanlist, and then print its contents to tree_view + update_current_dir(os.Getwd()) +end + +-- close_tree will close the tree plugin view and release memory. +local function close_tree() + if tree_view ~= nil then + tree_view:Quit() + tree_view = nil + clear_messenger() + end +end + +-- toggle_tree will toggle the tree view visible (create) and hide (delete). +function toggle_tree() + if tree_view == nil then + open_tree() + else + close_tree() + end +end + +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- Functions exposed specifically for the user to bind +-- Some are used in callbacks as well +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +function uncompress_at_cursor() + if micro.CurPane() == tree_view then + uncompress_target(get_safe_y()) + end +end + +function compress_at_cursor() + if micro.CurPane() == tree_view then + -- False to not delete y + compress_target(get_safe_y(), false) + end +end + +-- Goes up 1 visible directory (if any) +-- Not local so it can be bound +function goto_prev_dir() + if micro.CurPane() ~= tree_view or scanlist_is_empty() then + return + end + + local cur_y = get_safe_y() + -- If they try to run it on the ".." do nothing + if cur_y ~= 0 then + local move_count = 0 + for i = cur_y - 1, 1, -1 do + move_count = move_count + 1 + -- If a dir, stop counting + if scanlist[i].dirmsg ~= "" then + -- Jump to its parent (the ownership) + tree_view.Cursor:UpN(move_count) + select_line() + break + end + end + end +end + +-- Goes down 1 visible directory (if any) +-- Not local so it can be bound +function goto_next_dir() + if micro.CurPane() ~= tree_view or scanlist_is_empty() then + return + end + + local cur_y = get_safe_y() + local move_count = 0 + -- If they try to goto_next on "..", pretends the cursor is valid + if cur_y == 0 then + cur_y = 1 + move_count = 1 + end + -- Only do anything if it's even possible for there to be another dir + if cur_y < #scanlist then + for i = cur_y + 1, #scanlist do + move_count = move_count + 1 + -- If a dir, stop counting + if scanlist[i].dirmsg ~= "" then + -- Jump to its parent (the ownership) + tree_view.Cursor:DownN(move_count) + select_line() + break + end + end + end +end + +-- Goes to the parent directory (if any) +-- Not local so it can be keybound +function goto_parent_dir() + if micro.CurPane() ~= tree_view or scanlist_is_empty() then + return + end + + local cur_y = get_safe_y() + -- Check if the cursor is even in a valid location for jumping to the owner + if cur_y > 0 then + -- Jump to its parent (the ownership) + tree_view.Cursor:UpN(cur_y - scanlist[cur_y].owner) + select_line() + end +end + +function try_open_at_cursor() + if micro.CurPane() ~= tree_view or scanlist_is_empty() then + return + end + + try_open_at_y(tree_view.Cursor.Loc.Y) +end + +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- Shorthand functions for actions to reduce repeat code +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +-- Used to fail certain actions that we shouldn't allow on the tree_view +local function false_if_tree(view) + if view == tree_view then + return false + end +end + +-- Select the line at the cursor +local function selectline_if_tree(view) + if view == tree_view then + select_line() + end +end + +-- Move the cursor to the top, but don't allow the action +local function aftermove_if_tree(view) + if view == tree_view then + if tree_view.Cursor.Loc.Y < 2 then + -- If it went past the "..", move back onto it + tree_view.Cursor:DownN(2 - tree_view.Cursor.Loc.Y) + end + select_line() + end +end + +local function clearselection_if_tree(view) + if view == tree_view then + -- Clear the selection when doing a find, so it doesn't copy the current line + tree_view.Cursor:ResetSelection() + end +end + +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- All the events for certain Micro keys go below here +-- Other than things we flat-out fail +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +-- Close current +function preQuit(view) + if view == tree_view then + -- A fake quit function + close_tree() + -- Don't actually "quit", otherwise it closes everything without saving for some reason + return false + end +end + +-- Close all +function preQuitAll(view) + close_tree() +end + +-- FIXME: Workaround for the weird 2-index movement on cursordown +function preCursorDown(view) + if view == tree_view then + tree_view.Cursor:Down() + select_line() + -- Don't actually go down, as it moves 2 indicies for some reason + return false + end +end + +-- Up +function onCursorUp(view) + selectline_if_tree(view) +end + +-- Alt-Shift-{ +-- Go to target's parent directory (if exists) +function preParagraphPrevious(view) + if view == tree_view then + goto_prev_dir() + -- Don't actually do the action + return false + end +end + +-- Alt-Shift-} +-- Go to next dir (if exists) +function preParagraphNext(view) + if view == tree_view then + goto_next_dir() + -- Don't actually do the action + return false + end +end + +-- PageUp +function onCursorPageUp(view) + aftermove_if_tree(view) +end + +-- Ctrl-Up +function onCursorStart(view) + aftermove_if_tree(view) +end + +-- PageDown +function onCursorPageDown(view) + selectline_if_tree(view) +end + +-- Ctrl-Down +function onCursorEnd(view) + selectline_if_tree(view) +end + +function onNextSplit(view) + selectline_if_tree(view) +end + +function onPreviousSplit(view) + selectline_if_tree(view) +end + +-- On click, open at the click's y +function preMousePress(view, event) + if view == tree_view then + local x, y = event:Position() + -- Fixes the y because softwrap messes with it + local new_x, new_y = tree_view:GetMouseClickLocation(x, y) + -- Try to open whatever is at the click's y index + -- Will go into/back dirs based on what's clicked, nothing gets expanded + try_open_at_y(new_y) + -- Don't actually allow the mousepress to trigger, so we avoid highlighting stuff + return false + end +end + +-- Up +function preCursorUp(view) + if view == tree_view then + -- Disallow selecting past the ".." in the tree + if tree_view.Cursor.Loc.Y == 2 then + return false + end + end +end + +-- Left +function preCursorLeft(view) + if view == tree_view then + -- +1 because of Go's zero-based index + -- False to not delete y + compress_target(get_safe_y(), false) + -- Don't actually move the cursor, as it messes with selection + return false + end +end + +-- Right +function preCursorRight(view) + if view == tree_view then + -- +1 because of Go's zero-based index + uncompress_target(get_safe_y()) + -- Don't actually move the cursor, as it messes with selection + return false + end +end + +-- Workaround for tab getting inserted into opened files +-- Ref https://github.com/zyedidia/micro/issues/992 +local tab_pressed = false + +-- Tab +function preIndentSelection(view) + if view == tree_view then + tab_pressed = true + -- Open the file + -- Using tab instead of enter, since enter won't work with Readonly + try_open_at_y(tree_view.Cursor.Loc.Y) + -- Don't actually insert a tab + return false + end +end + +-- Workaround for tab getting inserted into opened files +-- Ref https://github.com/zyedidia/micro/issues/992 +function preInsertTab(view) + if tab_pressed then + tab_pressed = false + return false + end +end +function preInsertNewline(view) + if view == tree_view then + return false + end + return true +end +-- CtrlL +function onJumpLine(view) + -- Highlight the line after jumping to it + -- Also moves you to index 3 (2 in zero-base) if you went to the first 2 lines + aftermove_if_tree(view) +end + +-- ShiftUp +function preSelectUp(view) + if view == tree_view then + -- Go to the file/dir's parent dir (if any) + goto_parent_dir() + -- Don't actually selectup + return false + end +end + +-- CtrlF +function preFind(view) + -- Since something is always selected, clear before a find + -- Prevents copying the selection into the find input + clearselection_if_tree(view) +end + +-- FIXME: doesn't work for whatever reason +function onFind(view) + -- Select the whole line after a find, instead of just the input txt + selectline_if_tree(view) +end + +-- CtrlN after CtrlF +function onFindNext(view) + selectline_if_tree(view) +end + +-- CtrlP after CtrlF +function onFindPrevious(view) + selectline_if_tree(view) +end + +-- NOTE: This is a workaround for "cd" not having its own callback +local precmd_dir + +function preCommandMode(view) + precmd_dir = os.Getwd() +end + +-- Update the current dir when using "cd" +function onCommandMode(view) + local new_dir = os.Getwd() + -- Only do anything if the tree is open, and they didn't cd to nothing + if tree_view ~= nil and new_dir ~= precmd_dir and new_dir ~= current_dir then + update_current_dir(new_dir) + end +end + +------------------------------------------------------------------ +-- Fail a bunch of useless actions +-- Some of these need to be removed (read-only makes some useless) +------------------------------------------------------------------ + +function preStartOfLine(view) + return false_if_tree(view) +end + +function preStartOfText(view) + return false_if_tree(view) +end + +function preEndOfLine(view) + return false_if_tree(view) +end + +function preMoveLinesDown(view) + return false_if_tree(view) +end + +function preMoveLinesUp(view) + return false_if_tree(view) +end + +function preWordRight(view) + return false_if_tree(view) +end + +function preWordLeft(view) + return false_if_tree(view) +end + +function preSelectDown(view) + return false_if_tree(view) +end + +function preSelectLeft(view) + return false_if_tree(view) +end + +function preSelectRight(view) + return false_if_tree(view) +end + +function preSelectWordRight(view) + return false_if_tree(view) +end + +function preSelectWordLeft(view) + return false_if_tree(view) +end + +function preSelectToStartOfLine(view) + return false_if_tree(view) +end + +function preSelectToStartOfText(view) + return false_if_tree(view) +end + +function preSelectToEndOfLine(view) + return false_if_tree(view) +end + +function preSelectToStart(view) + return false_if_tree(view) +end + +function preSelectToEnd(view) + return false_if_tree(view) +end + +function preDeleteWordLeft(view) + return false_if_tree(view) +end + +function preDeleteWordRight(view) + return false_if_tree(view) +end + +function preOutdentSelection(view) + return false_if_tree(view) +end + +function preOutdentLine(view) + return false_if_tree(view) +end + +function preSave(view) + return false_if_tree(view) +end + +function preCut(view) + return false_if_tree(view) +end + +function preCutLine(view) + return false_if_tree(view) +end + +function preDuplicateLine(view) + return false_if_tree(view) +end + +function prePaste(view) + return false_if_tree(view) +end + +function prePastePrimary(view) + return false_if_tree(view) +end + +function preMouseMultiCursor(view) + return false_if_tree(view) +end + +function preSpawnMultiCursor(view) + return false_if_tree(view) +end + +function preSelectAll(view) + return false_if_tree(view) +end + +function init() + -- Let the user disable showing of dotfiles like ".editorconfig" or ".DS_STORE" + config.RegisterCommonOption("filemanager", "showdotfiles", true) + -- Let the user disable showing files ignored by the VCS (i.e. gitignored) + config.RegisterCommonOption("filemanager", "showignored", true) + -- Let the user disable going to parent directory via left arrow key when file selected (not directory) + config.RegisterCommonOption("filemanager", "compressparent", true) + -- Let the user choose to list sub-folders first when listing the contents of a folder + config.RegisterCommonOption("filemanager", "foldersfirst", true) + -- Lets the user have the filetree auto-open any time Micro is opened + -- false by default, as it's a rather noticable user-facing change + config.RegisterCommonOption("filemanager", "openonstart", false) + + -- Open/close the tree view + config.MakeCommand("tree", toggle_tree, config.NoComplete) + -- Rename the file/dir under the cursor + config.MakeCommand("rename", rename_at_cursor, config.NoComplete) + -- Create a new file + config.MakeCommand("touch", new_file, config.NoComplete) + -- Create a new dir + config.MakeCommand("mkdir", new_dir, config.NoComplete) + -- Delete a file/dir, and anything contained in it if it's a dir + config.MakeCommand("rm", prompt_delete_at_cursor, config.NoComplete) + -- Adds colors to the ".." and any dir's in the tree view via syntax highlighting + -- TODO: Change it to work with git, based on untracked/changed/added/whatever + config.AddRuntimeFile("filemanager", config.RTSyntax, "syntax.yaml") + + -- NOTE: This must be below the syntax load command or coloring won't work + -- Just auto-open if the option is enabled + -- This will run when the plugin first loads + if config.GetGlobalOption("filemanager.openonstart") then + -- Check for safety on the off-chance someone's init.lua breaks this + if tree_view == nil then + open_tree() + -- Puts the cursor back in the empty view that initially spawns + -- This is so the cursor isn't sitting in the tree view at startup + micro.CurPane():NextSplit() + else + -- Log error so they can fix it + micro.Log( + "Warning: filemanager.openonstart was enabled, but somehow the tree was already open so the option was ignored." + ) + end + end +end diff --git a/config/micro/plug/filemanager/repo.json b/config/micro/plug/filemanager/repo.json new file mode 100644 index 0000000..4bd7de2 --- /dev/null +++ b/config/micro/plug/filemanager/repo.json @@ -0,0 +1,45 @@ +[ + { + "Name": "filemanager", + "Description": "File manager for Micro", + "Tags": ["filetree", "filemanager", "file", "manager"], + "Website": "", + "Versions": [ + { + "Version": "2.1.1", + "Url": "https://github.com/NicolaiSoeborg/filemanager-plugin/archive/v2.1.1.zip", + "Require": { + "micro": ">=1.3.2" + } + }, + { + "Version": "3.1.0", + "Url": "https://github.com/NicolaiSoeborg/filemanager-plugin/archive/v3.1.0.zip", + "Require": { + "micro": ">=1.3.5" + } + }, + { + "Version": "3.4.0", + "Url": "https://github.com/NicolaiSoeborg/filemanager-plugin/archive/v3.4.0.zip", + "Require": { + "micro": ">=1.4.1" + } + }, + { + "Version": "3.5.0", + "Url": "https://github.com/micro-editor/updated-plugins/releases/download/v1.0.0/filemanager-3.5.0.zip", + "Require": { + "micro": ">=2.0.0-1" + } + }, + { + "Version": "3.5.1", + "Url": "https://github.com/micro-editor/updated-plugins/releases/download/v1.0.0/filemanager-3.5.1.zip", + "Require": { + "micro": ">=2.0.0-1" + } + } + ] + } +] diff --git a/config/micro/plug/filemanager/syntax.yaml b/config/micro/plug/filemanager/syntax.yaml new file mode 100644 index 0000000..da001cf --- /dev/null +++ b/config/micro/plug/filemanager/syntax.yaml @@ -0,0 +1,9 @@ +filetype: filemanager + +detect: + filename: "^filemanager$" + +rules: + # The "..", the separator line thing, and directories + # Optionally, add this below to highlight the ascii line: "^─*$" + - special: "^\\.\\.$|\\-\\s.*|\\+\\s.*" diff --git a/config/micro/settings.json b/config/micro/settings.json new file mode 100644 index 0000000..30dc487 --- /dev/null +++ b/config/micro/settings.json @@ -0,0 +1,5 @@ +{ + "colorscheme": "bubblegum", + "wordwrap": true, + "softwrap": true +} diff --git a/config/micro/syntax/LICENSE b/config/micro/syntax/LICENSE new file mode 100644 index 0000000..20e978c --- /dev/null +++ b/config/micro/syntax/LICENSE @@ -0,0 +1,22 @@ +Micro's syntax files are licensed under the MIT "Expat" License: + +Copyright (c) 2020: Zachary Yedidia, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/config/micro/syntax/PowerShell.yaml b/config/micro/syntax/PowerShell.yaml new file mode 100644 index 0000000..a778199 --- /dev/null +++ b/config/micro/syntax/PowerShell.yaml @@ -0,0 +1,128 @@ +# PowerShell syntax highlighting file for micro - https://micro-editor.github.io/ +# PowerShell syntax taken from: https://github.com/PowerShell/EditorSyntax + +filetype: powershell + +detect: + filename: "\\.ps(1|m1|d1)$" + +rules: + # - comment.block: # Block Comment + # - comment.doc: # Doc Comment + # - comment.line: # Line Comment + # - comment.shebang: # Shebang Line + + # - constant: # Constant + # - constant.bool: # Constant (true, false) + # - constant.interpolation: + # - constant.number: # Constant (null) + # - constant.specialChar: + # - constant.string: # String + # - constant.string.char: + # - constant.string.url: # Uri + # - constant.unicode: + + # - identifier: # Also used for functions + # - identifier.class: # Also used for functions + # - identifier.macro: + # - identifier.var: + + # - preproc: # Preprocessor + # - preproc.DebugIdentifier: # Preprocessor + # - preproc.shebang: # The #! at the beginning of a file that tells the os what script interpreter to use + + # - special: # Special (global|local|private|script|using|workflow) + + # - statement: # Statements Keywords + # - statement.built_in: + # - statement.declaration: # Declaration Keywords + # - statement.meta: # Meta + # - statement.reserved: # Reserved Keywords + + # - symbol + # - symbol.brackets: # {}()[] and sometimes <> + # - symbol.operator: # Operators + # - symbol.tag: # For html tags, among other things + + # - type + # - type.collections: # Collections (array, hashtable) + # - type.ctypes: # CTypes (CBool, CChar, etc.) + # - type.keyword: # If you want a special highlight for keywords like 'private' + # - type.storage: # Storage Types (int, uint, string, etc.) + + # Class + - identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?" + - identifier.class: "(function)(?:([[:space:]][A-Za-z0-9]+[[:space:]]*))" + + # Verbs taken from PwSh 6.0.2 + - identifier: "(Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy)[-][A-Za-z0-9]+" + - identifier: "(Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide)[-][A-Za-z0-9]+" + - identifier: "(Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push)[-][A-Za-z0-9]+" + - identifier: "(Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke)[-][A-Za-z0-9]+" + - identifier: "(Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace)[-][A-Za-z0-9]+" + - identifier: "(Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)[-][A-Za-z0-9]+" + - identifier.var: "\\$(?i)((Global|Local|Private|Script|Using|Workflow)[:])?[A-Za-z0-9]*" + + + # Expression and types + - type: "\\[\\b([A-Za-z]+|[A-Za-z]+[0-9]+)\\b\\]" + + # Keywords + - statement: "\\b(alias|as|begin|break|catch|continue|data|default|define|do|dynamicparam)\\b" + - statement: "\\b(else|elseif|end|exit|finally|for|foreach|foreach-object|from|if|in|inlinescript)\\b" + - statement: "\\b(parallel|param|process|return|switch|throw|trap|try|until|using|var|where|where-object|while)\\b" + + # Special Keywords + - special: "\\b(break|continue|exit)\\b" + + - symbol.brackets: "(\\{|\\})" + - symbol.brackets: "(\\(|\\))" + - symbol.brackets: "(\\[|\\])" + - symbol.operator: "[\\-+/*=<>?:!~%&|]" + - symbol.operator: "[[:space:]][-](ne|eq|gt|ge|lt|le|like|notlike|match|notmatch|contains|notcontains|in|notin|replace|is|isnot)[[:space:]]" + + # Constants + - constant.bool: "\\b\\$(true|false|null)\\b" + - constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b" + + # Expression Mode String + - constant.string: + start: "\"" + end: "\"" + #skip: "\\\\." + rules: + - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" + - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" + + # Argument Mode String + - constant.string: + start: "'" + end: "'" + #skip: "\\\\." + rules: + - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" + - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" + + # Line Comment + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME|BUG):?" + + # Block Comment + - comment: + start: "<#" + end: "#>" + rules: + - todo: "(TODO|XXX|FIXME|BUG):?" + + # Embedded C# + - default: + start: "@\"" + end: "\"@" + rules: + - include: "csharp" + + # Todo + - todo: "(TODO|XXX|FIXME|BUG):?" diff --git a/config/micro/syntax/README.md b/config/micro/syntax/README.md new file mode 100644 index 0000000..a31acc0 --- /dev/null +++ b/config/micro/syntax/README.md @@ -0,0 +1,63 @@ +# Syntax Files + +Here are micro's syntax files. + +Each yaml file specifies how to detect the filetype based on file extension or header (first line of the line). +In addition, a signature can be provided to help resolving ambiguities when multiple matching filetypes are detected. +Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype. + +You can read more about how to write syntax files (and colorschemes) in the [colors](../help/colors.md) documentation. + +# Legacy '.micro' filetype + +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): + +``` +$ go run syntax_converter.go c.micro > c.yaml +``` + +Most of the syntax files here have been converted using that tool. + +Note that the tool isn't perfect and though it is unlikely, you may run into some small issues that you will have to fix manually +(about 4 files from this directory had issues after being converted). + +# Micro syntax highlighting files + +These are the syntax highlighting files for micro. To install them, just +put all the syntax files in `~/.config/micro/syntax`. + +They are taken from Nano, specifically from [this repository](https://github.com/scopatz/nanorc). +Micro syntax files are almost identical to Nano's, except for some key differences: + +* Micro does not use `icolor`. Instead, for a case insensitive match, use the case insensitive flag (`i`) in the regular expression + * For example, `icolor green ".*"` would become `color green "(?i).*"` + +# Using with colorschemes + +Not all of these files have been converted to use micro's colorscheme feature. Most of them just hardcode the colors, which can be problematic depending on the colorscheme you use. + +Here is a list of the files that have been converted to properly use colorschemes: + +* vi +* go +* c +* d +* markdown +* html +* lua +* swift +* rust +* java +* javascript +* pascal +* python +* ruby +* sh +* git +* tex +* solidity + +# License + +See [LICENSE](LICENSE). diff --git a/config/micro/syntax/ada.yaml b/config/micro/syntax/ada.yaml new file mode 100644 index 0000000..12436d4 --- /dev/null +++ b/config/micro/syntax/ada.yaml @@ -0,0 +1,43 @@ +filetype: ada + +detect: + filename: "(\\.ads$|\\.adb$|\\.ada$)" + +rules: + # Operators + - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&) + - symbol.brackets: "[(){}]|\\[|\\]" + # keyword.reserved + - statement.reserved: \b(abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case)\b + - statement.reserved: \b(constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function)\b + - statement.reserved: \b(generic|goto|if|in|interface|is|limited|loop|mod|new|not|null|of|or|others|out|overriding)\b + - statement.reserved: \b(package|pragma|private|procedure|protected|raise|range|record|rem|renames|return|requeue)\b + - statement.reserved: \b(reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until)\b + - statement.reserved: \b(use|when|while|with|xor)\b + + # Constant + - constant.bool: \b(TRUE|FALSE) + - constant.number: ([0-9]+) + + # Storage Types + - type.storage: \b(INTEGER|NATURAL|POSITIVE|FLOAT|CHARACTER|STRING)\b + - type.storage: \b(LONG_INTEGER|SHORT_INTEGER|LONG_FLOAT|SHORT_FLOAT)\b + + #Character + - constant.string.char: \'.\' + + # String + - constant.string: + start: \" + end: \" + skip: \\. + rules: + - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\') + - constant.interpolation: \\\([[:graph:]]*\) + - constant.unicode: \\u\{[[:xdigit:]]+} + + # Line Comment + - comment.line: "--.*" + + # Todo + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/apacheconf.yaml b/config/micro/syntax/apacheconf.yaml new file mode 100644 index 0000000..a6f8914 --- /dev/null +++ b/config/micro/syntax/apacheconf.yaml @@ -0,0 +1,59 @@ +filetype: apacheconf + +detect: + filename: "httpd\\.conf|mime\\.types|vhosts\\.d\\\\*|\\.htaccess" + +rules: + - identifier: "(AcceptMutex|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding)" + - identifier: "(AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch)" + - identifier: "(Allow|AllowCONNECT|AllowEncodedSlashes|AllowOverride|Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID)" + - identifier: "(Anonymous_VerifyEmail|AssignUserID|AuthAuthoritative|AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm)" + - identifier: "(AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)" + - identifier: "(AuthGroupFile|AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases)" + - identifier: "(AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl|AuthName|AuthType|AuthUserFile)" + - identifier: "(BrowserMatch|BrowserMatchNoCase|BS2000Account|BufferedLogs|CacheDefaultExpire|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheExpiryCheck)" + - identifier: "(CacheFile|CacheForceCompletion|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheIgnoreCacheControl|CacheIgnoreHeaders)" + - identifier: "(CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire|CacheMaxFileSize|CacheMinFileSize|CacheNegotiatedDocs|CacheRoot|CacheSize|CacheTimeMargin)" + - identifier: "(CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckSpelling|ChildPerUserID|ContentDigest|CookieDomain|CookieExpires|CookieLog|CookieName)" + - identifier: "(CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavLockDB|DavMinTimeout|DefaultIcon|DefaultLanguage|DefaultType)" + - identifier: "(DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize|Deny|Directory|DirectoryIndex|DirectoryMatch|DirectorySlash)" + - identifier: "(DocumentRoot|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|Example|ExpiresActive|ExpiresByType)" + - identifier: "(ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FileETag|Files|FilesMatch|ForceLanguagePriority|ForceType|ForensicLog|Group|Header)" + - identifier: "(HeaderName|HostnameLookups|IdentityCheck|IfDefine|IfModule|IfVersion|ImapBase|ImapDefault|ImapMenu|Include|IndexIgnore|IndexOptions|IndexOrderDefault)" + - identifier: "(ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout)" + - identifier: "(LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize)" + - identifier: "(LDAPTrustedCA|LDAPTrustedCAType|Limit|LimitExcept|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine)" + - identifier: "(LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|Location|LocationMatch|LockFile|LogFormat|LogLevel|MaxClients|MaxKeepAliveRequests)" + - identifier: "(MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MCacheMaxObjectCount|MCacheMaxObjectSize)" + - identifier: "(MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads)" + - identifier: "(MMapFile|ModMimeUsePathInfo|MultiviewsMatch|NameVirtualHost|NoProxy|NumServers|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|PassEnv|PidFile)" + - identifier: "(ProtocolEcho|Proxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyIOBufferSize|ProxyMatch|ProxyMaxForwards|ProxyPass|ProxyPassReverse)" + - identifier: "(ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia|ReadmeName|Redirect|RedirectMatch)" + - identifier: "(RedirectPermanent|RedirectTemp|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader)" + - identifier: "(Require|RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC)" + - identifier: "(Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen)" + - identifier: "(SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetEnv|SetEnvIf|SetEnvIfNoCase|SetHandler)" + - identifier: "(SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath)" + - identifier: "(SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions)" + - identifier: "(SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite)" + - identifier: "(SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire)" + - identifier: "(SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|SuexecUserGroup|ThreadLimit)" + - identifier: "(ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnsetEnv|UseCanonicalName|User|UserDir|VirtualDocumentRoot)" + - identifier: "(VirtualDocumentRootIP|VirtualHost|VirtualScriptAlias|VirtualScriptAliasIP|Win32DisableAcceptEx|XBitHack)" + - symbol.tag: "<[^>]+>" + - identifier: ")" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/arduino.yaml b/config/micro/syntax/arduino.yaml new file mode 100644 index 0000000..35a0480 --- /dev/null +++ b/config/micro/syntax/arduino.yaml @@ -0,0 +1,101 @@ +filetype: ino + +detect: + filename: "\\.ino$" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" + + ## Sized (u)int types + - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b" + + ## Constants + - constant: "(?i)\\b(HIGH|LOW|INPUT|OUTPUT)\\b" + + ## Serial Print + - constant: "(?i)\\b(DEC|BIN|HEX|OCT|BYTE)\\b" + + ## PI Constants + - constant: "(?i)\\b(PI|HALF_PI|TWO_PI)\\b" + + ## ShiftOut + - constant: "(?i)\\b(LSBFIRST|MSBFIRST)\\b" + + ## Attach Interrupt + - constant: "(?i)\\b(CHANGE|FALLING|RISING)\\b" + + ## Analog Reference + - constant: "(?i)\\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\\b" + + ## === FUNCTIONS === ## + + ## Data Types + - type: "\\b(boolean|byte|char|float|int|long|word)\\b" + + ## Control Structions + - statement: "\\b(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\\b" + - statement: "\\b(goto|continue|break|return)\\b" + + ## Math + - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan)\\b" + + ## Bits & Bytes + - identifier: "\\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\\b" + + ## Analog I/O + - identifier: "\\b(analogReference|analogRead|analogWrite)\\b" + + ## External Interrupts + - identifier: "\\b(attachInterrupt|detachInterrupt)\\b" + + ## Time + - identifier: "\\b(delay|delayMicroseconds|millis|micros)\\b" + + ## Digital I/O + - identifier: "\\b(pinMode|digitalWrite|digitalRead)\\b" + + ## Interrupts + - identifier: "\\b(interrupts|noInterrupts)\\b" + + ## Advanced I/O + - identifier: "\\b(noTone|pulseIn|shiftIn|shiftOut|tone)\\b" + + ## Serial + - identifier: "\\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\\b" + + ## Structure + - identifier: "\\b(setup|loop)\\b" + + ## + - statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)" + + ## GCC builtins + - constant: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - preproc: "..+" + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/asciidoc.yaml b/config/micro/syntax/asciidoc.yaml new file mode 100644 index 0000000..ab4cd88 --- /dev/null +++ b/config/micro/syntax/asciidoc.yaml @@ -0,0 +1,51 @@ +filetype: asciidoc + +detect: + filename: "\\.(asc|asciidoc|adoc)$" + +rules: + # main header + - preproc: "^====+$" + # h1 + - statement: "^==[[:space:]].*$" + - statement: "^----+$" + # h2 + - symbol: "^===[[:space:]].*$" + - symbol: "^~~~~+$" + # h4 + - type: "^====[[:space:]].*$" + - type: "^\\^\\^\\^\\^+$" + # h5 + - constant: "^=====[[:space:]].*$" + - constant: "^\\+\\+\\+\\++$" + + # attributes + - type.keyword: ":.*:" + - identifier.macro: "\\{[a-z0-9]*\\}" + - identifier: "\\\\\\{[a-z0-9]*\\}" + - identifier: "\\+\\+\\+\\{[a-z0-9]*\\}\\+\\+\\+" + + # Paragraph Title + - statement: "^\\..*$" + + # source + - identifier: "^\\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\]" + + # Other markup + - constant.string: ".*[[:space:]]\\+$" + - constant.string: "_[^_]+_" + - constant.string: "\\*[^\\*]+\\*" + - constant.string: "\\+[^\\+]+\\+" + - constant.string: "`[^`]+`" + - constant.string: "\\^[^\\^]+\\^" + - constant.string: "~[^~]+~" + - constant.string: "'[^']+'" + + - constant: "`{1,2}[^']+'{1,2}" + + # bullets + - symbol: "^[[:space:]]*[\\*\\.-]{1,5}[[:space:]]" + + # anchors + - "bold default": "\\[\\[.*\\]\\]" + - "bold default": "<<.*>>" diff --git a/config/micro/syntax/asm.yaml b/config/micro/syntax/asm.yaml new file mode 100644 index 0000000..2c46325 --- /dev/null +++ b/config/micro/syntax/asm.yaml @@ -0,0 +1,123 @@ +filetype: asm + +detect: + filename: "\\.(S|s|asm)$" + +rules: + # This file is made mainly for NASM assembly + + ## Instructions + # x86 + - statement: "\\b(?i)(mov|aaa|aad|aam|aas|adc|add|and|call|cbw|clc|cld|cli|cmc|cmp|cmpsb|cmpsw|cwd|daa|das|dec|div|esc|hlt|idiv|imul|in|inc|int|into|iret|ja|jae|jb|jbe|jc|je|jg|jge|jl|jle|jna|jnae|jnb|jnbe|jnc|jne|jng|jnge|jnl|jnle|jno|jnp|jns|jnz|jo|jp|jpe|jpo|js|jz|jcxz|jmp|lahf|lds|lea|les|lock|lodsb|lodsw|loop|loope|loopne|loopnz|loopz|movsb|movsw|mul|neg|nop|or|pop|popf|push|pushf|rcl|rcr|rep|repe|repne|repnz|repz|ret|retn|retf|rol|ror|sahf|sal|sar|sbb|scasb|scasw|shl|shr|stc|std|sti|stosb|stosw|sub|test|wait|xchg|xlat|xor)(?-i)\\b" + - statement: "\\b(?i)(bound|enter|ins|leave|outs|popa|pusha)(?-i)\\b" + - statement: "\\b(?i)(arpl|clts|lar|lgdt|lidt|lldt|lmsw|loadall|lsl|ltr|sgdt|sidt|sldt|smsw|str|verr|verw)(?-i)\\b" + - statement: "\\b(?i)(bsf|bsr|bt|btc|btr|bts|cdq|cmpsd|cwde|insd|iret|iretd|iretf|jecxz|lfs|lgs|lss|lodsd|loopw|loopew|loopnew|loopnzw|loopzw|loopd|looped|loopned|loopnzd|loopzd|cr|tr|dr|movsd|movsx|movzx|outsd|popad|popfd|pushad|pushfd|scasd|seta|setae|setb|setbe|setc|sete|setg|setge|setl|setle|setna|setnae|setnb|setnbe|setnc|setne|setng|setnge|setnl|setnle|setno|setnp|setns|setnz|seto|setp|setpe|setpo|sets|setz|shdl|shrd|stosd)(?-i)\\b" + - statement: "\\b(?i)(bswap|cmpxcgh|invd|invlpg|wbinvd|xadd)(?-i)\\b" + - statement: "\\b(?i)(cpuid|cmpxchg8b|rdmsr|rdtsc|wrmsr|rsm)(?-i)\\b" + - statement: "\\b(?i)(rdpmc)(?-i)\\b" + - statement: "\\b(?i)(syscall|sysret)(?-i)\\b" + - statement: "\\b(?i)(cmova|cmovae|cmovb|cmovbe|cmovc|cmove|cmovg|cmovge|cmovl|cmovle|cmovna|cmovnae|cmovnb|cmovnbe|cmovnc|cmovne|cmovng|cmovnge|cmovnle|cmovno|cmovpn|cmovns|cmovnz|cmovo|cmovp|cmovpe|cmovpo|cmovs|cmovz|sysenter|sysexit|ud2)(?-i)\\b" + - statement: "\\b(?i)(maskmovq|movntps|movntq|prefetch0|prefetch1|prefetch2|prefetchnta|sfence)(?-i)\\b" + - statement: "\\b(?i)(clflush|lfence|maskmovdqu|mfence|movntdq|movnti|movntpd|pause)(?-i)\\b" + - statement: "\\b(?i)(monitor|mwait)(?-i)\\b" + - statement: "\\b(?i)(cdqe|cqo|cmpsq|cmpxchg16b|iretq|jrcxz|lodsq|movsdx|popfq|pushfq|rdtscp|scasq|stosq|swapgs)(?-i)\\b" + - statement: "\\b(?i)(clgi|invlpga|skinit|stgi|vmload|vmmcall|vmrun|vmsave)(?-i)\\b" + - statement: "\\b(?i)(vmptrdl|vmptrst|vmclear|vmread|vmwrite|vmcall|vmlaunch|vmresume|vmxoff|vmxon)(?-i)\\b" + - statement: "\\b(?i)(lzcnt|popcnt)(?-i)\\b" + - statement: "\\b(?i)(bextr|blcfill|blci|blcic|blcmask|blcs|blsfill|blsic|t1mskc|tzmsk)(?-i)\\b" + + # x87 + - statement: "\\b(?i)(f2xm1|fabs|fadd|faddp|fbld|fbstp|fchs|fclex|fcom|fcomp|fcompp|fdecstp|fdisi|fdiv|fvidp|fdivr|fdivrp|feni|ffree|fiadd|ficom|ficomp|fidiv|fidivr|fild|fimul|fincstp|finit|fist|fistp|fisub|fisubr|fld|fld1|fldcw|fldenv|fldenvw|fldl2e|fldl2t|fldlg2|fldln2|fldpi|fldz|fmul|fmulp|fnclex|fndisi|fneni|fninit|fnop|fnsave|fnsavenew|fnstcw|fnstenv|fnstenvw|fnstsw|fpatan|fprem|fptan|frndint|frstor|frstorw|fsave|fsavew|fscale|fsqrt|fst|fstcw|fstenv|fstenvw|fstp|fstpsw|fsub|fsubp|fsubr|fsubrp|ftst|fwait|fxam|fxch|fxtract|fyl2x|fyl2xp1)(?-i)\\b" + - statement: "\\b(?i)(fsetpm)(?-i)\\b" + - statement: "\\b(?i)(fcos|fldenvd|fsaved|fstenvd|fprem1|frstord|fsin|fsincos|fstenvd|fucom|fucomp|fucompp)(?-i)\\b" + - statement: "\\b(?i)(fcmovb|fcmovbe|fcmove|fcmove|fcmovnb|fcmovnbe|fcmovne|fcmovnu|fcmovu)(?-i)\\b" + - statement: "\\b(?i)(fcomi|fcomip|fucomi|fucomip)(?-i)\\b" + - statement: "\\b(?i)(fxrstor|fxsave)(?-i)\\b" + - statement: "\\b(?i)(fisttp)(?-i)\\b" + - statement: "\\b(?i)(ffreep)(?-i)\\b" + + # SIMD + - statement: "\\b(?i)(emms|movd|movq|packssdw|packsswb|packuswb|paddb|paddw|paddd|paddsb|paddsw|paddusb|paddusw|pand|pandn|por|pxor|pcmpeqb|pcmpeqw|pcmpeqd|pcmpgtb|pcmpgtw|pcmpgtd|pmaddwd|pmulhw|pmullw|psllw|pslld|psllq|psrad|psraw|psrlw|psrld|psrlq|psubb|psubw|psubd|psubsb|psubsw|psubusb|punpckhbw|punpckhwd|punpckhdq|punkcklbw|punpckldq|punpcklwd)(?-i)\\b" + - statement: "\\b(?i)(paveb|paddsiw|pmagw|pdistib|psubsiw|pmwzb|pmulhrw|pmvnzb|pmvlzb|pmvgezb|pmulhriw|pmachriw)(?-i)\\b" + - statement: "\\b(?i)(femms|pavgusb|pf2id|pfacc|pfadd|pfcmpeq|pfcmpge|pfcmpgt|pfmax|pfmin|pfmul|pfrcp|pfrcpit1|pfrcpit2|pfrsqit1|pfrsqrt|pfsub|pfsubr|pi2fd|pmulhrw|prefetch|prefetchw)(?-i)\\b" + - statement: "\\b(?i)(pf2iw|pfnacc|pfpnacc|pi2fw|pswapd)(?-i)\\b" + - statement: "\\b(?i)(pfrsqrtv|pfrcpv)(?-i)\\b" + - statement: "\\b(?i)(addps|addss|cmpps|cmpss|comiss|cvtpi2ps|cvtps2pi|cvtsi2ss|cvtss2si|cvttps2pi|cvttss2si|divps|divss|ldmxcsr|maxps|maxss|minps|minss|movaps|movhlps|movhps|movlhps|movlps|movmskps|movntps|movss|movups|mulps|mulss|rcpps|rcpss|rsqrtps|rsqrtss|shufps|sqrtps|sqrtss|stmxcsr|subps|subss|ucomiss|unpckhps|unpcklps)(?-i)\\b" + - statement: "\\b(?i)(andnps|andps|orps|pavgb|pavgw|pextrw|pinsrw|pmaxsw|pmaxub|pminsw|pminub|pmovmskb|pmulhuw|psadbw|pshufw|xorps)(?-i)\\b" + - statement: "\\b(?i)(movups|movss|movlps|movhlps|movlps|unpcklps|unpckhps|movhps|movlhps|prefetchnta|prefetch0|prefetch1|prefetch2|nop|movaps|cvtpi2ps|cvtsi2ss|cvtps2pi|cvttss2si|cvtps2pi|cvtss2si|ucomiss|comiss|sqrtps|sqrtss|rsqrtps|rsqrtss|rcpps|andps|orps|xorps|addps|addss|mulps|mulss|subps|subss|minps|minss|divps|divss|maxps|maxss|pshufw|ldmxcsr|stmxcsr|sfence|cmpps|cmpss|pinsrw|pextrw|shufps|pmovmskb|pminub|pmaxub|pavgb|pavgw|pmulhuw|movntq|pminsw|pmaxsw|psadbw|maskmovq)(?-i)\\b" + - statement: "\\b(?i)(addpd|addsd|addnpd|cmppd|cmpsd)(?-i)\\b" + - statement: "\\b(?i)(addpd|addsd|andnpd|andpd|cmppd|cmpsd|comisd|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtps2dq|cvtps2pd|cvtsd2si|cvtsd2ss|cvtsi2sd|cvtss2sd|cvttpd2dq|cvttpd2pi|cvttps2dq|cvttsd2si|divpd|divsd|maxpd|maxsd|minpd|minsd|movapd|movhpd|movlpd|movmskpd|movsd|movupd|mulpd|mulsd|orpd|shufpd|sqrtpd|sqrtsd|subpd|subsd|ucomisd|unpckhpd|unpcklpd|xorpd)(?-i)\\b" + - statement: "\\b(?i)(movdq2q|movdqa|movdqu|movq2dq|paddq|psubq|pmuludq|pshufhw|pshuflw|pshufd|pslldq|psrldq|punpckhqdq|punpcklqdq)(?-i)\\b" + - statement: "\\b(?i)(addsubpd|addsubps|haddpd|haddps|hsubpd|hsubps|movddup|movshdup|movsldu)(?-i)\\b" + - statement: "\\b(?i)(lddqu)(?-i)\\b" + - statement: "\\b(?i)(psignw|psignd|psignb|pshufb|pmulhrsw|pmaddubsw|phsubw|phsubsw|phsubd|phaddw|phaddsw|phaddd|palignr|pabsw|pabsd|pabsb)(?-i)\\b" + - statement: "\\b(?i)(dpps|dppd|blendps|blendpd|blendvps|blendvpd|roundps|roundss|roundpd|roundsd|insertps|extractps)(?-i)\\b" + - statement: "\\b(?i)(mpsadbw|phminposuw|pmulld|pmuldq|pblendvb|pblendw|pminsb|pmaxsb|pminuw|pmaxuw|pminud|pmaxud|pminsd|pmaxsd|pinsrb|pinsrd/pinsrq|pextrb|pextrw|pextrd/pextrq|pmovsxbw|pmovzxbw|pmovsxbd|pmovzxbd|pmovsxbq|pmovzxbq|pmovsxwd|pmovzxwd|pmovsxwq|pmovzxwq|pmovsxdq|pmovzxdq|ptest|pcmpeqq|packusdw|movntdqa)(?-i)\\b" + - statement: "\\b(?i)(extrq|insertq|movntsd|movntss)(?-i)\\b" + - statement: "\\b(?i)(crc32|pcmpestri|pcmpestrm|pcmpistri|pcmpistrm|pcmpgtq)(?-i)\\b" + - statement: "\\b(?i)(vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfmsubss|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubps|vfnmsubsd|vfnmsubss)(?-i)\\b" + + # Crypto + - statement: "\\b(?i)(aesenc|aesenclast|aesdec|aesdeclast|aeskeygenassist|aesimc)(?-i)\\b" + - statement: "\\b(?i)(sha1rnds4|sha1nexte|sha1msg1|sha1msg2|sha256rnds2|sha256msg1|sha256msg2)(?-i)\\b" + + # Undocumented + - statement: "\\b(?i)(aam|aad|salc|icebp|loadall|loadalld|ud1)(?-i)\\b" + + ## Registers + - identifier: "\\b(?i)(al|ah|bl|bh|cl|ch|dl|dh|bpl|sil|r8b|r9b|r10b|r11b|dil|spl|r12b|r13b|r14b|r15)(?-i)\\b" + - identifier: "\\b(?i)(cw|sw|tw|fp_ds|fp_opc|fp_ip|fp_dp|fp_cs|cs|ss|ds|es|fs|gs|gdtr|idtr|tr|ldtr|ax|bx|cx|dx|bp|si|r8w|r9w|r10w|r11w|di|sp|r12w|r13w|r14w|r15w|ip)(?-i)\\b" + - identifier: "\\b(?i)(fp_dp|fp_ip|eax|ebx|ecx|edx|ebp|esi|r8d|r9d|r10d|r11d|edi|esp|r12d|r13d|r14d|r15d|eip|eflags|mxcsr)(?-i)\\b" + - identifier: "\\b(?i)(mm0|mm1|mm2|mm3|mm4|mm5|mm6|mm7|rax|rbx|rcx|rdx|rbp|rsi|r8|r9|r10|r11|rdi|rsp|r12|r13|r14|r15|rip|rflags|cr0|cr1|cr2|cr3|cr4|cr5|cr6|cr7|cr8|cr9|cr10|cr11|cr12|cr13|cr14|cr15|msw|dr0|dr1|dr2|dr3|r4|dr5|dr6|dr7|dr8|dr9|dr10|dr11|dr12|dr13|dr14|dr15)(?-i)\\b" + - identifier: "\\b(?i)(st0|st1|st2|st3|st4|st5|st6|st7)(?-i)\\b" + - identifier: "\\b(?i)(xmm0|xmm1|xmm2|xmm3|xmm4|xmm5|xmm6|xmm7|xmm8|xmm9|xmm10|xmm11|xmm12|xmm13|xmm14|xmm15)(?-i)\\b" + - identifier: "\\b(?i)(ymm0|ymm1|ymm2|ymm3|ymm4|ymm5|ymm6|ymm7|ymm8|ymm9|ymm10|ymm11|ymm12|ymm13|ymm14|ymm15)(?-i)\\b" + - identifier: "\\b(?i)(zmm0|zmm1|zmm2|zmm3|zmm4|zmm5|zmm6|zmm7|zmm8|zmm9|zmm10|zmm11|zmm12|zmm13|zmm14|zmm15|zmm16|zmm17|zmm18|zmm19|zmm20|zmm21|zmm22|zmm23|zmm24|zmm25|zmm26|zmm27|zmm28|zmm29|zmm30|zmm31)(?-i)\\b" + + ## Constants + # Number - it works + - constant.number: "\\b(|h|A|0x)+[0-9]+(|h|A)+\\b" + - constant.number: "\\b0x[0-9 a-f A-F]+\\b" + + ## Preprocessor (NASM) + - preproc: "%+(\\+|\\?|\\?\\?|)[a-z A-Z 0-9]+" + - preproc: "%\\[[. a-z A-Z 0-9]*\\]" + + ## Other + - statement: "\\b(?i)(extern|global|section|segment|_start|\\.text|\\.data|\\.bss)(?-i)\\b" + - statement: "\\b(?i)(db|dw|dd|dq|dt|ddq|do)(?-i)\\b" + - identifier: "[a-z A-Z 0-9 _]+:" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: ";" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + ## C-like comments (supported by some assemblers) + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/ats.yaml b/config/micro/syntax/ats.yaml new file mode 100644 index 0000000..e24d0e5 --- /dev/null +++ b/config/micro/syntax/ats.yaml @@ -0,0 +1,99 @@ +filetype: ATS + +detect: + filename: "\\.(d|h|s)ats$" + +rules: + - default: \b[[:alnum:]]+[^0-9A-Za-z] + + # Operators + - symbol.operator: "[.:;+`|~<>?='\\&]|/|%|-|,|!|\\*|@|\\#" + - symbol.operator: \^ + + # Types, abstract types and some predefined sorts + - type: \b(addr|age?z|bool|char|cls|schar|uchar|double|ldouble|eff|exn|float|int(ptr)?|lincloptr|uint)\b + - type: \b(lint|ulint|llint|ullint|nat|ptr|real|ref|size_t|ssize_t|sint|usint|string|tkind|viewt|v?t0p|vt|void)\b + - type: \b(prop|t[@0]ype|type|viewt[@0]ype|viewtype|vt[@0]ype|vtype|view)\b + - type: \b(prop[+-]|t[@0]ype[+-]|type[+-]|viewt[@0]ype[+-]|viewtype[+-]|vt[@0]ype[+-]|vtype[+-]|view[+-]) + + # Statements + - statement: \b(abstype|abst|absprop|absviewt|absvt(ype)?|absview|and|andalso|as|(re)?assume|begin|(pr)?case|s?case)\b + - statement: \b(classdec|dataprop|data(v|view)?type|dataview|datasort|do|dynload|else|end|exception|extype|extva(r|l)|s?if)\b + - statement: \b(ifcase|import|for|in|infix(l|r)?|let|local|macrodef|macdef|not|of|op|or|orelse|overload|(pre|post|non)fix)\b + - statement: \b(propdef|rec|sortdef|stacst|stadef|staload|stavar|sta(tic)?|symelim|symintr|tkindef|then|try|viewdef|v?typedef)\b + - statement: \b(viewtypedef|(pr)?va(l|r)|when|where|while|with|withtype|withprop|withv(iew)?type|withview)\b + - statement: \b(abst[@0]ype|absviewt[@0]?ype|absvt[@0]ype|abstbox|abstflat|absvtbox|absvtflat|absimpl|absreimpl|abs)\b + - statement: \b(case[+-]|(pr)?va(l|r)[+-]|for\*|while\*) + + # Numbers + - constant.number: \b[0-9.]+([eE][+-]?[0-9]+)?[fFlL]?\b + - constant.number: \b0[xX][0-9A-Fa-f]*(\.[0-9A-Fa-f]*)?[pP][+-]?[0-9]+[fFlL]?\b + - constant.number: \b([0-9]+|0[xX][0-9A-Fa-f]+)[lLuU]*\b + + # Function-related keywords, special functions and namespaces. Not really identifiers + - identifier: \b(fix|(pr)?fu?n|fnx|castfn|praxi|extern|lam|llam|(pr)?implement|(pr)?implmnt)\b + - identifier: \b(fix@|fold@|free@|lam@|llam@|addr@|view@|ref@|fn\*) + - identifier: \$\w*\b + + # Other keywords, function effects... + - special: (\$(arrpsz|arrptrsize|break|continue|d2ctype|delay|effmask_(ntm|exn|ref|wrt|all)))\b + - special: (\$(effmask|extern|extype_struct|extype|extkind|extval|extfcall|extmcall|ldelay|literal))\b + - special: (\$(li?st_vt|li?st_t|li?st|myfilename|myfunction|mylocation|raise|rec(ord)?_vt))\b + - special: (\$(rec(ord)?_t|rec(ord)?|showtype|solver_assert|solver_verify|tempenver))\b + - special: (\$(tup(le)?_vt|tup(le)?_t|tup(le)?|tyrep|vararg|vcopyenv_vt|vcopyenv_v))\b + - special: \!(wrt|exnref|exnwrt|exn|refwrt|ref|all|ntm|laz)\b + - special: \b(fun(0|1)|(lin)?cloptr(0|1)?|cloref(0|1)?|clo(0|1)?|lin|prf)\b + - special: \b(f?print(ln)?!|prerr(ln)?!|tupz!) + + # Some C macros and other ATS macros + - preproc: ^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error|assert)\b + - preproc: ^[[:space:]]*#[[:space:]]*(codegen2|codegen3|elifdef|elifndef|prerr|print|require|then|staload|dynload)\b + + # Boolean values + - constant.bool: \b(true|false|null)\b + + + # The "%{ ... %}" block inserts foreign code into ATS at compile-time + # Code inside of it is generally C or JavaScript + - default: + start: "%{[#^$]?" + end: "%}" + skip: "\\." + limit-group: symbol.operator + rules: + - include: "c" + - include: "javascript" + + + # Strings and chars + - constant.string: \"[^"]*\" + - constant.string: \'[^']*\' + + + # Comments + # "////" comments everything until it reaches EOF + - comment.block: + start: //// + end: $a + rules: + - todo: (TODO|XXX|FIXME) + + - comment.line: + start: // + end: $ + rules: + - todo: (TODO|XXX|FIXME) + + # ML-like block comment + - comment.block: + start: \(\* + end: \*\) + rules: + - todo: (TODO|XXX|FIXME) + + # C-like block comment + - comment.block: + start: /\* + end: \*\/ + rules: + - todo: (TODO|XXX|FIXME) diff --git a/config/micro/syntax/awk.yaml b/config/micro/syntax/awk.yaml new file mode 100644 index 0000000..ff3f698 --- /dev/null +++ b/config/micro/syntax/awk.yaml @@ -0,0 +1,44 @@ +filetype: awk + +detect: + filename: "\\.awk$" + header: "^#!.*bin/(env +)?awk( |$)" + +rules: + - preproc: "\\$[A-Za-z0-9_!@#$*?\\-]+" + - preproc: "\\b(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\\b" + - preproc: "\\b(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\\b" + - preproc: "\\b(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\\b" + - identifier.class: "\\b(function|extension|BEGIN|END)\\b" + - symbol.operator: "[\\-+*/%^|!=&<>?;:]|\\\\|\\[|\\]" + - statement: "\\b(for|if|while|do|else|in|delete|exit)\\b" + - special: "\\b(break|continue|return)\\b" + - statement: "\\b(close|getline|next|nextfile|print|printf|system|fflush)\\b" + - statement: "\\b(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\\b" + - statement: "\\b(asort|asorti|gensub|gsub|index|length|match)\\b" + - statement: "\\b(split|sprintf|strtonum|sub|substr|tolower|toupper)\\b" + - statement: "\\b(mktime|strftime|systime)\\b" + - statement: "\\b(and|compl|lshift|or|rshift|xor)\\b" + - statement: "\\b(bindtextdomain|dcgettext|dcngettext)\\b" + - special: "/.*[^\\\\]/" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/b.yaml b/config/micro/syntax/b.yaml new file mode 100644 index 0000000..f6bd219 --- /dev/null +++ b/config/micro/syntax/b.yaml @@ -0,0 +1,87 @@ +filetype: B + +detect: + filename: '\.b$' + # core control words + storage classes (Thompson B-ish) + signature: '\b(if|else|while|switch|case|default|break|return|goto|extrn|auto)\b' + +rules: + # ------------------------- + # Comments (B: /* ... */) + # ------------------------- + - comment: + start: '/\*' + end: '\*/' + rules: [] + + # Optional: // line comments (convenient, not “original” B) + - comment: + start: '//' + end: '$' + rules: [] + + # ------------------------- + # Strings + escapes + # ------------------------- + - constant.string: + start: '"' + end: '"' + skip: '\\\\.' + rules: + # common escapes: \n \t \e \r \0 \" \\ \( \) \* + - constant.specialChar: '\\\\([0netr"\\\\\\*\\(\\)])' + # printf-ish: %s %c %d %o and %% + - constant.specialChar: '%(%|[scdo])' + + - constant.string: + start: "'" + end: "'" + skip: '\\\\.' + rules: + - constant.specialChar: '\\\\([0netr"\\\\\\*\\(\\)])' + - constant.specialChar: '%(%|[scdo])' + + # ------------------------- + # Numbers + # (leading 0 commonly used for octal constants) + # ------------------------- + - constant.number: '\b0[0-7]+\b' + - constant.number: '\b[0-9]+\b' + + # ------------------------- + # Keywords / storage (keep tight + old-school) + # ------------------------- + - statement: '\b(if|else|while|switch|case|default|break|return|goto)\b' + - type: '\b(extrn|auto)\b' + + # ------------------------- + # Common B library calls (/etc/libb.a era list) + # ------------------------- + - constant.builtin: '\b(char|getchr|putchr|exit|printf|seek|setuid|stat|time|unlink|wait|lchar|chdir|chmod|chown|close|creat|execl|execv|fork|fstat|getuid|intr|link|makdir|open|read|write|ctime)\b' + + # ------------------------- + # Labels and function-ish identifiers + # ------------------------- + # label (often at bol) + - identifier: '^\s*[_A-Za-z][_A-Za-z0-9]*\s*:' + # function call/def name before '(' + - identifier: '\b[_A-Za-z][_A-Za-z0-9]*\s*\(' + + # ------------------------- + # Operators (order matters: longer first) + # Thompson-ish assignment operators in B are =+, =-, =*, =/, =%, =<<, =>>, =& , =| + # ------------------------- + - symbol.operator: '(=<<|=>>|=\+|=-|=\*|=/|=%|=&|=\|)' + - symbol.operator: '(==|!=|<=|>=|<<|>>)' + - symbol.operator: '(\+\+|--|\*\*)' + - symbol.operator: '[-+*/%&|^~!=<>?:=]' + + # ------------------------- + # Brackets + # ------------------------- + - symbol.brackets: '[(){}\[\]]' + + # ------------------------- + # Identifiers / variables (last so keywords win) + # ------------------------- + - identifier: '\b[_A-Za-z][_A-Za-z0-9]*\b' diff --git a/config/micro/syntax/bat.yaml b/config/micro/syntax/bat.yaml new file mode 100644 index 0000000..a719a6d --- /dev/null +++ b/config/micro/syntax/bat.yaml @@ -0,0 +1,57 @@ +filetype: batch + +detect: + filename: "(\\.bat$|\\.cmd$)" + +rules: + # Numbers + - constant.number: "\\b[0-9]+\\b" + # Brackets and symbols + - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)" + # Conditionals and control flow + # note (?i) means case insensitive match + - type: "\\b(?i)(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|then|until|while)\\b" + - type: "\\b(?i)(equ|neq|lss|leq|gtr|geq|on|off)\\b" + - type: "\\b(?i)(goto|for|in|do|call|exit|not|exist|errorlevel|defined)\\b" + - type: "\\b(?i)(prn|nul|lpt3|lpt2|lpt1|con|com4|com3|com2|com1|aux)\\b" + # keywords + - statement: "\\b(?i)(adprep|append|arp|assoc|at|atmadm|attrib|auditpol|autochk|autoconv|autofmt|bcdboot|bcdedit|bdehdcfg|bitsadmin|bootcfg|break|brea)\\b" + - statement: "\\b(?i)(cacls|cd|certreq|certutil|chcp|change|choice|cipher|chdir|chkdsk|chkntfs|chglogon|chgport|chgusr|clip|cls|clscluadmin|cluster|cmd|cmdkey|cmstp|color)\\b" + - statement: "\\b(?i)(comp|compact|convert|copy|cprofile|cscript|csvde|date|dcdiag|dcgpofix|dcpromo|defra|del|dfscmd|dfsdiag|dfsrmig|diantz|dir|dirquota|diskcomp|diskcopy|diskpart|diskperf|diskraid|diskshadow|dispdiag|doin|dnscmd|doskey|driverquery|dsacls|dsadd|dsamain|dsdbutil|dsget|dsmgmt|dsmod|dsmove|dsquery|dsrm)\\b" + - statement: "\\b(?i)(echo|edit|endlocal|erase|esentutl|eventcreate|eventquery|eventtriggers|evntcmd|expand|extract)\\b" + - statement: "\\b(?i)(fc|filescrn|find|findstr|finger|flattemp|fonde|forfiles|format|freedisk|fs|fsutil|ftp|ftype|fveupdate|getmac|gettype|gpfixup|gpresult|gpupdate|graftabl)\\b" + - statement: "\\b(?i)(hashgen|hep|help|helpctr|hostname|icacls|iisreset|inuse|ipconfig|ipxroute|irftp|ismserv|jetpack|keyb|klist|ksetup|ktmutil|ktpass|label|ldifd|ldp|lodctr|logman|logoff|lpq|lpr|macfile)\\b" + - statement: "\\b(?i)(makecab|manage-bde|mapadmin|md|mkdir|mklink|mmc|mode|more|mount|mountvol|move|mqbup|mqsvc|mqtgsvc|msdt|msg|msiexec|msinfo32|mstsc|nbtstat|net computer|net group)\\b" + - statement: "\\b(?i)(net localgroup|net print|net session|net share|net start|net stop|net use|net user|net view|net|netcfg|netdiag|netdom|netsh|netstat|nfsadmin|nfsshare|nfsstat|nlb)\\b" + - statement: "\\b(?i)(nlbmgr|nltest|nslookup|ntackup|ntcmdprompt|ntdsutil|ntfrsutl|openfiles|pagefileconfig|path|pathping|pause|pbadmin|pentnt|perfmon|ping|pnpunatten|pnputil|popd)\\b" + - statement: "\\b(?i)(powercfg|powershell|powershell_ise|print|prncnfg|prndrvr|prnjobs|prnmngr|prnport|prnqctl|prompt|pubprn|pushd|pushprinterconnections|pwlauncher|qappsrv|qprocess)\\b" + - statement: "\\b(?i)(query|quser|qwinsta|rasdial|rcp|rd|rdpsign|regentc|recover|redircmp|redirusr|reg|regini|regsvr32|relog|ren|rename|rendom|repadmin|repair-bde|replace|reset|restore)\\b" + - statement: "\\b(?i)(rxec|risetup|rmdir|robocopy|route|rpcinfo|rpcping|rsh|runas|rundll32|rwinsta|scp|sc|setlocal|session|schtasks|scwcmd|secedit|serverceipoptin|servrmanagercmd|serverweroptin|set|setspn)\\b" + - statement: "\\b(?i)(setx|sfc|shadow|shift|showmount|shutdown|sort|ssh|start|storrept|subst|sxstrace|ysocmgr|systeminfo|takeown|tapicfg|taskkill|tasklist|tcmsetup|telnet|tftp|time)\\b" + - statement: "\\b(?i)(timeout|title|tlntadmn|tpmvscmgr|tpmvscmgr|tacerpt|tracert|tree|tscon|tsdiscon|tsecimp|tskill|tsprof|type|typeperf|tzutil|uddiconfig|umount|unlodctr|ver|verify)\\b" + - statement: "\\b(?i)(verifier|verif|vol|vssadmin|w32tm|waitfor|wbadmin|wdsutil|wecutil|wevtutil|where|whoami|winnt|winnt32|winpop|winrm|winrs|winsat|wlbs|mic|wscript|xcopy)\\b" + # / Flags + - constant: "(/\\w+)" + # Variables + - special: "(%%\\w+)" + - special: "(%\\w+%)" + # Conditional flags + - type: "--[a-z-]+" + - type: "\\ -[a-z]+" + + - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" + - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" + # "" String + - constant.string: + start: \" + end: \" + skip: \. + rules: + - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\') + - constant.unicode: \\u\{[[:xdigit:]]+} + # '' string + - constant.string: "(\\'.+\\')" + # rem as comment + - comment.rem: "(?i)(rem\\s.*)" + # :: as comment + - comment.rem: "(?i)(\\:\\:\\s.*)" diff --git a/config/micro/syntax/c.yaml b/config/micro/syntax/c.yaml new file mode 100644 index 0000000..c6a4674 --- /dev/null +++ b/config/micro/syntax/c.yaml @@ -0,0 +1,60 @@ +filetype: c + +detect: + filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" + - type: "\\b(_Atomic|_BitInt|float|double|_Decimal32|_Decimal64|_Decimal128|_Complex|complex|_Imaginary|imaginary|_Bool|bool|char|int|short|long|enum|void|struct|union|typedef|typeof|typeof_unqual|(un)?signed|inline|_Noreturn)\\b" + - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr))|char(8|16|32)|wchar)_t\\b" + # GCC float/decimal/fixed types + - type: "\\b(_Float16|__fp16|_Float32|_Float32x|_Float64|_Float64x|__float80|_Float128|_Float128x|__float128|__ibm128|__int128|_Fract|_Sat|_Accum)\\b" + - type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b" + - statement: "\\b(auto|volatile|register|restrict|_Alignas|alignas|_Alignof|alignof|static|const|constexpr|extern|_Thread_local|thread_local)\\b" + - statement: "\\b(for|if|while|do|else|case|default|switch|_Generic|_Static_assert|static_assert)\\b" + - statement: "\\b(goto|continue|break|return)\\b" + - statement: "\\b(asm|fortran)\\b" + - preproc: "^[[:space:]]*#[[:space:]]*(define|embed|pragma|include|(un|ifn?)def|endif|el(if|ifdef|ifndef|se)|if|line|warning|error|__has_include|__has_embed|__has_c_attribute)" + - preproc: "^[[:space:]]*_Pragma\\b" + # GCC builtins + - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)" + - statement: "__(aligned|asm|builtin|extension|hidden|inline|packed|restrict|section|typeof|weak)__" + # Operator Color + - symbol.operator: "[-+*/%=<>.:;,~&|^!?]|\\b(offsetof|sizeof)\\b" + - symbol.brackets: "[(){}]|\\[|\\]" + # Integer Constants + - constant.number: "(\\b([1-9][0-9]*|0[0-7]*|0[Xx][0-9A-Fa-f]+|0[Bb][01]+)([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + # Decimal Floating Constants + - constant.number: "(\\b(([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)[FfLl]?\\b)" + # Hexadecimal Floating Constants + - constant.number: "(\\b0[Xx]([0-9A-Za-z]*[.][0-9A-Za-z]+|[0-9A-Za-z]+[.][0-9A-Za-z]*)[Pp][+-]?[0-9]+[FfLl]?\\b)" + - constant.bool: "(\\b(true|false|NULL|nullptr|TRUE|FALSE)\\b)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + # TODO: Revert back to - error: "..+" once #3127 is merged + - error: "[[:graph:]]{2,}'" + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/caddyfile.yaml b/config/micro/syntax/caddyfile.yaml new file mode 100644 index 0000000..cb21821 --- /dev/null +++ b/config/micro/syntax/caddyfile.yaml @@ -0,0 +1,23 @@ +filetype: caddyfile + +detect: + filename: "Caddyfile" + +rules: + - identifier: "^\\s*\\S+(\\s|$)" + - type: "^([\\w.:/-]+,? ?)+[,{]$" + - constant.specialChar: "\\s{$" + - constant.specialChar: "^\\s*}$" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - preproc: "\\{(\\w+|\\$\\w+|%\\w+%)\\}" + - comment: + start: "#" + end: "$" + rules: [] + diff --git a/config/micro/syntax/cake.yaml b/config/micro/syntax/cake.yaml new file mode 100644 index 0000000..2a919e1 --- /dev/null +++ b/config/micro/syntax/cake.yaml @@ -0,0 +1,7 @@ +filetype: cake +detect: + filename: "\\.cake$" + +rules: + - include: "csharp" + - preproc: "^[[:space:]]*#(addin|break|l(oad)?|module|r(eference)?|tool)" diff --git a/config/micro/syntax/clojure.yaml b/config/micro/syntax/clojure.yaml new file mode 100644 index 0000000..9871b84 --- /dev/null +++ b/config/micro/syntax/clojure.yaml @@ -0,0 +1,38 @@ +filetype: clojure + +detect: + filename: "\\.(clj[sc]?|edn)$" + +rules: + + # Constants + - constant.bool: "\\b(true|false)\\b" + - constant.macro: "\\b(nil)\\b" + # Valid numbers + - constant.number: "[\\-]?[0-9]+?\\b" + - constant.number: "0x[0-9][A-Fa-f]+?\\b" + - constant.number: "[\\-]?(3[0-6]|2[0-9]|1[0-9]|[2-9])r[0-9A-Z]+?\\b" + # Invalid numbers + - error: "[\\-]?([4-9][0-9]|3[7-9]|1|0)r[0-9A-Z]+?\\b" + + # Symbols + - symbol.operator: "[=>+\\-*/'?]" + + # Types/casting + - type: "\\b(byte|short|(big)?int(eger)?|long|float|num|bigdec|rationalize)\\b" + + # String highlighting + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)" + + # Comments + - comment: + start: ";" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/cmake.yaml b/config/micro/syntax/cmake.yaml new file mode 100644 index 0000000..d23e613 --- /dev/null +++ b/config/micro/syntax/cmake.yaml @@ -0,0 +1,42 @@ +filetype: cmake + +detect: + filename: "(CMakeLists\\.txt|\\.cmake)$" + +rules: + - identifier.var: "^[[:space:]]*[A-Z0-9_]+" + - preproc: "^[[:space:]]*(include|include_directories|include_external_msproject)\\b" + + - statement: "^[[:space:]]*\\b((else|end)?if|else|(end)?while|(end)?foreach|break)\\b" + - statement: "\\b(COPY|NOT|COMMAND|PROPERTY|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\\b[[:space:]]" + - statement: "[[:space:]]\\b(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\\b[[:space:]]" + + - special: "^[[:space:]]*\\b((end)?(function|macro)|return)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - preproc: + start: "\\$(\\{|ENV\\{)" + end: "\\}" + rules: [] + + - identifier.macro: "\\b(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\\b" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/coffeescript.yaml b/config/micro/syntax/coffeescript.yaml new file mode 100644 index 0000000..677ae9c --- /dev/null +++ b/config/micro/syntax/coffeescript.yaml @@ -0,0 +1,56 @@ +filetype: coffeescript + +detect: + filename: "\\.coffee$" + +rules: + - symbol.operator: "([-+/*=<>!~%?:&|]|[.]{3})|\\b(and|or|is|isnt|not)\\b" + - identifier.class: "([A-Za-z_][A-Za-z0-9_]*:[[:space:]]*(->|\\()|->)" + - symbol.brackets: "[()]" + + - statement: "\\b(await|when|catch|continue|debugger|default|by|until)\\b" + - statement: "\\b(delete|do|else|export|finally|for|class|extends|while|then)\\b" + - statement: "\\b(get|if|import|from|in|instanceof|new|reject|resolve|return)\\b" + - statement: "\\b(set|super|switch|this|throw|try|typeof|with|yield|unless)\\b" + + - constant.bool: "\\b(true|false|yes|no|on|off)\\b" + - constant.bool.false: "\\b(false|no|off)\\b" + - constant.bool.true: "\\b(true|yes|on)\\b" + + - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b" + - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?" + - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?" + - identifier: "@[A-Za-z0-9_]*" + + - error: "\\b(enum|implements|interface|package|private|protected|public)" + - constant: "\\b(globalThis|Infinity|null|undefined|NaN)\\b" + - constant: "\\b(null|undefined|NaN)\\b" + - constant: "\\b(true|false|yes|no|on|off)\\b" + - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Generator|Map|Math)\\b" + - type: "\\b(Number|Object|Promise|Proxy|Reflect|RegExp|Set|String|Symbol|WeakMap|WeakSet)\\b" + - type: "\\b(BigInt64Array|BigUint64Array|Float32Array|Float64Array|Int16Array)\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "###" + end: "###" + rules: [] + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/colortest.yaml b/config/micro/syntax/colortest.yaml new file mode 100644 index 0000000..c08dc47 --- /dev/null +++ b/config/micro/syntax/colortest.yaml @@ -0,0 +1,19 @@ +filetype: colortest + +detect: + filename: "ColorTest$" + +rules: + - black: "\\bPLAIN\\b" + - red: "\\bred\\b" + - green: "\\bgreen\\b" + - yellow: "\\byellow\\b" + - blue: "\\bblue\\b" + - magenta: "\\bmagenta\\b" + - cyan: "\\bcyan\\b" + - brightred: "\\bbrightred\\b" + - brightgreen: "\\bbrightgreen\\b" + - brightyellow: "\\bbrightyellow\\b" + - brightblue: "\\bbrightblue\\b" + - brightmagenta: "\\bbrightmagenta\\b" + - brightcyan: "\\bbrightcyan\\b" diff --git a/config/micro/syntax/conky.yaml b/config/micro/syntax/conky.yaml new file mode 100644 index 0000000..199efaf --- /dev/null +++ b/config/micro/syntax/conky.yaml @@ -0,0 +1,17 @@ +filetype: conky + +detect: + filename: "(\\.*conkyrc.*$|conky.conf)" + +rules: + - type: "\\b(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|http_refresh|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_text_width|max_user_text|maximum_width|minimum_height|minimum_width|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\\b" + + # Configuration item constants + - statement: "\\b(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\\b" + + # Variables + - preproc: "\\b(acpiacadapter|acpifan|acpitemp|addr|addrs|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|cmdline_to_pid|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|distribution|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|format_time|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|ical|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|irc|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|memwithbuffers|membar|memwithbuffersbar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|mysql|nameserver|new_mails|nodename|nodename_short|no_update|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|pid_chroot|pid_cmdline|pid_cwd|pid_environ|pid_environ_list|pid_exe|pid_nice|pid_openfiles|pid_parent|pid_priority|pid_state|pid_state_short|pid_stderr|pid_stdin|pid_stdout|pid_threads|pid_thread_list|pid_time_kernelmode|pid_time_usermode|pid_time|pid_uid|pid_euid|pid_suid|pid_fsuid|pid_gid|pid_egid|pid_sgid|pid_fsgid|pid_read|pid_vmpeak|pid_vmsize|pid_vmlck|pid_vmhwm|pid_vmrss|pid_vmdata|pid_vmstk|pid_vmexe|pid_vmlib|pid_vmpte|pid_write|platform|pop3_unseen|pop3_used|processes|read_tcp|read_udp|replied_mails|rss|running_processes|running_threads|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|stock|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_ping|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|texecpi|threads|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|gid_name|uid_name|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|user_time|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\\b" + + - identifier.var: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" + - symbol.operator: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)" + - constant.macro: "^TEXT$" diff --git a/config/micro/syntax/cpp.yaml b/config/micro/syntax/cpp.yaml new file mode 100644 index 0000000..edd09c6 --- /dev/null +++ b/config/micro/syntax/cpp.yaml @@ -0,0 +1,91 @@ +filetype: c++ + +detect: + filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)?$|\\.ii?$|\\.(def)$)" + signature: "\\b(namespace|class|public|protected|private|template|constexpr|noexcept|nullptr|throw)\\b" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]*\\b" + - type: "\\b(auto|float|double|bool|char|int|short|long|enum|void|struct|union|typedef|(un)?signed|inline)\\b" + - type: "\\b(((s?size)|((u_?)?int(8|16|32|64|ptr))|char(8|16|32))_t|wchar_t)\\b" + - type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b" + - type: "\\b(final|override)\\b" + - statement: "\\b(volatile|const(expr|eval|init)?|mutable|register|thread_local|static|extern|decltype|explicit|virtual)\\b" + - statement: "\\b(class|namespace|template|typename|this|friend|using|public|protected|private|noexcept)\\b" + - statement: "\\b(concept|requires)\\b" + - statement: "\\b(import|export|module)\\b" + - statement: "\\b(for|if|while|do|else|case|default|switch)\\b" + - statement: "\\b(try|throw|catch|operator|new|delete|static_assert)\\b" + - statement: "\\b(goto|continue|break|return)\\b" + - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)|_Pragma" + + # Conditionally-supported/extension keywords + - statement: "\\b(asm|fortran)\\b" + + # GCC builtins + - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)" + + # Operator Color + - symbol.operator: "[-+*/%=<>.:;,~&|^!?]|\\b(sizeof|alignof|typeid|(and|or|xor|not)(_eq)?|bitor|compl|bitand|(const|dynamic|reinterpret|static)_cast)\\b" + # Parenthetical Color + - symbol.brackets: "[(){}]|\\[|\\]" + + # Integer Literals + - constant.number: "(\\b([0-9]|0[0-7]|0[Xx][0-9A-Fa-f]|0[Bb][01])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Base case (Without ' separtor) + - constant.number: "(\\b([1-9][0-9']*[0-9])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Decimal + - constant.number: "(\\b(0[0-7][0-7']*[0-7])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Oct + - constant.number: "(\\b(0[Xx][0-9A-Fa-f][0-9A-Fa-f']*[0-9A-Fa-f])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Hex + - constant.number: "(\\b(0[Bb][01][01']*[01])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Binary + + # Decimal Floating-point Literals + - constant.number: "(([0-9]?[.]?\\b[0-9]+)([Ee][+-]?[0-9]+)?[FfLl]?\\b)" # Base case optional interger part with exponent base case + - constant.number: "(\\b([0-9]+[.][0-9]?)([Ee][+-]?[0-9]+)?[FfLl]?)" # Base case optional fractional part with exponent base case + - constant.number: "(([0-9]?[.]?\\b[0-9]+)([Ee][+-]?[0-9][0-9']*[0-9])?[FfLl]?\\b)" # Base case optional interger part with exponent + - constant.number: "(\\b([0-9]+[.][0-9]?)([Ee][+-]?[0-9][0-9']*[0-9])?[FfLl]?)" # Base case optional fractional part with exponent + + - constant.number: "(([0-9][0-9']*[0-9])?[.]?\\b([0-9][0-9']*[0-9])+([Ee][+-]?[0-9]+)?[FfLl]?\\b)" # Optional interger part with exponent base case + - constant.number: "(\\b([0-9][0-9']*[0-9])+[.]([0-9][0-9']*[0-9])?([Ee][+-]?[0-9]+)?[FfLl]?)" # Optional fractional part with exponent base case + - constant.number: "(([0-9][0-9']*[0-9])?[.]?\\b([0-9][0-9']*[0-9])+([Ee][+-]?[0-9][0-9']*[0-9])?[FfLl]?\\b)" # Optional interger part with exponent + - constant.number: "(\\b([0-9][0-9']*[0-9])+[.]([0-9][0-9']*[0-9])?([Ee][+-]?[0-9][0-9']*[0-9])?[FfLl]?)" # Optional fractional part with exponent + + # Hexadecimal Floating-point Literals + - constant.number: "(\\b0[Xx]([0-9a-zA-Z]?[.]?[0-9a-zA-Z]+)([Pp][+-]?[0-9]+)?[FfLl]?\\b)" # Base case optional interger part with exponent base case + - constant.number: "(\\b0[Xx]([0-9a-zA-Z]+[.][0-9a-zA-Z]?)([Pp][+-]?[0-9]+)?[FfLl]?)" # Base case optional fractional part with exponent base case + - constant.number: "(\\b0[Xx]([0-9a-zA-Z]?[.]?[0-9a-zA-Z]+)([Pp][+-]?[0-9][0-9']*[0-9])?[FfLl]?\\b)" # Base case optional interger part with exponent + - constant.number: "(\\b0[Xx]([0-9a-zA-Z]+[.][0-9a-zA-Z]?)([Pp][+-]?[0-9][0-9']*[0-9])?[FfLl]?)" # Base case optional fractional part with exponent + + - constant.number: "(\\b0[Xx]([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])?[.]?([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])+([Pp][+-]?[0-9]+)?[FfLl]?\\b)" # Optional interger part with exponent base case + - constant.number: "(\\b0[Xx]([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])+[.]([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])?([Pp][+-]?[0-9]+)?[FfLl]?)" # Optional fractional part with exponent base case + - constant.number: "(\\b0[Xx]([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])?[.]?([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])+([Pp][+-]?[0-9][0-9']*[0-9])?[FfLl]?\\b)" # Optional interger part with exponent + - constant.number: "(\\b0[Xx]([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])+[.]([0-9a-zA-Z][0-9a-zA-Z']*[0-9a-zA-Z])?([Pp][+-]?[0-9][0-9']*[0-9])?[FfLl]?)" # Optional fractional part with exponent + + - constant.bool: "(\\b(true|false|NULL|nullptr|TRUE|FALSE)\\b)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "(\\\\.)|\\b([1-9][0-9']+[0-9]|0[0-7']+[0-7]|0[Xx][0-9A-Fa-f][0-9A-Fa-f']+[0-9A-Fa-f]|0[Bb][01][01']*[01])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b" + rules: + # TODO: Revert back to - error: "..+" once #3127 is merged + - error: "[[:graph:]]{2,}'" + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/crontab.yaml b/config/micro/syntax/crontab.yaml new file mode 100644 index 0000000..2b63045 --- /dev/null +++ b/config/micro/syntax/crontab.yaml @@ -0,0 +1,36 @@ +filetype: crontab + +detect: + filename: "crontab$|/tmp/crontab\\.\\w+$" + header: "^#.*?/etc/crontab" + +rules: + # The time and date fields are: + # field allowed values + # ----- -------------- + # minute 0-59 + # hour 0-23 + # day of month 0-31 + # month 0-12 (or names, see below) + # day of week 0-7 (0 or 7 is Sun, or use names) + + - statement: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+(([\\*0-9,\\-\\/]+)|(\\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\b))\\s+(([\\*0-9,\\-\\/]+)|(\\b(sun|mon|tue|wed|thu|fri|sat)\\b))\\s+(.*)$\\n?" + - constant: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+(([\\*0-9,\\-\\/]+)|(\\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\b))\\s+(([\\*0-9,\\-\\/]+)|(\\b(sun|mon|tue|wed|thu|fri|sat)\\b))" + + # Shell Values + - type: "^[A-Z]+\\=" + + # Months and weekday keywords + - constant: "\\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\b" + - constant: "\\b(sun|mon|tue|wed|thu|fri|sat)\\b" + - type: "\\@(reboot|yearly|annually|monthly|weekly|daily|midnight|hourly)\\b" + + # Conditionals + - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/crystal.yaml b/config/micro/syntax/crystal.yaml new file mode 100644 index 0000000..896864f --- /dev/null +++ b/config/micro/syntax/crystal.yaml @@ -0,0 +1,72 @@ +filetype: crystal + +detect: + filename: "\\.cr$" + +rules: + # Asciibetical list of reserved words + - statement: "\\b(abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|in|include|instance_sizeof|lib|loop|macro|module|next|of|out|pointerof|private|protected|raise|require|rescue|return|select|self|sizeof|spawn|struct|super|then|type|typeof|uninitialized|union|unless|until|verbatim|when|while|with|yield)\\b" + # Constants + - constant: "\\b(true|false|nil)\\b" + - constant.number: "\\b[0-9]+\\b" + # Ones that can't be in the same regex because they include non-words. + # The nil? one has to be after the constants. + - statement: "\\b(nil\\?|as(\\?|\\b)|is_a\\?|responds_to\\?)" + - type: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" + # Crystal "symbols" + - constant: "([ ]|^):[0-9A-Z_]+\\b" + # Some unique things we want to stand out + - constant: "\\b(__FILE__|__LINE__)\\b" + # Regular expressions + - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*" + + # Shell command expansion is in `backticks` or like %x{this}. These are + # "double-quotish" (to use a perlism). + - constant.string: "`[^`]*`|%x\\{[^}]*\\}" + + - constant.string: + start: "`" + end: "`" + rules: [] + + - constant.string: + start: "%x\\{" + end: "\\}" + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - symbol.brackets: + start: "#\\{" + end: "\\}" + rules: + - default: ".*" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment.bright: + start: "##" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - constant: + start: "<<-?'?EOT'?" + end: "^EOT" + rules: [] + diff --git a/config/micro/syntax/csharp.yaml b/config/micro/syntax/csharp.yaml new file mode 100644 index 0000000..e78a19c --- /dev/null +++ b/config/micro/syntax/csharp.yaml @@ -0,0 +1,52 @@ +filetype: csharp + +detect: + filename: "\\.cs$" + +rules: + # Class + - identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?" + + # Annotation + - identifier.var: "@[A-Za-z]+" + + - preproc: "^[[:space:]]*#[[:space:]]*(define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)" + - identifier: "([A-Za-z0-9_]*[[:space:]]*[()])" + - type: "\\b(bool|byte|sbyte|char|decimal|double|float|IntPtr|int|uint|long|ulong|managed|unmanaged|nint|nuint|object|short|ushort|string|base|this|var|void)\\b" + - statement: "\\b(alias|as|case|catch|checked|default|do|dynamic|else|finally|fixed|for|foreach|goto|if|is|lock|new|null|return|switch|throw|try|unchecked|when|while|with)\\b" + - statement: "\\b(abstract|add|and|args|async|await|class|const|delegate|enum|event|explicit|extern|file|get|global|implicit|in|init|internal|interface|nameof|namespace|not|notnull|operator|or|out|override|params|partial|private|protected|public|readonly|record|ref|remove|required|scoped|sealed|set|sizeof|stackalloc|static|struct|typeof|unsafe|using|value|virtual|volatile|yield)\\b" + # LINQ-only keywords (ones that cannot be used outside of a LINQ query - lots others can) + - statement: "\\b(from|where|select|group|info|orderby|join|let|in|on|equals|by|ascending|descending)\\b" + - special: "\\b(break|continue)\\b" + - constant.bool: "\\b(true|false)\\b" + - symbol.operator: "[\\-+/*=<>?:!~%&|]" + - constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" + - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" + - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/css.yaml b/config/micro/syntax/css.yaml new file mode 100644 index 0000000..e1acbe2 --- /dev/null +++ b/config/micro/syntax/css.yaml @@ -0,0 +1,44 @@ +filetype: css + +detect: + filename: "\\.(css|scss)$" + +rules: + # Classes and IDs + - statement: "(?i)." + # - normal: + # start: "\\{" + # end: "\\}" + # rules: [] + # css commands + - type: "(align-content|align-items|alignment-baseline|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|appearance|azimuth|backdrop-filter|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|baseline-shift|bookmark-label|bookmark-level|bookmark-state|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-boundary|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-decoration-break|box-shadow|box-sizing|box-snap|box-suppress|break-after|break-before|break-inside|caption-side|caret|caret-animation|caret-color|caret-shape|chains|clear|clip|clip-path|clip-rule|color|color-interpolation-filters|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|columns|column-span|column-width|content|continue|counter-increment|counter-reset|counter-set|cue|cue-after|cue-before|cursor|direction|display|dominant-baseline|elevation|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|float-defer|float-offset|float-reference|flood-color|flood-opacity|flow|flow-from|flow-into|font|font-family|font-feature-settings|font-kerning|font-language-override|font-size|font-size-adjust|font-stretch|font-style|font-synthesis|font-variant|font-variant-alternates|font-variant-caps|font-variant-east-asian|font-variant-ligatures|font-variant-numeric|font-variant-position|font-weight|footnote-display|footnote-policy|gap|glyph-orientation-vertical|grid|grid-area|grid-auto-columns|grid-auto-flow|grid-auto-rows|grid-column|grid-column-end|grid-column-gap|grid-column-start|grid-gap|grid-row|grid-row-end|grid-row-gap|grid-row-start|grid-template|grid-template-areas|grid-template-columns|grid-template-rows|hanging-punctuation|height|hyphenate-character|hyphenate-limit-chars|hyphenate-limit-last|hyphenate-limit-lines|hyphenate-limit-zone|hyphens|image-orientation|image-rendering|image-resolution|initial-letter|initial-letter-align|initial-letter-wrap|isolation|justify-content|justify-items|justify-self|left|letter-spacing|lighting-color|line-break|line-grid|line-height|line-snap|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|marker|marker-end|marker-knockout-left|marker-knockout-right|marker-mid|marker-pattern|marker-segment|marker-side|marker-start|marquee-direction|marquee-loop|marquee-speed|marquee-style|mask|mask-border|mask-border-mode|mask-border-outset|mask-border-repeat|mask-border-slice|mask-border-source|mask-border-width|mask-clip|mask-composite|mask-image|mask-mode|mask-origin|mask-position|mask-repeat|mask-size|mask-type|max-height|max-lines|max-width|min-height|min-width|mix-blend-mode|motion|motion-offset|motion-path|motion-rotation|nav-down|nav-left|nav-right|nav-up|object-fit|object-position|offset-after|offset-before|offset-end|offset-start|opacity|order|orphans|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-style|overflow-wrap|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page|page-break-after|page-break-before|page-break-inside|pause|pause-after|pause-before|perspective|perspective-origin|pitch|pitch-range|play-during|pointer-events|polar-anchor|polar-angle|polar-distance|polar-origin|position|presentation-level|quotes|region-fragment|resize|rest|rest-after|rest-before|richness|right|rotation|rotation-point|ruby-align|ruby-merge|ruby-position|running|scrollbar-color|scroll-behavior|scroll-snap-align|scroll-snap-margin|scroll-snap-margin-block|scroll-snap-margin-block-end|scroll-snap-margin-block-start|scroll-snap-margin-bottom|scroll-snap-margin-inline|scroll-snap-margin-inline-end|scroll-snap-margin-inline-start|scroll-snap-margin-left|scroll-snap-margin-right|scroll-snap-margin-top|scroll-snap-padding|scroll-snap-padding-block|scroll-snap-padding-block-end|scroll-snap-padding-block-start|scroll-snap-padding-bottom|scroll-snap-padding-inline|scroll-snap-padding-inline-end|scroll-snap-padding-inline-start|scroll-snap-padding-left|scroll-snap-padding-right|scroll-snap-padding-top|scroll-snap-type|shape-image-threshold|shape-inside|shape-margin|shape-outside|size|speak|speak-as|speak-header|speak-numeral|speak-punctuation|speech-rate|stress|string-set|stroke|stroke-alignment|stroke-dashadjust|stroke-dasharray|stroke-dashcorner|stroke-dashoffset|stroke-linecap|stroke-linejoin|stroke-miterlimit|stroke-opacity|stroke-width|table-layout|tab-size|text-align|text-align-all|text-align-last|text-combine-upright|text-decoration|text-decoration-color|text-decoration-line|text-decoration-skip|text-decoration-style|text-emphasis|text-emphasis-color|text-emphasis-position|text-emphasis-style|text-indent|text-justify|text-orientation|text-overflow|text-shadow|text-space-collapse|text-space-trim|text-spacing|text-transform|text-underline-offset|text-underline-position|text-wrap|top|transform|transform-box|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch|voice-range|voice-rate|voice-stress|voice-volume|volume|white-space|widows|width|will-change|word-break|word-spacing|word-wrap|wrap-after|wrap-before|wrap-flow|wrap-inside|wrap-through|writing-mode|z-index):" + # - default: + # start: ":" + # end: "[;^\\{]" + # rules: [] + - special: "!important" + - identifier: ":active|:focus|:hover|:link|:visited|:link|:after|:before|$" + - special: "(\\{|\\}|\\(|\\)|\\;|:|\\]|~|<|>|,)" + # SCSS Varaibles + - statement: "@import|@mixin|@extend" + # Strings + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - special: "\"|'" + # Comments & TODOs + - comment: + start: "\\/\\*" + end: "\\*\\/" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/csx.yaml b/config/micro/syntax/csx.yaml new file mode 100644 index 0000000..5ba6ea1 --- /dev/null +++ b/config/micro/syntax/csx.yaml @@ -0,0 +1,8 @@ +filetype: csharp-script +detect: + filename: "\\.csx$" + header: "^#!.*/(env +)?dotnet-script( |$)" + +rules: + - include: "csharp" + - preproc: "\\B(\\#!|\\#[r|load|]+\\b)" diff --git a/config/micro/syntax/cuda.yaml b/config/micro/syntax/cuda.yaml new file mode 100644 index 0000000..6875b1e --- /dev/null +++ b/config/micro/syntax/cuda.yaml @@ -0,0 +1,68 @@ +filetype: cuda + +detect: + filename: "(\\.cu[h]?$)" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]*\\b" + - type: "\\b(float|double|bool|char|int|short|long|enum|void|struct|union|typedef|(un)?signed|inline)\\b" + - type: "\\b(((s?size)|((u_?)?int(8|16|32|64|ptr))|char(8|16|32))_t|wchar_t)\\b" + - type: "\\b[a-z_][0-9a-z_]+(_t|_T)\\b" + - type: "\\b(final|override)\\b" + - type.keyword: "\\b(auto|volatile|const(expr|eval|init)?|mutable|register|thread_local|static|extern|decltype|explicit|virtual)\\b" + - statement: "\\b(class|namespace|template|typename|this|friend|using|public|protected|private|noexcept)\\b" + - statement: "\\b(concept|requires)\\b" + - statement: "\\b(import|export|module)\\b" + - statement: "\\b(for|if|while|do|else|case|default|switch)\\b" + - statement: "\\b(try|throw|catch|operator|new|delete|static_assert)\\b" + - statement: "\\b(goto|continue|break|return)\\b" + - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)|_Pragma" + + # Conditionally-supported/extension keywords + - statement: "\\b(asm|fortran)\\b" + + # GCC builtins + - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)" + + # CUDA specific keywords + - statement: "__(global|device|host|shared)__" + + # Operator Color + - symbol.operator: "[-+*/%=<>.:;,~&|^!?]|\\b(sizeof|alignof|typeid|(and|or|xor|not)(_eq)?|bitor|compl|bitand|(const|dynamic|reinterpret|static)_cast)\\b" + # Parenthetical Color + - symbol.brackets: "[(){}]|\\[|\\]" + # Integer Literals + - constant.number: "(\\b([1-9][0-9']*|0[0-7']*|0[Xx][0-9a-fA-F']+|0[Bb][01]+)([Uu]?[Ll][Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + # Decimal Floating-point Literals + - constant.number: "(\\b(([0-9']*[.][0-9']+|[0-9']+[.][0-9']*)([Ee][+-]?[0-9']+)?|[0-9']+[Ee][+-]?[0-9']+)[FfLl]?\\b)" + # Hexadecimal Floating-point Literals + - constant.number: "(\\b0[Xx]([0-9a-zA-Z']*[.][0-9a-zA-Z']+|[0-9a-zA-Z']+[.][0-9a-zA-Z']*)[Pp][+-]?[0-9']+[FfLl]?\\b)" + - constant.bool: "(\\b(true|false|NULL|nullptr)\\b)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/cython.yaml b/config/micro/syntax/cython.yaml new file mode 100644 index 0000000..5a30c60 --- /dev/null +++ b/config/micro/syntax/cython.yaml @@ -0,0 +1,52 @@ +filetype: cython + +detect: + filename: "\\.pyx$|\\.pxd$|\\.pyi$" + +rules: + # Python Keyword Color + - statement: "\\b(and|as|assert|class|def|DEF|del|elif|ELIF|else|ELSE|except|exec|finally|for|from|global|if|IF|import|in|is|lambda|map|not|or|pass|print|raise|try|while|with|yield)\\b" + - special: "\\b(continue|break|return)\\b" + + # Cython Keyword Color + - identifier.macro: "\\b(cdef|cimport|cpdef|cppclass|ctypedef|extern|include|namespace|property|struct)\\b" + - type: "\\b(bint|char|double|int|public|void|unsigned)\\b" + + # Operator Color + - symbol: "[.:;,+*|=!\\%]|<|>|/|-|&" + + # Parenthetical Color + - symbol.brackets: "[(){}]|\\[|\\]" + + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'''" + end: "'''" + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/d.yaml b/config/micro/syntax/d.yaml new file mode 100644 index 0000000..e8d36e2 --- /dev/null +++ b/config/micro/syntax/d.yaml @@ -0,0 +1,121 @@ +filetype: d + +detect: + filename: "\\.(d(i|d)?)$" + +rules: + # Operators and punctuation + - statement: "(\\*|/|%|\\+|-|>>|<<|>>>|&|\\^(\\^)?|\\||~)?=" + - statement: "\\.\\.(\\.)?|!|\\*|&|~|\\(|\\)|\\[|\\]|\\\\|/|\\+|-|%|<|>|\\?|:|;" + # Octal integer literals are deprecated + - error: "(0[0-7_]*)(L[uU]?|[uU]L?)?" + # Decimal integer literals + - constant.number: "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?\\b" + # Binary integer literals + - constant: "(0[bB][01_]*)(L[uU]?|[uU]L?)?" + # Decimal float literals + - constant.number: "[0-9][0-9_]*\\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?" + - constant.number: "[0-9][0-9_]*([eE][+-]?([0-9][0-9_]*))[fFL]?i?" + - constant.number: "[^.]\\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?" + - constant.number: "[0-9][0-9_]*([fFL]?i|[fF])" + # Hexadecimal integer literals + - constant.number: "(0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F]))(L[uU]?|[uU]L?)?" + # Hexadecimal float literals + - constant.number: "0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])(\\.[0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])?[pP][+-]?([0-9][0-9_]*)[fFL]?i?" + - constant.number: "0[xX]\\.([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])[pP][+-]?([0-9][0-9_]*)[fFL]?i?" + # Character literals + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + # Keywords + # a-e + - statement: "\\b(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|do|else|enum|export|extern)\\b" + # f-l + - statement: "\\b(false|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy)\\b" + # m-r + - statement: "\\b(macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|ref|return)\\b" + # s-w + - statement: "\\b(scope|shared|static|struct|super|switch|synchronized|template|this|throw|true|try|typeid|typeof|union|unittest|version|while|with)\\b" + # __ + - statement: "\\b(__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__gshared|__traits|__vector|__parameters)\\b" + # Deprecated keywords + - error: "\\b(delete|deprecated|typedef|volatile)\\b" + # Primitive types + - type: "\\b(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\\b" + # Globally defined symbols + - type: "\\b(string|wstring|dstring|size_t|ptrdiff_t)\\b" + # Special tokens + - constant: "\\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\\b" + # String literals + # DoubleQuotedString + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + # WysiwygString + - constant.string: + start: "r\"" + end: "\"" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "`" + end: "`" + rules: + - constant.specialChar: "\\\\." + # HexString + - constant.string: + start: "x\"" + end: "\"" + rules: + - constant.specialChar: "\\\\." + # DelimitedString + - constant.string: + start: "q\"\\(" + end: "\\)\"" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "q\"\\{" + end: "q\"\\}" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "q\"\\[" + end: "q\"\\]" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "q\"<" + end: "q\">" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "q\"[^({[<\"][^\"]*$" + end: "^[^\"]+\"" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "q\"([^({[<\"])" + end: "\"" + rules: + - constant.specialChar: "\\\\." + # Comments + - comment: + start: "//" + end: "$" + rules: [] + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + - comment: + start: "/\\+" + end: "\\+/" + rules: [] + diff --git a/config/micro/syntax/dart.yaml b/config/micro/syntax/dart.yaml new file mode 100644 index 0000000..5409d05 --- /dev/null +++ b/config/micro/syntax/dart.yaml @@ -0,0 +1,46 @@ +filetype: dart + +detect: + filename: "\\.dart$" + +rules: + - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b" + - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?" + - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?" + - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" + - statement: "\\b(break|case|catch|continue|default|else|finally)\\b" + - statement: "\\b(for|function|get|if|in|as|is|new|return|set|switch|final|await|async|sync)\\b" + - statement: "\\b(switch|this|throw|try|var|void|while|with|import|library|part|const|export)\\b" + - constant: "\\b(true|false|null)\\b" + - type: "\\b(List|String)\\b" + - type: "\\b(int|num|double|bool)\\b" + - statement: "[-+/*=<>!~%?:&|]" + - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*" + - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]" + + - comment: + start: "//" + end: "$" + rules: + - todo: "TODO:?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "TODO:?" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + diff --git a/config/micro/syntax/default.yaml b/config/micro/syntax/default.yaml new file mode 100644 index 0000000..f619ca6 --- /dev/null +++ b/config/micro/syntax/default.yaml @@ -0,0 +1,10 @@ +filetype: unknown + +detect: + filename: "" + +rules: + # Mails + - special: "[[:alnum:].%_+-]+@[[:alnum:].-]+" + # URLs + - identifier: "(https?|ftp|ssh)://\\S*[^])>\\s,.]" diff --git a/config/micro/syntax/dockerfile.yaml b/config/micro/syntax/dockerfile.yaml new file mode 100644 index 0000000..ea7aa7b --- /dev/null +++ b/config/micro/syntax/dockerfile.yaml @@ -0,0 +1,36 @@ +filetype: dockerfile + +detect: + filename: "((Docker|Container)file[^/]*$|\\.(docker|container)file$)" + +rules: + ## Keywords + - type.keyword: "(?i)^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|ARG|HEALTHCHECK|STOPSIGNAL|SHELL)[[:space:]]" + + ## Brackets & parenthesis + - statement: "(\\(|\\)|\\[|\\])" + + ## Double ampersand + - special: "&&" + + ## Comments + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + diff --git a/config/micro/syntax/dot.yaml b/config/micro/syntax/dot.yaml new file mode 100644 index 0000000..cea9a58 --- /dev/null +++ b/config/micro/syntax/dot.yaml @@ -0,0 +1,29 @@ +filetype: dot + +detect: + filename: "\\.(dot|gv)$" + +rules: + - type: "\\b(digraph|edge|graph|node|subgraph)\\b" + - statement: "\\b(arrow(head|size|tail)|(bg|fill|font)?color|center|constraint|decorateP|dir|distortion|font(name|size)|head(clip|label)|height|label(angle|distance|font(color|name|size))?|layer(s)?|margin|mclimit|minlen|name|nodesep|nslimit|ordering|orientation|page(dir)?|peripheries|port_label_distance|rank(dir|sep)?|ratio|regular|rotate|same(head|tail)|shape(file)?|sides|size|skew|style|tail(clip|label)|URL|weight|width)\\b" + - symbol: "=|->|--" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/elixir.yaml b/config/micro/syntax/elixir.yaml new file mode 100644 index 0000000..af7c607 --- /dev/null +++ b/config/micro/syntax/elixir.yaml @@ -0,0 +1,30 @@ +filetype: elixir + +detect: + filename: "\\.ex$|\\.exs$" + +rules: + - statement: "\\b(abs|trunc|rem|div|round|max|min|and|or|not|throw|raise|reraise|hd|tl|in|length|elem|put_elem|destructure|to_(string|charlist)|is_(atom|binary|bitstring|boolean|float|function|integer|list|map|nil|number|pid|port|reference|tuple)|(bit|byte|map|tuple)_size|binary_part|def(delegate|exception|guard|guardp|impl|macro|macrop|module|overridable|p|protocol|struct)?|sigil_[crswCRSWDNT]|if|else|unless|cond|binding|node|self|spawn|spawn_link|spawn_monitor|send|exit|struct|get_and_update_in|get_in|put_in|pop_in|update_in|apply|inspect|make_ref|use|do|end)\\b" + - statement: "\\b(alias|import|require|case|fn|receive|after|try|catch|rescue|super|quote|unquote|unquote_splicing|for|with)\\b" + + - constant: "\\b\\[A-Z]+\\b" + - constant.number: "\\b[0-9]+\\b" + + - constant.string: "`[^`]*`|%x\\{[^}]*\\}" + - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!" + - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!" + + - symbol.brackets: "\\{|\\}|\\[|\\]|\\(|\\)" + + - comment: "#[^{].*$|#$" + - comment.bright: "##[^{].*$|##$" + + - type.keyword: "\\:[a-zA-Z][a-zA-Z0-9_]*" + - type.keyword: "\\b(describe|test)" + - statement: "\\b(expected|assert|assert_raise|assert_in_delta|assert_received|catch_error|catch_throw|flunk|refute|refute_in_delta|refute_received)\\b" + - symbol.tag: "^\\s*\\@[a-zA-Z][a-zA-Z0-9_]*\\b" + + - identifier.macro: "\\b(__CALLER__|__DIR__|__ENV__|__MODULE__|__aliases__|__block__|defmacro)\\b" + + - todo: "(XXX|TODO|FIXME|\\?\\?\\?)" + - preproc.shebang: "\\W*#!.+?( |$)" diff --git a/config/micro/syntax/elm.yaml b/config/micro/syntax/elm.yaml new file mode 100644 index 0000000..be1dd3b --- /dev/null +++ b/config/micro/syntax/elm.yaml @@ -0,0 +1,38 @@ +filetype: elm + +detect: + filename: "\\.elm$" + +rules: + - statement: "\\b(as|alias|case|else|exposing|if|import|in|let|module|of|port|then|type|)\\b" + - statement: "(\\=|\\:|\\->)" + - type: "\\b([A-Z][A-Za-z\\d]*)\\b" + - identifier: "^([a-z][A-Za-z\\d]*)\\b" + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - comment: + start: "--" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + - comment: + start: "\\{-" + end: "-\\}" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/erb.yaml b/config/micro/syntax/erb.yaml new file mode 100644 index 0000000..fbe420b --- /dev/null +++ b/config/micro/syntax/erb.yaml @@ -0,0 +1,42 @@ +filetype: erb + +detect: + filename: "\\.erb$|\\.rhtml$" + +rules: + - error: "<[^!].*?>" + - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>" + - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>" + - preproc: "(?i)<[/]?(script|style)( .*|>)*?>" + - special: "&[^;[[:space:]]]*;" + - symbol: "[:=]" + - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)=" + - constant.string: "\"[^\"]*\"" + - constant.number: "(?i)#[0-9a-fA-F]{6,6}" + - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+" + - comment: "" + - preproc: "" + - default: + start: "<%" + end: "%>" + rules: [] + + - preproc: "<%|%>" + - red: "&[^;[[:space:]]]*;" + - statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\\b" + - identifier.var: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" + - magenta: "(?i)([ ]|^):[0-9A-Z_]+\\b" + - identifier.macro: "\\b(__FILE__|__LINE__)\\b" + - brightmagenta: "!/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*" + - brightblue: "`[^`]*`|%x\\{[^}]*\\}" + - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!" + - brightgreen: "#\\{[^}]*\\}" + - green: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!" + - comment: "#[^{].*$|#$" + - comment.bright: "##[^{].*$|##$" + - identifier.macro: + start: "<<-?'?EOT'?" + end: "^EOT" + rules: [] + + - todo: "(XXX|TODO|FIXME|\\?\\?\\?)" diff --git a/config/micro/syntax/erlang.yaml b/config/micro/syntax/erlang.yaml new file mode 100644 index 0000000..f4ef19d --- /dev/null +++ b/config/micro/syntax/erlang.yaml @@ -0,0 +1,45 @@ +filetype: erlang + +detect: + filename: "\\.erl$" + +rules: + - identifier: "\\b[A-Z][0-9a-z_]*\\b" + # See: https://erlang.org/doc/reference_manual/data_types.html + - constant.number: "\\b[0-9]+(\\.[0-9]+)?(e-?[0-9]+)?\\b" + - constant.number: "\\b[0-9]{1,2}\\#[a-zA-Z0-9]+\\b" + - constant.bool: "\\b(true|false)\\b" + - constant.number: "\\$\\\\?\\S{1}" + # See: https://erlang.org/doc/reference_manual/introduction.html + - statement: "\\b(after|and|andalso|band|begin|bnot|bor|bsl|bsr|bxor|case|catch|cond|div|end|fun|if|let|not|of|or|orelse|receive|rem|try|when|xor)\\b" + # See: https://erlang.org/doc/reference_manual/macros.html + - preproc: "\\-(module|export|record|include|include_lib|define|undef|ifdef|ifndef|else|endif|if|elif|error|warning)\\b" + - identifier.macro: "\\?[A-Z0-9_]+\\b" + # See: https://erlang.org/doc/man/erlang.html + - special: "\\b(ext_binary|binary|iovec|message_queue_data|time(_unit|stamp)|abs|apply|atom(_to_binary|_to_list)|binary_(part|to_atom|to_existing_atom|to_float|to_integer|to_list|to_term)|bit(_size|string_to_list)|byte_size|ceil|check_(old_code|process_code)|date|delete_module|demonitor|disconnect_node|element|erase|error|exit|float(_to_binary|_to_list)?|floor|garbage_collect|get|group_leader|halt|integer(_to_binary|to_list)|iolist_(size|to_binary)|is_(alive|atom|binary|bitstring|boolean|float|function|integer|list|map|map_key|number|pid|port|process_alive|record|reference|tuple|length)|link|list_to_(atom|binary|bitstring|existing_atom|float|integer|pid|port|ref|tuple)|load_module|make_ref|map_(get|size)|max|min|module_loaded|monitor(_node)?|nodes?|now|open_port|pid_to_list|port(_close|command|connect|control|to_list)|pre_loaded|process(_flag|_info|es)|purge_module|put|register(ed)?|round|self|setelement|size|spawn(_link|_monitor|_opt|_binary)?|statistics|trunc|tuple_(size|to_list)|unlink|unregister|whereis)\\b" + # See: https://erlang.org/doc/reference_manual/data_types.html#atom + - symbol: + start: "'" + end: "'" + skip: "\\\\." + rules: [] +# - constant.specialChar: "%." +# - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" +# - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + - comment: + start: "\\(\\*" + end: "\\*\\)" + rules: + - todo: "(TODO|FIXME|WONTFIX|NOTE|HACK):?" + - comment: + start: "%" + end: "$" + rules: [] diff --git a/config/micro/syntax/fish.yaml b/config/micro/syntax/fish.yaml new file mode 100644 index 0000000..73da226 --- /dev/null +++ b/config/micro/syntax/fish.yaml @@ -0,0 +1,48 @@ +filetype: fish + +detect: + filename: "\\.fish$" + header: "^#!.*/(env +)?fish( |$)" + +rules: + # Numbers + - constant: "\\b[0-9]+\\b" + + # Conditionals and control flow + - statement: "\\b(and|begin|break|case|continue|else|end|for|function|if|in|not|or|return|select|shift|switch|while)\\b" + - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)" + + # Fish commands + - type: "\\b(bg|bind|block|breakpoint|builtin|cd|count|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set|set_color|source|status|string|trap|type|ulimit|umask|vared)\\b" + + # Common linux commands + - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b" + + # Coreutils commands + - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b" + + # Conditional flags + - statement: "--[a-z-]+" + - statement: "\\ -[a-z]+" + + - identifier: "(?i)\\{?\\$[0-9A-Z_!@#$*?-]+\\}?" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: [] + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/forth.yaml b/config/micro/syntax/forth.yaml new file mode 100644 index 0000000..44ca1a3 --- /dev/null +++ b/config/micro/syntax/forth.yaml @@ -0,0 +1,34 @@ +filetype: forth + +detect: + filename: "\\.(forth|4th|fs|fs8|ft|fth|frt)$" + +rules: + - identifier: "\\b[A-Za-z_0-9-]*\\b" + + - statement: "\\b(?i:(if|else|then|do|loop|case|endcase|of|endof|begin|while|repeat|until|again|unloop|leave|exit|done|next|\\?do|\\+do|\\-do|\\+loop|\\-loop|\\?leave))\\b" + + - statement: "(^:|;$)" + + - type: "\\b(?i:(variable|constant|cells))\\b" + + - special: "\\B[?.]\\B" #for some reason, \b and \B are inverted for symbols + + - constant.number: "\\b[0-9]+\\b" + + - constant.string: + start: "\\b([Ss.]\" )" + end: "\"" + rules: [] + + - comment: + start: "\\(" + end: "\\)" + rules: + - todo: "(TODO|NOTE|XXX|FIXME):?" + + - comment: + start: "\\\\" + end: "$" + rules: + - todo: "(TODO|NOTE|XXX|FIXME):?" diff --git a/config/micro/syntax/fortran.yaml b/config/micro/syntax/fortran.yaml new file mode 100644 index 0000000..0cc773d --- /dev/null +++ b/config/micro/syntax/fortran.yaml @@ -0,0 +1,64 @@ +filetype: fortran + +detect: + filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$" + +rules: + - type: "(?i)\\b(action|advance|all|allocatable|allocated|any|apostrophe)\\b" + - type: "(?i)\\b(append|asis|assign|assignment|associated|bind|character|common)\\b" + - type: "(?i)\\b(complex|data|default|delim|dimension|double precision)\\b" + - type: "(?i)\\b(elemental|enum|enumerator|epsilon|external|file|fmt|form|format|huge)\\b" + - type: "(?i)\\b(implicit|include|index|inquire|integer|intent|interface)\\b" + - type: "(?i)\\b(intrinsic|iostat|kind|logical|module|none|null|only)\\\\b" + - type: "(?i)\\b(operator|optional|pack|parameter|pointer|position|private)\\b" + - type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b" + - type: "(?i)\\b(selected_real_kind|subroutine|status|module|function|logical)\\b" + + - constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b" + - constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b" + - constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|iachar)\\b" + - constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b" + - constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b" + - constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b" + - constant: "(?i)\\b(open|pad|present|print|product|pure|quote|radix)\\b" + - constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b" + - constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b" + - constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b" + - constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes|true|false|not)\\b" + + - constant.number: "\\b([0-9]+)\\b" + + - statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b" + - statement: "(?i)\\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\\b" + - statement: "(?i)\\b(or|and|repeat|select|case|then|where|while|import)\\b" + + - special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b" + + #Operator Color + - symbol.operator: "[.:;,+*|=!\\%]|/|-|>|<|&" + + #Parenthetical Color + - symbol.bracket: "[(){}]|\\[|\\]" + + # Add preprocessor commands. + - preproc: "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "!" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/freebsd-kernel.yaml b/config/micro/syntax/freebsd-kernel.yaml new file mode 100644 index 0000000..2e42568 --- /dev/null +++ b/config/micro/syntax/freebsd-kernel.yaml @@ -0,0 +1,14 @@ +filetype: freebsd-kernel + +detect: + filename: "GENERIC$" + +rules: + - identifier: "^(cpu|ident|options|makeoptions|device|include)" + - statement: "\\s\\S*" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/fsharp.yaml b/config/micro/syntax/fsharp.yaml new file mode 100644 index 0000000..bf58633 --- /dev/null +++ b/config/micro/syntax/fsharp.yaml @@ -0,0 +1,48 @@ +filetype: fsharp + +detect: + filename: "\\.fs?$" + +rules: + - identifier: "\\b[A-Z][0-9a-z_]{2,}\\b" + #declarations + - statement: "\\b(let|val|method|in|and|rec|private|virtual|constraint)\\b" + #structure items + - type: "\\b(type|open|class|module|exception|external)\\b" + #patterns + - statement: "\\b(fun|function|functor|match|try|with)\\b" + #patterns-modifiers + - statement: "\\b(as|when|of)\\b" + #conditions + - statement: "\\b(if|then|else)\\b" + #blocs + - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b" + #constantes + - constant.bool: "\\b(true|false)\\b" + #modules/classes + - special: "\\b(include|inherit|initializer)\\b" + #expr modifiers + - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b" + #keywords which don't exist in ocaml + - type: "\\b(base|delegate|downcast|extern|finally|fixed|global|inline|interface|internal|let!|member|namespace|null|override|private|public)\\b" + - type: "\\b(return|return!|select|static|upcast|use|use!|void|yield|yield!)\\b" + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + - comment: + start: "\\(\\*" + end: "\\*\\)" + rules: [] diff --git a/config/micro/syntax/gdscript.yaml b/config/micro/syntax/gdscript.yaml new file mode 100644 index 0000000..0498ab5 --- /dev/null +++ b/config/micro/syntax/gdscript.yaml @@ -0,0 +1,61 @@ +filetype: gdscript + +detect: + filename: "\\.gd$" + +rules: + # Built-in constants + - constant: "\\b(INF|NAN|PI|TAU)\\b" + - constant.bool: "\\b(null|true|false)\\b" + # Built-in functions + - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|clamp|convert|cos|cosh|db2linear|decimals|deg2rad|ease|exp|float|floor|fmod|fposmod|hash|int|isinf|isnan|lerp|linear2db|load|log|max|min|nearest_po2|pow|preload|print|printerr|printraw|prints|printt|rad2deg|rand_range|rand_seed|randomize|randi|randf|range|round|seed|sin|slerp|sqrt|str|str2var|tan|typeof|var2str|weakref)\\b" + # Built-in node names + - identifier: "\\b(AnimationPlayer|AnimationTreePlayer|Button|Control|Engine|HTTPClient|HTTPRequest|Input|InputEvent|MainLoop|Node|Node2D|OS|SceneTree|Spatial|StreamPeer|PacketPeer|PacketPeerUDP|Timer|Tween)\\b" + # Types + - type: "\\b(AABB|Array|Basis|Color|Dictionary|NodePath|Object|Plane|PoolByteArray|PoolColorArray|PoolIntArray|PoolRealArray|PoolVector2Array|PoolVector3Array|Quat|Rect2|RID|String|Transform|Transform2D|Vector2|Vector3)\\b" + # Definitions + - identifier: "func [a-zA-Z_0-9]+" + # Keywords + - statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|enum|export|extends|for|func|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|setget|slave|slavesync|signal|sync|tool|var|while|yield)\\b" + + # Operators + - statement: "[.:;,+*|=!\\%@]|<|>|/|-|&" + + # Parentheses + - statement: "[(){}]|\\[|\\]" + + # Numbers + - constant: "\\b[0-9]+\\b" + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" + + - comment: + start: "\"\"\"" + end: "\"\"\"" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "'''" + end: "'''" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/gemini.yaml b/config/micro/syntax/gemini.yaml new file mode 100644 index 0000000..b3ea7bf --- /dev/null +++ b/config/micro/syntax/gemini.yaml @@ -0,0 +1,19 @@ +filetype: gemini + +detect: + filename: "\\.(gmi|gemini)$" + +rules: + # link lines + - constant: "^=>[[:space:]].*" + # preformatted text lines + - special: + start: "^```" + end: "^```" + rules: [] + # heading lines + - special: "^#{1,3}.*" + # unordered list items + - identifier: "^\\*[[:space:]]" + # quote lines + - statement: "^>.*" diff --git a/config/micro/syntax/gentoo-ebuild.yaml b/config/micro/syntax/gentoo-ebuild.yaml new file mode 100644 index 0000000..0d118f4 --- /dev/null +++ b/config/micro/syntax/gentoo-ebuild.yaml @@ -0,0 +1,48 @@ +filetype: ebuild + +detect: + filename: "\\.e(build|class)$" + +rules: + # All the standard portage functions + - identifier: "^src_(unpack|compile|install|test)|^pkg_(config|nofetch|setup|(pre|post)(inst|rm))" + # Highlight bash related syntax + - statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while|continue|break)\\b" + - statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)" + - statement: "-(e|d|f|r|g|u|w|x|L)\\b" + - statement: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b" + # Highlight variables ... official portage ones in red, all others in bright red + - preproc: "\\$\\{?[a-zA-Z_0-9]+\\}?" + - special: "\\b(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT|USERLAND)\\b" + - special: "\\b(S|D|T|PV|PF|P|PN|A)\\b|\\bC(XX)?FLAGS\\b|\\bLDFLAGS\\b|\\bC(HOST|TARGET|BUILD)\\b" + # Highlight portage commands + - identifier: "\\buse(_(with|enable))?\\b [!a-zA-Z0-9_+ -]*|inherit.*" + - statement: "\\be(begin|end|conf|install|make|warn|infon?|error|log|patch|new(group|user))\\b" + - statement: "\\bdie\\b|\\buse(_(with|enable))?\\b|\\binherit\\b|\\bhas\\b|\\b(has|best)_version\\b|\\bunpack\\b" + - statement: "\\b(do|new)(ins|s?bin|doc|lib(\\.so|\\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\\b" + - statement: "\\bdo(python|sed|dir|hard|sym|html|jar|mo)\\b|\\bkeepdir\\b" + - statement: "prepall(docs|info|man|strip)|prep(info|lib|lib\\.(so|a)|man|strip)" + - statement: "\\b(doc|ins|exe)into\\b|\\bf(owners|perms)\\b|\\b(exe|ins|dir)opts\\b" + # Highlight common commands used in ebuilds + - type: "\\bmake\\b|\\b(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/gentoo-etc-portage.yaml b/config/micro/syntax/gentoo-etc-portage.yaml new file mode 100644 index 0000000..300687e --- /dev/null +++ b/config/micro/syntax/gentoo-etc-portage.yaml @@ -0,0 +1,23 @@ +filetype: etc-portage + +detect: + filename: "\\.(keywords|mask|unmask|use)(/.+)?$" + +rules: + # Use flags: + - constant.bool.false: "[[:space:]]+\\+?[a-zA-Z0-9_-]+" + - constant.bool.true: "[[:space:]]+-[a-zA-Z0-9_-]+" + # Likely version numbers: + - special: "-[[:digit:]].*([[:space:]]|$)" + # Accepted arches: + - identifier.class: "[~-]?\\b(alpha|amd64|arm|hppa|ia64|mips|ppc|ppc64|s390|sh|sparc|x86|x86-fbsd)\\b" + - identifier.class: "[[:space:]][~-]?\\*" + # Categories: + - statement: "^[[:space:]]*.*/" + # Masking regulators: + - symbol: "^[[:space:]]*(=|~|<|<=|=<|>|>=|=>)" + # Comments: + - comment: + start: "#" + end: "$" + rules: [] diff --git a/config/micro/syntax/git-commit.yaml b/config/micro/syntax/git-commit.yaml new file mode 100644 index 0000000..29c7353 --- /dev/null +++ b/config/micro/syntax/git-commit.yaml @@ -0,0 +1,35 @@ +filetype: git-commit + +detect: + filename: '^(.*[\\/])?(COMMIT_EDITMSG|TAG_EDITMSG|MERGE_MSG)$' + +rules: + # File changes + - type.keyword: "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*" + - type.keyword: "#[[:space:]]deleted:" + - type.keyword: "#[[:space:]]modified:" + - type.keyword: "#[[:space:]]new file:" + - type.keyword: "#[[:space:]]renamed:" + - type.keyword: "^#[[:space:]]Changes.*[:]" + - type.keyword: "^#[[:space:]]Your branch and '[^']+" + - type.keyword: "^#[[:space:]]Your branch and '" + - type.keyword: "^#[[:space:]]On branch [^ ]+" + - type.keyword: "^#[[:space:]]On branch" + # Color keywords for closing issues (such as on Github) + - type.keyword: "\\b(?i)((fix(es|ed)?|close(s|d)?) #[0-9]+)\\b" + + # Comments + - comment.line: + start: "^#" + end: "$" + rules: [] + + # Diffs (i.e. git commit --verbose) + - default: + start: "^diff --git" + # Diff output puts a space before file contents on each line so this + # should never match valid diff output and extend highlighting to the + # end of the file + end: "^ENDOFFILE" + rules: + - include: "patch" diff --git a/config/micro/syntax/git-config.yaml b/config/micro/syntax/git-config.yaml new file mode 100644 index 0000000..9a13b38 --- /dev/null +++ b/config/micro/syntax/git-config.yaml @@ -0,0 +1,14 @@ +filetype: git-config + +detect: + filename: 'git(config|modules)$|^(.*[\\/])?\.?git[\\/]config$' + +rules: + - constant: "\\<(true|false)\\>" + - type.keyword: "^[[:space:]]*[^=]*=" + - constant: "^[[:space:]]*\\[.*\\]$" + - constant: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - comment: + start: "#" + end: "$" + rules: [] diff --git a/config/micro/syntax/git-rebase-todo.yaml b/config/micro/syntax/git-rebase-todo.yaml new file mode 100644 index 0000000..07c93b6 --- /dev/null +++ b/config/micro/syntax/git-rebase-todo.yaml @@ -0,0 +1,19 @@ +filetype: git-rebase-todo + +detect: + filename: '^(.*[\\/])?git\-rebase\-todo$' + +rules: + # Rebase commands + - statement: "^(p(ick)?|r(eword)?|e(dit)?|s(quash)?|f(ixup)?|x|exec|b(reak)?|d(rop)?|l(abel)?|t|reset|m(erge)?)\\b" + # Commit IDs + - identifier: "\\b([0-9a-fA-F]{7,40})\\b" + + # Color keywords for Github (and others) + - type.keyword: "\\b(?i)((fix(es|ed)?|close(s|d)?) #[0-9]+)\\b" + + # Comments + - comment.line: + start: "^#" + end: "$" + rules: [] diff --git a/config/micro/syntax/gleam.yaml b/config/micro/syntax/gleam.yaml new file mode 100644 index 0000000..52f1b8c --- /dev/null +++ b/config/micro/syntax/gleam.yaml @@ -0,0 +1,69 @@ +filetype: gleam + +detect: + filename: "\\.gleam$" + +rules: + - identifier: "\\b[a-z][a-z0-9_]*\\b" + + - statement: "\\b(as|assert|auto|case|const|delegate|derive|echo|else|fn|if|implement|import|let|macro|opaque|panic|pub|test|todo|type|use)\\b" + + - type: "\\b[A-Z][a-zA-Z0-9_]*\\b" + + - type: "\\b(Int|Float|String|Bool|List|Option|Result|BitArray)\\b" + + - constant: "\\b(True|False|Nil)\\b" + + - preproc: "@[a-z][a-z_]*" + + - statement: "(\\|>|->|<-)" + - statement: "(\\.\\.|<>)" + - statement: "(==|!=|<=\\.|>=\\.|<\\.|>\\.|<=|>=)" + - statement: "(&&|\\|\\|)" + - statement: "(\\+\\.|-\\.|\\*\\.|/\\.|\\+|-|\\*|/|%)" + - statement: "(=|<|>|!|<<|>>)" + + - constant.number: "\\b0b[01](_?[01])*\\b" + - constant.number: "\\b0o[0-7](_?[0-7])*\\b" + - constant.number: "\\b0x[0-9a-fA-F](_?[0-9a-fA-F])*\\b" + - constant.number: "\\b[0-9](_?[0-9])*(\\.[0-9](_?[0-9])*)?([eE][+-]?[0-9](_?[0-9])*)?\\b" + + - default: + start: "#\\(" + end: "\\)" + limit-group: special + rules: + - identifier: "\\b[a-z][a-z0-9_]*\\b" + - statement: "\\b(as|assert|auto|case|const|delegate|derive|echo|else|fn|if|implement|import|let|macro|opaque|panic|pub|test|todo|type|use)\\b" + - type: "\\b[A-Z][a-zA-Z0-9_]*\\b" + - type: "\\b(Int|Float|String|Bool|List|Option|Result|BitArray)\\b" + - constant: "\\b(True|False|Nil)\\b" + - statement: "(\\|>|->|<-)" + - statement: "(\\.\\.|<>)" + - statement: "(==|!=|<=\\.|>=\\.|<\\.|>\\.|<=|>=)" + - statement: "(&&|\\|\\|)" + - statement: "(\\+\\.|-\\.|\\*\\.|/\\.|\\+|-|\\*|/|%)" + - statement: "(=|<|>|!|<<|>>)" + - constant.number: "\\b0b[01](_?[01])*\\b" + - constant.number: "\\b0o[0-7](_?[0-7])*\\b" + - constant.number: "\\b0x[0-9a-fA-F](_?[0-9a-fA-F])*\\b" + - constant.number: "\\b[0-9](_?[0-9])*(\\.[0-9](_?[0-9])*)?([eE][+-]?[0-9](_?[0-9])*)?\\b" + - constant.string: + start: '"' + end: '"' + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: '"' + end: '"' + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|FIXME|XXX):?" diff --git a/config/micro/syntax/glsl.yaml b/config/micro/syntax/glsl.yaml new file mode 100644 index 0000000..79063bd --- /dev/null +++ b/config/micro/syntax/glsl.yaml @@ -0,0 +1,26 @@ +filetype: glsl + +detect: + filename: "\\.(frag|vert|fp|vp|glsl)$" + +rules: + - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]" + - type: "\\b(void|bool|bvec2|bvec3|bvec4|int|ivec2|ivec3|ivec4|float|vec2|vec3|vec4|mat2|mat3|mat4|struct|sampler1D|sampler2D|sampler3D|samplerCUBE|sampler1DShadow|sampler2DShadow)\\b" + - identifier: "\\bgl_(DepthRangeParameters|PointParameters|MaterialParameters|LightSourceParameters|LightModelParameters|LightModelProducts|LightProducts|FogParameters)\\b" + - statement: "\\b(const|attribute|varying|uniform|in|out|inout|if|else|return|discard|while|for|do)\\b" + - statement: "\\b(break|continue)\\b" + - constant.bool: "\\b(true|false)\\b" + - symbol.operator: "[-+/*=<>?:!~%&|^]" + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b" + + - comment: + start: "//" + end: "$" + rules: + - todo: "TODO:?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "TODO:?" diff --git a/config/micro/syntax/gnuplot.yaml b/config/micro/syntax/gnuplot.yaml new file mode 100644 index 0000000..fa21183 --- /dev/null +++ b/config/micro/syntax/gnuplot.yaml @@ -0,0 +1,15 @@ +filetype: gnuplot + +detect: + filename: "\\.(gnu|gpi|plt|gp)$" + +rules: + - statement: "\\b(set|unset|plot|splot|replot|if|else|do|for|while|fit)\\b" + - symbol.operator: "[-+/*=<>?:!~%&|^$]" + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b" + + - comment: + start: "#" + end: "$" + rules: + - todo: "TODO:?" diff --git a/config/micro/syntax/go.yaml b/config/micro/syntax/go.yaml new file mode 100644 index 0000000..3885c7b --- /dev/null +++ b/config/micro/syntax/go.yaml @@ -0,0 +1,62 @@ +filetype: go + +detect: + filename: "\\.go$" + +rules: + # Conditionals and control flow + - special: "\\b(break|case|continue|default|go|goto|range|return|println|fallthrough)\\b" + - statement: "\\b(else|for|if|switch|select)\\b" + - preproc: "\\b(package|import|const|var|type|struct|func|defer|iota|make|new|copy|len|cap|panic|append|close|delete|print|recover)\\b" + - symbol.operator: "[-+/*=<>!~%&|^]|:=" + + # Types + - symbol: "(,|\\.)" + - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b" + - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b" + - type.keyword: "\\b(struct)\\b" + - constant.bool: "\\b(true|false|nil)\\b" + + # Brackets + - symbol.brackets: "(\\{|\\})" + - symbol.brackets: "(\\(|\\))" + - symbol.brackets: "(\\[|\\])" + + # Numbers and strings + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - constant.string: + start: "`" + end: "`" + rules: [] + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/godoc.yaml b/config/micro/syntax/godoc.yaml new file mode 100644 index 0000000..383f309 --- /dev/null +++ b/config/micro/syntax/godoc.yaml @@ -0,0 +1,17 @@ +# godoc +# example: go doc -all | micro + +filetype: godoc + +detect: + filename: "\\.godoc$" + header: package.*import + +rules: + - preproc: "^[^ ].*" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/golo.yaml b/config/micro/syntax/golo.yaml new file mode 100644 index 0000000..54e0527 --- /dev/null +++ b/config/micro/syntax/golo.yaml @@ -0,0 +1,73 @@ +filetype: golo + +detect: + filename: "\\.golo$" + +rules: + - type: "\\b(function|fun|)\\b" + - type: "\\b(struct|DynamicObject|union|AdapterFabric|Adapter|DynamicVariable|Observable)\\b" + - type: "\\b(list|set|array|vector|tuple|map)\\b" + - type: "\\b(Ok|Error|Empty|None|Some|Option|Result|Result.ok|Result.fail|Result.error|Result.empty|Optional.empty|Optional.of)\\b" + + - identifier.class: "\\b(augment|pimp)\\b" + - identifier.class: "\\b(interfaces|implements|extends|overrides|maker|newInstance)\\b" + - identifier.class: "\\b(isEmpty|isNone|isPresent|isSome|iterator|flattened|toList|flatMap|`and|orElseGet|`or|toResult|apply|either)\\b" + - identifier.class: "\\b(result|option|trying|raising|nullify|catching)\\b" + - identifier.class: "\\b(promise|setFuture|failedFuture|all|any)\\b" + - identifier.class: "\\b(initialize|initializeWithinThread|start|future|fallbackTo|onSet|onFail|cancel|enqueue)\\b" + - identifier.class: "\\b(println|print|raise|readln|readPassword|secureReadPassword|requireNotNull|require|newTypedArray|range|reversedRange|mapEntry|asInterfaceInstance|asFunctionalInterface|isClosure|fileToText|textToFile|fileExists|currentDir|sleep|uuid|isArray|arrayTypeOf|charValue|intValue|longValue|doubleValue|floatValue|removeByIndex|box)\\b" + - identifier.class: "\\b(likelySupported|reset|bold|underscore|blink|reverse_video|concealed|fg_black|fg_red|fg_green|fg_yellow|fg_blue|fg_magenta|fg_cyan|fg_white|bg_black|bg_red|bg_green|bg_yellow|bg_blue|bg_magenta|bg_cyan|bg_white|cursor_position|cursor_save_position|cursor_restore_position|cursor_up|cursor_down|cursor_forward|cursor_backward|erase_display|erase_line)\\b" + - identifier.class: "\\b(emptyList|cons|lazyList|fromIter|generator|repeat|iterate)\\b" + - identifier.class: "\\b(asLazyList|foldl|foldr|take|takeWhile|drop|dropWhile|subList)\\b" + - identifier.class: "\\b(import)\\b" + - identifier.class: "\\b(module)\\b" + - identifier.class: "\\b(JSON)\\b" + - identifier.class: "\\b(stringify|parse|toJSON|toDynamicObject|updateFromJSON)\\b" + - identifier.class: "\\b(newInstance|define|getKey|getValue|properties|fallback)\\b" + - identifier.class: "\\b(times|upTo|downTo)\\b" + - identifier.class: "\\b(format|toInt|toInteger|toDouble|toFloat|toLong)\\b" + - identifier.class: "\\b(head|tail|isEmpty|reduce|each|count|exists)\\b" + - identifier.class: "\\b(newWithSameType|destruct|append|add|addIfAbsent|prepend|insert|last|unmodifiableView|find|filter|map|join|reverse|reversed|order|ordered|removeAt|include|exclude|remove|delete|has|contains|getOrElse|toArray)\\b" + - identifier.class: "\\b(add|addTo|succ|pred|mul|neg|sub|rsub|div|rdiv|mod|rmod|pow|rpow|str|lt|gt|eq|ne|ge|le|`and|`or|`not|xor|even|odd|contains|isEmpty|`is|`isnt|`oftype|`orIfNull|fst|snd|getitem|setitem|getter|id|const|False|True|Null|curry|uncurry|unary|spreader|varargs|swapArgs|swapCurry|swapCouple|swap|invokeWith|pipe|compose|io|andThen|until|recur|cond)\\b" + - identifier.class: "\\b(toUpperCase|equals|startsWith)\\b" + + - statement: "\\b(if|else|then|when|case|match|otherwise)\\b" + - special: "\\b(with|break|continue|return)\\b" + - error: "\\b(try|catch|finally|throw)\\b" + - identifier: "\\b(super|this|let|var|local)\\b" + - symbol.brackets: "[(){}]|\\[|\\]" + - statement: "\\b(for|while|foreach|in)\\b" + - constant: "\\b(and|in|is|not|or|isnt|orIfNull)\\b" + + - constant.bool: "\\b(true|false)\\b" + - constant: "\\b(null|undefined)\\b" + + - symbol.operator: "[\\-+/*=<>!~%&|^]|:=" + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "----" + end: "----" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/gomod.yaml b/config/micro/syntax/gomod.yaml new file mode 100644 index 0000000..5f2b7c6 --- /dev/null +++ b/config/micro/syntax/gomod.yaml @@ -0,0 +1,31 @@ +filetype: gomod + +detect: + filename: "go.mod" + +rules: + # URL + - type: "(^|[ \\t])+\\b([a-zA-Z0-9-]+\\.?)+(/[a-zA-Z0-9-_\\.]+)*\\b" + + # Keywords + - special: "(^|[ \\t])+\\b(module|go)\\b" + - preproc: "(^|[ \\t])+\\b(toolchain|require|exclude|replace|retract)\\b" + - symbol.operator: "=>" + + # Brackets + - type: "(\\(|\\))" + + # Go version + - type: "(^|[ \\t])+([0-9]+\\.?)+" + + # Version + - constant.string: "(^|[ \\t])+v([0-9]+\\.?){3}.*" + - constant.number: "(^|[ \\t])+v([0-9]+\\.?){3}" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(indirect):?" + +# (^|[ \\t])+ means after start of string or space or tab character diff --git a/config/micro/syntax/graphql.yaml b/config/micro/syntax/graphql.yaml new file mode 100644 index 0000000..d96abec --- /dev/null +++ b/config/micro/syntax/graphql.yaml @@ -0,0 +1,47 @@ +filetype: graphql + +detect: + filename: "\\.(gql|graphql)$" + +rules: + - type: "\\b(?:(query|mutation|subscription|type|input|scalar|fragment|schema|union|on|extends?))\\b" + + # scalar types + - statement: "\\b(ID|Int|Float|Boolean|String|Datetime|Null)\\b" + + # introspection types + - statement: "(__\\w+)" + + # parameters + - statement: "((\\w+)(?:\\:([\\s]*)?)(?:\\$))" + + # directive locations + - statement: "\\b(QUERY|MUTATION|SUBSCRIPTION|FIELD|FRAGMENT_DEFINITION|FRAGMENT_SPREAD|INLINE_FRAGMENT|SCHEMA|SCALAR|OBJECT|FIELD_DEFINITION|ARGUMENT_DEFINITION|INTERFACE|UNION|ENUM|ENUM_VALUE|INPUT_OBJECT|INPUT_FIELD_DEFINITION)\\b" + + # directives + - constant: "(@\\w+)" + + # root types + - constant: "\\b(Query|Mutation|Subscription|Schema|Root)\\b" + + # variables + - special: "(\\$\\w+)" + + # required symbol + - special: "(!)" + + - symbol: "(:|=|\\||\\(|\\)|\\{|\\}|\\[|\\])" + + - constant.bool: "\\b(true|false)\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: [] diff --git a/config/micro/syntax/groff.yaml b/config/micro/syntax/groff.yaml new file mode 100644 index 0000000..3eaea1f --- /dev/null +++ b/config/micro/syntax/groff.yaml @@ -0,0 +1,30 @@ +filetype: groff + +detect: + filename: "\\.m[ems]$|\\.rof|\\.tmac$|^tmac." + +rules: + - statement: "^\\.(ds|nr) [^[[:space:]]]*" + - constant.specialChar: "\\\\." + - constant.specialChar: "\\\\f.|\\\\f\\(..|\\\\s(\\+|\\-)?[0-9]" + - constant: "(\\\\|\\\\\\\\)n(.|\\(..)" + - constant: + start: "(\\\\|\\\\\\\\)n\\[" + end: "]" + rules: [] + + - type: "^\\.[[:space:]]*[^[[:space:]]]*" + - comment: "^\\.\\\\\".*$" + - constant.string: "(\\\\|\\\\\\\\)\\*(.|\\(..)" + - constant.string: + start: "(\\\\|\\\\\\\\)\\*\\[" + end: "]" + rules: [] + + - constant.specialChar: "\\\\\\(.." + - constant.specialChar: + start: "\\\\\\[" + end: "]" + rules: [] + + - identifier.macro: "\\\\\\\\\\$[1-9]" diff --git a/config/micro/syntax/groovy.yaml b/config/micro/syntax/groovy.yaml new file mode 100644 index 0000000..1830f8b --- /dev/null +++ b/config/micro/syntax/groovy.yaml @@ -0,0 +1,111 @@ +filetype: groovy + +detect: + filename: "(\\.(groovy|gy|gvy|gsh|gradle)$|^[Jj]enkinsfile$)" + header: "^#!.*/(env +)?groovy *$" + +rules: + # And the style guide for constants is CONSTANT_CASE + - identifier: "\\b[A-Z_$]+\\b" + # The style guide for JVM languages is PascalCase for classes and interfaces + - identifier.class: "\\b[A-Z][a-zA-Z0-9$]+\\b" + + # Primitive types + - type: "\\b(byte|short|int|long|float|double|char|boolean|void)\\b" + + # Type-related keywords + - type.keyword: "\\b(private|public|protected|static|final|var|def)\\b" + + # Keywords + - statement: "\\b(for|while|do|if|else|switch|case|default|try|catch|finally)\\b" + - statement: "\\b(break|continue|return|throw|assert)\\b" + - statement: "\\b(package|import|class|interface|trait|enum|extends|implements|throws)\\b" + - statement: "\\b(this|super)\\b" + # Unsused, but reserved keywords + - statement: "\\b(goto|const)\\b" + + # Operators and punctuation + - symbol.operator: "[-+*/%=<>^~&|!?:;,.@]|\\b(in|is|as|instanceof|new)\\b" + - symbol.brackets: "[(){}]|\\[|\\]" + + # Decimal integer literal + - constant.number: "(?i)\\b[1-9]([_0-9]*[0-9])?[GLIDF]?\\b" + # Binary integer literal + - constant.number: "(?i)\\b0b[01]([01_]*[01])?[GLIDF]?\\b" + # Octal integer literal + - constant.number: "(?i)\\b0[0-7]([0-7_]*[0-7])?[GLIDF]?\\b" + # Hexadecimal integer literal + - constant.number: "(?i)\\b0x[0-9a-fA-F]([0-9a-f_]*[0-9a-fA-F])?[GLIDF]?\\b" + # Floating-point literal + - constant.number: "(?i)\\b[0-9]([0-9_]*[0-9])?([.][0-9]([0-9_]*[0-9])?)?(e[+-]?[0-9]([0-9_]*[0-9])?)?[DF]?\\b" + - constant.bool: "\\b(true|false|null)\\b" + + # Annotations + - identifier: "@[A-Za-z_$][A-Za-z0-9_$]*\\b" + + # Triple-double-quoted strings + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})" + - identifier.var: "\\x24[\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+([.][a-zA-Z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+)*" + - identifier: + start: "[$][{]" + end: "[}]" + rules: [] + + # Triple-single-quoted strings + - constant.string: + start: "'''" + end: "'''" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})" + + # Nesting ${} are never going to be matched correctly with just regex either, so highlighting will break if one is to nest interpolation + # Double-quoted strings + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})" + - identifier.var: "\\x24[\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+([.][a-zA-Z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+)*" + - identifier: "\\x24[{].*[}]" + + # Single-quoted strings + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})" + + # Slashy strings are left out, because they match in unwanted places pretty much all the time + # Dollar-slashy strings + - constant.string: + start: "[$]/" + end: "/[$]" + rules: [] + + # Single-line comments + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + # Multiline comments + - comment: + start: "/[*]" + end: "[*]/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + # Groovydoc comments + - comment: + start: "/[*][*]@?" + end: "[*]/" + rules: [] diff --git a/config/micro/syntax/haml.yaml b/config/micro/syntax/haml.yaml new file mode 100644 index 0000000..f15fe28 --- /dev/null +++ b/config/micro/syntax/haml.yaml @@ -0,0 +1,16 @@ +filetype: haml + +detect: + filename: "\\.haml$" + +rules: + - symbol: "-|=" + - default: "->|=>" + - constant: "([ ]|^)%[0-9A-Za-z_]+>" + - special: ":[0-9A-Za-z_]+>" + - type: "\\.[A-Za-z_]+>" + - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!" + - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!" + - identifier: "#\\{[^}]*\\}" + - identifier.var: "(@|@@)[0-9A-Z_a-z]+" + - comment: "#[^{].*$|#$" diff --git a/config/micro/syntax/hare.yaml b/config/micro/syntax/hare.yaml new file mode 100644 index 0000000..081831d --- /dev/null +++ b/config/micro/syntax/hare.yaml @@ -0,0 +1,52 @@ +filetype: hare + +detect: + filename: "\\.ha$" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" + + - type: "\\b(bool|char|str|rune|void)\\b" + - type: "\\b(f32|f64|uint|int|u8|u16|u32|u64|i8|i16|i32|i64|uintptr)\\b" + + - statement: "\\b(case|else|for|if|switch)\\b" + - statement: "\\b(continue|break|return)\\b" + + - special: "\\b(as|const|def|defer|enum|export|fn|is|let|match|static|struct|type|union|yield|_)\\b" + - preproc: "\\b(abort|alloc|append|assert|delete|free|insert|len|nullable|offset|size)\\b" + - preproc: "^use .+;" + - preproc: "\\@([a-zA-Z_][0-9a-zA-Z_]+)\\b" + + - constant: "\\b(false|null|true)\\b" + - constant.number: "\\b(0x[0-9A-Fa-f]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?)\\b" + - constant.number: "\\b(0o[0-7]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?)\\b" + - constant.number: "\\b(0b[01]+(i(8|16|32|64)?|u(8|16|32|64)?|z)?)\\b" + + - constant.specialChar: "\\\".*\\\"" + - constant.specialChar: "`.*`" + - constant.specialChar: "'([^'\\\\]|\\\\(0|a|b|f|n|r|t|v|\\\\|'|\\\"|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}))'" + + - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" + - symbol.brackets: "[(){}]|\\[|\\]" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + diff --git a/config/micro/syntax/haskell.yaml b/config/micro/syntax/haskell.yaml new file mode 100644 index 0000000..76d8051 --- /dev/null +++ b/config/micro/syntax/haskell.yaml @@ -0,0 +1,52 @@ +filetype: haskell + +detect: + filename: "\\.hs$" + +rules: + - symbol.operator: "[!#$%&:*+/<=>?@.\\\\^\\|~\\p{Sm}\\-]+" + + # Identifiers (with or without a module name) + - type: "\\b([A-Z][A-Za-z0-9_]*\\.)*[A-Z]+[A-Za-z0-9_']*\\b" + - default: "\\b([A-Z][A-Za-z0-9_]*\\.)*[a-z][A-Za-z0-9_']*\\b" + + - statement: ";" + - symbol.bracket: "[\\(\\)\\[\\]\\{\\}]" + - special: "`[A-Za-z0-9']+`" + + # Keywords + - statement: "\\b(case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix|infixl|infixr|instance|let|in|mdo|module|newtype|qualified|type|where)\\b" + + # Data constructors + - constant.bool: "\\b(True|False)\\b" + - constant: "\\b(Nothing|Just|Left|Right|LT|EQ|GT)\\b" + + - constant: "\\(\\)" # Unit + - constant.number: "\\b(0[xX][0-9A-Fa-f]+|0[oO][0-7]+|0[bB][01]+|[-]?[0-9]+([.][0-9]+)?([eE][+-]?[0-9]+)?)\\b" + + # Data classes + - identifier.class: "\\b(Additive|Applicative|Bounded|Data|Enum|Eq|Floating|Foldable|Fractional|Functor|Integral|Monad|MonadPlus|Monoid|Num|Ord|Read|Real|RealFloat|RealFrac|Semigroup|Show|Traversable|Typeable|Zip)[ ]" + + # Strings + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - special: "\\\\&" + - constant.specialChar: "\\\\([abfnrtv\"'\\\\]|[0-9]+|x[0-9a-fA-F]+|o[0-7]+|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC[1-4]|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL)" + + # Comments + - comment: + start: "--" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "\\{-" + end: "-\\}" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - identifier.macro: "undefined" diff --git a/config/micro/syntax/hc.yaml b/config/micro/syntax/hc.yaml new file mode 100644 index 0000000..9b94b0c --- /dev/null +++ b/config/micro/syntax/hc.yaml @@ -0,0 +1,52 @@ +filetype: hc + +detect: + filename: "(\\.(hc|HC)$|\\.(hh|HH)$|\\.ii?$|\\.(def)$)" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" + - type: "\\b(F64|I8|U8|I16|U16|I32|U32|I64|U64|sizeof|enum|U0|static|extern|struct|union|class|intern|public|argc|argv|asm)\\b" + + - statement: "\\b(for|if|while|do|else|case|default|switch)\\b" + - statement: "\\b(try|catch|throw|goto|continue|break|return)\\b" + - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|help_index|ifjit|ifaot|exe)" + + # Operator Color + - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" + - symbol.brackets: "[(){}]|\\[|\\]" + # Integer Constants + - constant.number: "(\\b([1-9][0-9]*|0[0-7]*|0[Xx][0-9A-Fa-f]+|0[Bb][01]+)([Uu]?[Ll][Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + # Decimal Floating Constants + - constant.number: "(\\b(([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)[FfLl]?\\b)" + # Hexadecimal Floating Constants + - constant.number: "(\\b0[Xx]([0-9A-Za-z]*[.][0-9A-Za-z]+|[0-9A-Za-z]+[.][0-9A-Za-z]*)[Pp][+-]?[0-9]+[FfLl]?\\b)" + - constant.number: "NULL" + - constant.number: "TRUE" + - constant.number: "FALSE" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/html.yaml b/config/micro/syntax/html.yaml new file mode 100644 index 0000000..d32339e --- /dev/null +++ b/config/micro/syntax/html.yaml @@ -0,0 +1,70 @@ +filetype: html + +detect: + filename: "\\.htm[l]?$" + +rules: + # Doctype is case-insensitive + - preproc: "" + # Opening tag + - symbol.tag: + start: "<(a|abbr|acronym|address|applet|area|article|aside|audio|b|base|bdi|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h[1-6]|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|main|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|section|select|small|source|span|strike|strong|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video|wbr)\\b" + end: ">" + rules: + - identifier: "\\b(placeholder|style|alt|bgcolor|height|href|id|(aria|data)\\-.+|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|target|type|value|width|class|charset|content|rel|integrity|crossorigin|for|onsubmit|lang|role)\\b" + - special: "\\b(required)\\b" + # Match double-quote strings + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string.url: "((ftp(s)?|http(s)?|git|chrome)://[^\\s]+)" + # Match single-quote strings + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string.url: "((ftp(s)?|http(s)?|git|chrome)://[^\\s]+)" + # Highlight the equals and any colon between words + - symbol: "\\b(=|:\\b)" + + # Closing tag + - symbol.tag: + start: "" + rules: + # Anything in the closing tag is an error + - error: "." + + # Reserved entities like a   and Ī + - special: "(([a-zA-Z]&#[0-9]+|&[a-zA-Z]+|&#[a-zA-Z0-9]+);)" + + # TODO: Add `limit-rules` to both the `default` rules below once it's implemented into Micro + - default: + start: "" + end: "" + limit-group: symbol.tag + rules: + - include: "javascript" + + - default: + start: "" + end: "" + limit-group: symbol.tag + rules: + - include: "css" + + # This weird empty comment thing is technically valid + - comment: "" + + - comment.block: + start: "" + rules: + - todo: "(FIXME|NOTE|TODO):?" + # While technically not a "true" error, these are recommended to not be used inside a comment + - error: "(\\-\\-|>)" diff --git a/config/micro/syntax/html4.yaml b/config/micro/syntax/html4.yaml new file mode 100644 index 0000000..c132d61 --- /dev/null +++ b/config/micro/syntax/html4.yaml @@ -0,0 +1,25 @@ +filetype: html4 + +detect: + filename: "\\.htm[l]?4$" + header: "" + +rules: + - error: "<[^!].*?>" + - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>" + - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>" + - preproc: "(?i)<[/]?(script|style)( .*)*?>" + - special: "&[^;[[:space:]]]*;" + - symbol: "[:=]" + - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)=" + - constant.string: "\"[^\"]*\"" + - constant.number: "(?i)#[0-9a-fA-F]{6,6}" + - default: + start: ">" + end: "<" + rules: [] + + - symbol.tag: "<|>" + - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+" + - comment: "" + - preproc: "" diff --git a/config/micro/syntax/html5.yaml b/config/micro/syntax/html5.yaml new file mode 100644 index 0000000..411d538 --- /dev/null +++ b/config/micro/syntax/html5.yaml @@ -0,0 +1,25 @@ +filetype: html5 + +detect: + filename: "\\.htm[l]?5$" + header: "" + +rules: + - error: "<[^!].*?>" + - symbol.tag: "(?i)<[/]?(a|a(bbr|ddress|rea|rticle|side|udio)|b|b(ase|d(i|o)|lockquote|r|utton)|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata|atalist|d|el|etails|fn|ialog|l|t)|em|embed|fieldset|fig(caption|ure)|form|iframe|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li|link|ma(in|p|rk)|menu|menuitem|met(a|er)|nav|noscript|o(bject|l|pt(group|ion)|utput)|p|param|picture|pre|progress|q|r(p|t|uby)|s|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u|ul|var|video|wbr)( .*)*?>" + - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>" + - preproc: "(?i)<[/]?(script|style)( .*)*?>" + - special: "&[^;[[:space:]]]*;" + - symbol: "[:=]" + - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)=" + - constant.string: "\"[^\"]*\"" + - constant.number: "(?i)#[0-9a-fA-F]{6,6}" + - default: + start: ">" + end: "<" + rules: [] + + - symbol.tag: "<|>" + - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+" + - comment: "" + - preproc: "" diff --git a/config/micro/syntax/ini.yaml b/config/micro/syntax/ini.yaml new file mode 100644 index 0000000..902d66a --- /dev/null +++ b/config/micro/syntax/ini.yaml @@ -0,0 +1,23 @@ +filetype: ini + +detect: + filename: "\\.(ini|desktop|lfl|override|tscn|tres)$|(mimeapps\\.list|pinforc|setup\\.cfg|project\\.godot)$|weechat/.+\\.conf$" + +rules: + - constant.bool.true: "\\btrue\\b" + - constant.bool.false: "\\bfalse\\b" + - identifier: "^[[:space:]]*[^=]*=" + - special: "^[[:space:]]*\\[.*\\]$" + - statement: "[=;]" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + - comment: + start: ";" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/inputrc.yaml b/config/micro/syntax/inputrc.yaml new file mode 100644 index 0000000..fb8ed06 --- /dev/null +++ b/config/micro/syntax/inputrc.yaml @@ -0,0 +1,14 @@ +filetype: inputrc + +detect: + filename: "inputrc$" + +rules: + - constant.bool.false: "\\b(off|none)\\b" + - constant.bool.true: "\\bon\\b" + - preproc: "\\bset|\\$include\\b" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - constant.specialChar: "\\\\.?" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/java.yaml b/config/micro/syntax/java.yaml new file mode 100644 index 0000000..8d298b9 --- /dev/null +++ b/config/micro/syntax/java.yaml @@ -0,0 +1,37 @@ +filetype: java + +detect: + filename: "\\.java$" + +rules: + - type: "\\b(boolean|byte|char|double|float|int|long|new|var|short|this|transient|void)\\b" + - statement: "\\b(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\\b" + - type: "\\b(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\\b" + - constant: "\\b(true|false|null)\\b" + - constant.number: "\\b[0-9]+\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - preproc: "..+" + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: [] + + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + diff --git a/config/micro/syntax/javascript.yaml b/config/micro/syntax/javascript.yaml new file mode 100644 index 0000000..dcf7442 --- /dev/null +++ b/config/micro/syntax/javascript.yaml @@ -0,0 +1,76 @@ +filetype: javascript + +detect: + filename: "(\\.(m|c)?js$|\\.es[5678]?$)" + header: "^#!.*/(env +)?node( |$)" + +rules: + - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b" + - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?" + - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?" + #- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" + # ^ this is not correct usage of the identifier color + - symbol.brackets: "[(){}]|\\[|\\]" + - symbol.operator: "([-+/*=<>!~%?:&|]|[.]{3})" + - statement: "\\b(async|await|break|case|catch|const|continue|debugger|default)\\b" + - statement: "\\b(delete|do|else|export|finally|for|function\\*?|class|extends)\\b" + - statement: "\\b(get|if|import|from|in|of|instanceof|let|new|reject|resolve|return)\\b" + - statement: "\\b(set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b" + # reserved but unassigned + - error: "\\b(enum|implements|interface|package|private|protected|public)\\b" + - constant: "\\b(globalThis|Infinity|null|undefined|NaN)\\b" + - constant: "\\b(null|undefined|NaN)\\b" + - constant: "\\b(true|false)\\b" + - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Generator|Map|Math)\\b" + - type: "\\b(Number|Object|Promise|Proxy|Reflect|RegExp|Set|String|Symbol|WeakMap|WeakSet)\\b" + - type: "\\b(BigInt64Array|BigUint64Array|Float32Array|Float64Array|Int16Array)\\b" + + # - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*" + - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]" + - comment: "^#!.*/(env +)?node( |$)" + + - identifier: "\\b(alert|decodeURI|decodeURIComponent|document|encodeURI|encodeURIComponent|escape|eval|isFinite|isNaN|parseFloat|parseInt|unescape|uneval|window)\\b" + - identifier: "\\b(Intl|WebAssembly)\\b" + - identifier: "\\b(Arguments)\\b" + + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "`" + end: "`" + rules: + - constant.specialChar: "\\\\." + - identifier: "\\x24\\{.*?\\}" + + - constant.bool: "\\b(true|false)\\b" + - constant.bool.false: "\\b(false)\\b" + - constant.bool.true: "\\b(true)\\b" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME)" + + - comment: + start: "/\\*" + end: "\\*/" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + # function documentation + - identifier: "\\s\\*\\s.*" + - todo: "(TODO|XXX|FIXME)" diff --git a/config/micro/syntax/jinja2.yaml b/config/micro/syntax/jinja2.yaml new file mode 100644 index 0000000..5579ccd --- /dev/null +++ b/config/micro/syntax/jinja2.yaml @@ -0,0 +1,19 @@ +filetype: jinja2 + +rules: + - include: "html" + - special: "({{|}}|{%-?|-?%})" + - default: + start: "({%-?|{{)" + end: "(-?%}|}})" + limit-group: special + rules: + - include: "python" + - statement: "\\b(ignore missing|with(out)? context|block|call|endblock|endcall|endfilter|endfor|endmacro|endraw|endset|extends|filter|for|include|macro|raw|recursive|scoped|set)\\b" + - identifier.builtinfunc: "\\b(attr|batch|capitalize|center|count|d|default|dictsort|e|escape|filesizeformat|first|forceescape|groupby|indent|join|last|length|lower|pprint|random|reject|rejectattr|replace|reverse|safe|select|selectattr|striptags|title|tojson|trim|truncate|unique|upper|urlencode|urlize|wordcount|wordwrap|xmlattr)\\b" + - identifier.builtintest: "\\b(callable|defined|divisibleby|eq|equalto|escaped|even|ge|gt|iterable|le|lower|lt|mapping|ne|none|number|odd|sameas|sequence|string|undefined|upper)\\b" + - identifier.defaultglobal: "\\b(lipsum|cycler|joiner|namespace)\\b" + - comment: + start: "{#" + end: "#}" + rules: [] diff --git a/config/micro/syntax/json.yaml b/config/micro/syntax/json.yaml new file mode 100644 index 0000000..f69a304 --- /dev/null +++ b/config/micro/syntax/json.yaml @@ -0,0 +1,39 @@ +filetype: json + +detect: + filename: "\\.json$" + header: "^\\{$" + +rules: + - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b" + - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?" + - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?" + - constant: "\\b(null)\\b" + - constant: "\\b(true|false)\\b" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:" + - constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/jsonnet.yaml b/config/micro/syntax/jsonnet.yaml new file mode 100644 index 0000000..928b78d --- /dev/null +++ b/config/micro/syntax/jsonnet.yaml @@ -0,0 +1,92 @@ +filetype: jsonnet + +detect: + filename: "\\.jsonnet$" + +# Spec: https://jsonnet.org/ref/spec.html + +rules: + # built-in objects + # FIXME: $ won't match + - constant: "\\b(self|\\$|super)\\b" + # boolean constants + - constant.bool: "\\b(null|true|false)\\b" + # the standard library + - identifier: "\\bstd\\.(extVar|thisFile|type|length|objectHas|objectFields|objectHasAll|objectFieldsAll|prune|mapWithKey|abs|sign|max|min|pow|exp|log|exponent|mantissa|floor|ceil|sqrt|sin|cos|tan|asin|acos|atan|mod|assertEqual|toString|codepoint|char|substr|findSubstr|startsWith|endsWith|split|splitLimit|strReplace|asciiUpper|asciiLower|stringChars|format|escapeStringDollars|escapeStringPython|parseInt|parseOctal|parseHex|parseJson|encodeUTF8|decodeUTF8|manifestIni|manifestPython|manifestPythonVars|manifestJsonEx|manifestYamlDoc|manifestYamlStream|manifestXmlJsonml|makeArray|count|find|map|mapWithIndex|filterMap|filter|foldl|foldr|range|join|lines|flattenArrays|sort|uniq|set|setInter|setUnion|setDiff|setMember|base64|base64DecodeBytes|base64Decode|md5|mergePatch|trace)\\b" + # unquoted object keys + - type: "[_a-zA-Z][_a-zA-Z0-9]*\\s*:" + # object key separator + - statement: ":" + # keywords + - statement: "\\b(assert|else|error|for|function|if|import|importstr|in|local|tailstrict|then)\\b" + # operators + - symbol.operator: "([.;,+*|=!\\%]|<|>|/|-|&)" + # parentheses + - symbol.brackets: "([(){}]|\\[|\\])" + # numbers + - constant.number: "\\b(0|([1-9][0-9]*))(\\.[0-9]+)?([eE][\\+-]?[0-9]+)?\\b" + + # double-quoted string + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\\"" + rules: + - constant.specialChar: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]" + + # single-quoted string + - constant.string: + start: "'" + end: "'" + skip: "\\\\'" + rules: + - constant.specialChar: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]" + + # double-quoted verbatim string + - constant.string: + start: "@\"" + end: "\"" + skip: "\\\\\"" + rules: + - constant.specialChar: "\\\\\"" + + # single-quoted verbatim string + - constant.string: + start: "@'" + end: "'" + skip: "\\\\'" + rules: + - constant.specialChar: "\\\\'" + + # block string + - constant.string: + # FIXME: + # This isn't quite right. + # The spec says this: + + # beginning with |||, followed by optional whitespace and a new-line. + # The next non-blank line must be prefixed with some non-zero length + # whitespace W. The block ends at the first subsequent line that does + # not begin with W, and it is an error if this line does not contain + # some optional whitespace followed by |||. + + # We need to match ^(\s+) on the first non-blank line after ||| + # Then we need to skip ^\1.*$ + + start: "\\|\\|\\| *$" + end: "^ *\\|\\|\\|" + rules: [] + + # multi-line comment + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + # single-line comment + - comment: + start: "#|(//)" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/julia.yaml b/config/micro/syntax/julia.yaml new file mode 100644 index 0000000..6555032 --- /dev/null +++ b/config/micro/syntax/julia.yaml @@ -0,0 +1,57 @@ +filetype: julia + +detect: + filename: "\\.jl$" + header: "^#!.*/(env +)?julia( |$)" + +rules: + + # built-in objects + - constant.bool: "\\b(true|false)\\b" + - constant: "\\b(nothing|missing)\\b" + # built-in attributes + - constant: "__[A-Za-z0-9_]+__" + # definitions + - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" + # keywords + - statement: "\\b(baremodule|begin|break|catch|const|continue|do|else|elseif|end|export|finally|for|function|global|if|import|let|local|macro|module|public|quote|return|struct|try|using|while)\\b" + - statement: "\\b(abstract\\s+type|primitive\\s+type|mutable\\s+struct)\\b" + # decorators + - identifier.macro: "@[A-Za-z0-9_]+" + # operators + - symbol.operator: "[:+*|=!%~<>/\\-?&\\\\÷∈∉∘]|\\b(in|isa|where)\\b" + # for some reason having ^ in the same regex with the other operators broke things + - symbol.operator: "\\^" + # parentheses + - symbol.brackets: "([(){}]|\\[|\\])" + # numbers + - constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*|Inf(16|32|64)?|NaN(16|32|64)?)\\b" + + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{1,4}|U[0-9A-Fa-f]{1,8})" + + # Lifted from Rust's syntax highlighting + - constant.string: "'(\\\\.|.)'" + - constant.string: + start: "'\"" + end: "'" + rules: [] + + - comment: + start: "#=" + end: "=#" + rules: [] + + - comment: + start: "#" + end: "$" + rules: [] diff --git a/config/micro/syntax/justfile.yaml b/config/micro/syntax/justfile.yaml new file mode 100644 index 0000000..926edb2 --- /dev/null +++ b/config/micro/syntax/justfile.yaml @@ -0,0 +1,40 @@ +# For more information, see https://github.com/casey/just +filetype: 'justfile' + +detect: + filename: "(^\\.?[Jj]ustfile|\\.just)$" + header: "^#!.*/(env +)?[bg]?just --justfile" + +rules: + - preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>" + - statement: "^(export|include|override)\\>" + - symbol.operator: "^[^:= ]+:" + - symbol.operator: "([=,%]|\\+=|\\?=|:=|&&|\\|\\|)" + - statement: "\\$\\((abspath|addprefix|addsuffix|and|basename|call|dir)[[:space:]]" + - statement: "\\$\\((error|eval|filter|filter-out|findstring|firstword)[[:space:]]" + - statement: "\\$\\((flavor|foreach|if|info|join|lastword|notdir|or)[[:space:]]" + - statement: "\\$\\((origin|patsubst|realpath|shell|sort|strip|suffix)[[:space:]]" + - statement: "\\$\\((value|warning|wildcard|word|wordlist|words)[[:space:]]" + # default functions - probably shouldn't be overwritten by assignment + - statement: "\\b(arch|os|os_family|env_var|invocation_directory|justfile|justfile_directory|just_executable|lowercase|quote|replace|trim|trim_end|trim_end|trim_end_match|trim_end_matches|trim_start|trim_start_match|trim_start_matches|uppercase)\\b" + - identifier: "^.+:" + - identifier: "[()$]" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))" + - identifier: "\\$[@^<*?%|+]|\\$\\([@^<*?%+-][DF]\\)" + - identifier: "\\$\\$|\\\\.?" + - comment: + start: "#" + end: "$" + rules: [] diff --git a/config/micro/syntax/keymap.yaml b/config/micro/syntax/keymap.yaml new file mode 100644 index 0000000..317a1ee --- /dev/null +++ b/config/micro/syntax/keymap.yaml @@ -0,0 +1,27 @@ +filetype: keymap + +detect: + filename: "\\.(k|key)?map$|Xmodmap$" + +rules: + - statement: "\\b(add|clear|compose|keycode|keymaps|keysym|remove|string)\\b" + - statement: "\\b(control|alt|shift)\\b" + - constant.number: "\\b[0-9]+\\b" + - special: "=" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - comment: + start: "^!" + end: "$" + rules: [] + diff --git a/config/micro/syntax/kickstart.yaml b/config/micro/syntax/kickstart.yaml new file mode 100644 index 0000000..359678e --- /dev/null +++ b/config/micro/syntax/kickstart.yaml @@ -0,0 +1,16 @@ +filetype: kickstart + +detect: + filename: "\\.ks$|\\.kickstart$" + +rules: + - special: "%[a-z]+" + - statement: "^[[:space:]]*(install|cdrom|text|graphical|volgroup|logvol|reboot|timezone|lang|keyboard|authconfig|firstboot|rootpw|user|firewall|selinux|repo|part|partition|clearpart|bootloader)" + - constant: "--(name|mirrorlist|baseurl|utc)(=|\\>)" + - statement: "\\$(releasever|basearch)\\>" + - brightblack: "^@[A-Za-z][A-Za-z-]*" + - brightred: "^-@[a-zA-Z0-9*-]+" + - red: "^-[a-zA-Z0-9*-]+" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/kotlin.yaml b/config/micro/syntax/kotlin.yaml new file mode 100644 index 0000000..5e28abd --- /dev/null +++ b/config/micro/syntax/kotlin.yaml @@ -0,0 +1,66 @@ +filetype: kotlin + +detect: + filename: "\\.kts?$" + +rules: + + # Operators + - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&) + + # Statements Keywords + - statement: \b(as|by|class|constructor|companion|const|fun|import|in|infix|interface|inline|is|out|operator|package|return|suspend|super|this|when|val|var)\b + - statement.properties: \b(get|set)\b + - statement.control: \b(break|continue|else|do|if|try|catch|finally|for|while)\b + - statement.class: \b(abstract|annotation|data|enum|final|open|sealed)\b + - statement.member: \b(override|lateinit|init)\b + - statement.access: \b(internal|private|protected|public)\b + - statement.parameter: \b(crossinline|noinline|reified|vararg)\b + + # Expression and types + - type: \b(dynamic|object|throw|typealias)\b + + # Meta + - statement.meta: \@(\bfile|delegate|field|get|property|receiver|set|setparam|param|)\b + + # Constant + - constant: \b(true|false|null) + - constant.number: ([0-9]+) + + # Storage Types + - type.storage: \b(Byte|UByte|Char|Double|Float|Int|UInt|Long|ULong|Short|UShort|Boolean|Unit|Nothing)\b + + # Collections + - type.collections: \b(Array)\b + + # String + - constant.string: + start: \" + end: \" + skip: \\. + rules: + - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\') + - constant.unicode: \\u\{[[:xdigit:]]+} + + # Shebang Line + - comment.shebang: ^(#!).* + + # Line Comment + - comment.line: "//.*" + + # Block Comment + - comment.block: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + # Doc Block Comment + - comment.block: + start: "/\\*\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + # Todo + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/kvlang.yaml b/config/micro/syntax/kvlang.yaml new file mode 100644 index 0000000..e40d348 --- /dev/null +++ b/config/micro/syntax/kvlang.yaml @@ -0,0 +1,67 @@ +filetype: "kvlang" + +detect: + filename: "\\.kv$" + +rules: +# layouts +- special: "\\b[a-z].+" +- identifier: "\\b(self|app|root)\\b" + +- type: "\\b[A-Z].+" +- type: "\\b(AnchorLayout|BoxLayout|FloatLayout|RelativeLayout|GridLayout|PageLayout|StackLayout)\\b" + +- type: "\\b(canvas)\\b" + +# functions +- identifier.function: "[a-zA-Z_0-9]+\\(" + +# built-in functions +- type: "\\b(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes)\\b" +- type: "\\b(callable|chr|classmethod|compile|copyright|credits|oct)\\b" +- type: "\\b(delattr|dict|dir|display|divmod|enumerate|eval|filter)\\b" +- type: "\\b(float|format|frozenset|get_ipython|getattr|globals|type)\\b" +- type: "\\b(hash|help|hex|id|input|int|isinstance|issubclass|iter|len)\\b" +- type: "\\b(license|list|locals|map|max|memoryview|min|next|object)\\b" +- type: "\\b(open|ord|pow|print|property|range|repr|reversed|round|set)\\b" +- type: "\\b(setattr|slice|sorted|staticmethod|hasattr|super|tuple|str)\\b" +- type: "\\b(vars|zip|exec|sum|complex)\\b" + +# keywords +- statement.built_in: "\\b(and|as|assert|async|await|break|class|continue|def)\\b" +- statement.built_in: "\\b(del|elif|else|except|finally|for|from|global|if)\\b" +- statement.built_in: "\\b(import|in|is|lambda|nonlocal|not|or|pass|raise)\\b" +- statement.built_in: "\\b(return|try|while|with|yield|match|case)\\b" + +# operators +- symbol.operator: "([~^.:;,+*|=!\\%]|<|>|/|-|&)" + +# parentheses +- symbol.brackets: "([(){}]|\\[|\\])" + +# numbers +- constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal +- constant.number: "\\b0b(_?[01])+\\b" # bin +- constant.number: "\\b0o(_?[0-7])+\\b" # oct +- constant.number: "\\b0x(_?[0-9a-f])+\\b" # hex + +- constant.bool.none: "\\b(None)\\b" +- constant.bool.true: "\\b(True)\\b" +- constant.bool.false: "\\b(False)\\b" + +# strings +- constant.string: + start: "\"" + end: "(\"|$)" + skip: "\\\\." + rules: [] +- constant.string: + start: "'" + end: "('|$)" + skip: "\\\\." + rules: [] + +- comment: + start: "#" + end: "$" + rules: [] diff --git a/config/micro/syntax/ledger.yaml b/config/micro/syntax/ledger.yaml new file mode 100644 index 0000000..0121ae0 --- /dev/null +++ b/config/micro/syntax/ledger.yaml @@ -0,0 +1,14 @@ +filetype: ledger + +detect: + filename: "(^|\\.|/)(ledger|ldgr|beancount|bnct)$" + +rules: + - special: "^([0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}|[=~]) .*" + - constant: "^[0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}" + - statement: "^~ .*" + - identifier.var: "^= .*" + - identifier: "^[[:space:]]+(![[:space:]]+)?\\(?[A-Za-z ]+(:[A-Za-z ]+)*\\)?" + - identifier: "^[[:space:]]+(![[:space:]]+)?\\(?[A-Za-z_\\-]+(:[A-Za-z_\\-]+)*\\)?" + - symbol: "[*!]" + - comment: "^[[:space:]]*;.*" diff --git a/config/micro/syntax/lfe.yaml b/config/micro/syntax/lfe.yaml new file mode 100644 index 0000000..a767a52 --- /dev/null +++ b/config/micro/syntax/lfe.yaml @@ -0,0 +1,17 @@ +filetype: lfe + +detect: + filename: "lfe$|\\.lfe$" + +rules: + - symbol.brackets: "\\(|\\)" + - type: "defun|define-syntax|define|defmacro|defmodule|export" + - constant: "\\ [A-Za-z][A-Za-z0-9_-]+\\ " + - symbol.operator: "\\(([\\-+*/<>]|<=|>=)|'" + - constant.number: "\\b[0-9]+\\b" + - constant.string: "\\\"(\\\\.|[^\"])*\\\"" + - special: "['|`][A-Za-z][A-Za-z0-9_\\-]+" + - constant.specialChar: "\\\\.?" + - comment: "(^|[[:space:]]);.*" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/lilypond.yaml b/config/micro/syntax/lilypond.yaml new file mode 100644 index 0000000..8023091 --- /dev/null +++ b/config/micro/syntax/lilypond.yaml @@ -0,0 +1,26 @@ +filetype: lilypond + +detect: + filename: "\\.ly$|\\.ily$|\\.lly$" + +rules: + - constant.number: "\\d+" + - identifier: "\\b(staff|spacing|signature|routine|notes|handler|corrected|beams|arpeggios|Volta_engraver|Voice|Vertical_align_engraver|Vaticana_ligature_engraver|VaticanaVoice|VaticanaStaff|Tweak_engraver|Tuplet_engraver|Trill_spanner_engraver|Timing_translator|Time_signature_performer|Time_signature_engraver|Tie_performer|Tie_engraver|Text_spanner_engraver|Text_engraver|Tempo_performer|Tab_tie_follow_engraver|Tab_staff_symbol_engraver|Tab_note_heads_engraver|TabVoice|TabStaff|System_start_delimiter_engraver|Stem_engraver|Stanza_number_engraver|Stanza_number_align_engraver|Staff_symbol_engraver|Staff_performer|Staff_collecting_engraver|StaffGroup|Staff|Spanner_break_forbid_engraver|Span_bar_stub_engraver|Span_bar_engraver|Span_arpeggio_engraver|Spacing_engraver|Slur_performer|Slur_engraver|Slash_repeat_engraver|Separating_line_group_engraver|Script_row_engraver|Script_engraver|Script_column_engraver|Score|Rhythmic_column_engraver|RhythmicStaff|Rest_engraver|Rest_collision_engraver|Repeat_tie_engraver|Repeat_acknowledge_engraver|Pure_from_neighbor_engraver|Pitched_trill_engraver|Pitch_squash_engraver|Piano_pedal_performer|Piano_pedal_engraver|Piano_pedal_align_engraver|PianoStaff|Phrasing_slur_engraver|PetrucciVoice|PetrucciStaff|Percent_repeat_engraver|Part_combine_engraver|Parenthesis_engraver|Paper_column_engraver|Output_property_engraver|Ottava_spanner_engraver|OneStaff|NullVoice|Note_spacing_engraver|Note_performer|Note_name_engraver|Note_heads_engraver|Note_head_line_engraver|NoteName\\|NoteHead|New_fingering_engraver|Multi_measure_rest_engraver|Midi_control_function_performer|Metronome_mark_engraver|Mensural_ligature_engraver|MensuralVoice|MensuralStaff|Mark_engraver|Lyrics|Lyric_performer|Lyric_engraver|Ligature_bracket_engraver|Ledger_line_engraver|Laissez_vibrer_engraver|Kievan_ligature_engraver|KievanVoice|KievanStaff|Key_performer|Key_engraver|Keep_alive_together_engraver|Instrument_switch_engraver|Instrument_name_engraver|Hyphen_engraver|Grob_pq_engraver|GregorianTranscriptionVoice|GregorianTranscriptionStaff|GrandStaff|Grace_spacing_engraver|Grace_engraver|Grace_beam_engraver|Grace_auto_beam_engraver|Global|Glissando_engraver|Fretboard_engraver|FretBoards|Forbid_line_break_engraver|Footnote_engraver|Font_size_engraver|Fingering_engraver|Fingering_column_engraver|Figured_bass_position_engraver|Figured_bass_engraver|FiguredBass|Extender_engraver|Episema_engraver|Dynamics|Dynamic_performer|Dynamic_engraver|Dynamic_align_engraver|Drum_notes_engraver|Drum_note_performer|DrumVoice|DrumStaff|Double_percent_repeat_engraver|Dots_engraver|Dot_column_engraver|Devnull|Default_bar_line_engraver|Custos_engraver|Cue_clef_engraver|CueVoice|Control_track_performer|Concurrent_hairpin_engraver|Collision_engraver|Cluster_spanner_engraver|Clef_engraver|Chord_tremolo_engraver|Chord_name_engraver|ChordNames|ChoirStaff|Breathing_sign_engraver|Break_align_engraver|Bend_engraver|Beam_performer|Beam_engraver|Beam_collision_engraver|Bar_number_engraver|Bar_engraver|Axis_group_engraver|Auto_beam_engraver|Arpeggio_engraver|Accidental_engraver|Score)\\b" + - statement: "[-_^]?\\\\[-A-Za-z_]+" + - preproc: "\\b(((gisis|gis|geses|ges|g|fisis|fis|feses|fes|f|eisis|eis|eeses|ees|e|disis|dis|deses|des|d|cisis|cis|ceses|ces|c|bisis|bis|beses|bes|b|aisis|ais|aeses|aes|a)[,']*[?!]?)|s|r|R|q)(128|64|32|16|8|4|2|1|\\\\breve|\\\\longa|\\\\maxima)?([^\\\\\\w]|_|\\b)" + - special: "[(){}<>]|\\[|\\]" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - comment: + start: "%\\{" + end: "%\\}" + rules: [] + - comment: + start: "%" + end: "$" + rules: [] + diff --git a/config/micro/syntax/lisp.yaml b/config/micro/syntax/lisp.yaml new file mode 100644 index 0000000..902d20f --- /dev/null +++ b/config/micro/syntax/lisp.yaml @@ -0,0 +1,17 @@ +filetype: lisp + +detect: + filename: "(emacs|zile)$|\\.(el|li?sp|scm|ss|rkt)$" + +rules: + - default: "\\([a-z-]+" + - symbol: "\\(([\\-+*/<>]|<=|>=)|'" + - constant.number: "\\b[0-9]+b>" + - special: "\\bnil\\b" + - preproc: "\\b[tT]b>" + - constant.string: "\\\"(\\\\.|[^\"])*\\\"" + - constant.specialChar: "'[A-Za-z][A-Za-z0-9_-]+" + - constant.specialChar: "\\\\.?" + - comment: "(^|[[:space:]]);.*" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/log.yaml b/config/micro/syntax/log.yaml new file mode 100644 index 0000000..34ef765 --- /dev/null +++ b/config/micro/syntax/log.yaml @@ -0,0 +1,92 @@ +filetype: log + +detect: + filename: "(\\.log|log\\.txt)$" + +rules: +- diff-modified: "\\b(WARN(ING)?|[Ww]arn(ing)?|w(r)?n|w|W/)\\b" +- diff-modified: "\\b(CRITICAL|[Cc]ritical)\\b" + +- constant: "\\b(INFO(RMATION)?|[Ii]nfo(rmation)?|[Ii]n(f)?|i|I/)\\b" +- constant: "\\b(DEBUG|[Dd]ebug|dbug|dbg|de|d|D/)\\b" +- constant: "\\b(VERBOSE|[Vv]erbose|V/)\\b" +- constant: "\\b(ALERT|[Aa]lert)\\b" + +- preproc: "\\b(TRACE|Trace|NOTICE|VERBOSE|verb|vrb|vb|v)\\b" + +- gutter-error: "\\b(ERROR|[Ee]rr(or)?|[Ee]r(or)?|e|E\\x2F)\\b" +- gutter-error: "\\b(FATAL|[Ff]atal)\\b" +- gutter-error: "\\b(EMERGENCY|[Ee]mergency)\\b" +- gutter-error: "\\b(FAIL(URE)?|[Ff]ail(ure)?)\\b" + +# constants +- constant.bool.true: "\\b(YES|yes|Y|y|ON|on|TRUE|True|true)\\b" +- constant.bool.false: "\\b(NO|no|N|n|OFF|off|FALSE|False|false)\\b" +- constant.bool.false: "\\b(None|null|nil)\\b" + +# numbers +- constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal +- constant.number: "\\b0b(_?[01])+\\b" # bin +- constant.number: "\\b0o(_?[0-7])+\\b" # oct +- constant.number: "\\b0x(_?[0-9a-f])+\\b" # hex + +# operators +- symbol.operator: "([~^.:;,+*|=!\\%]|<|>|/|-|&)" + +# parentheses +- symbol.brackets: "([(){}]|\\[|\\])" + +# string +- constant.string: + start: "\"" + end: "(\"|$)" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + +- constant.string: + start: "'" + end: "('|$)" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + +# file +- preproc: "\\b(FILE|File|file)\\b" + +# time +- identifier: "\\b((([Mm]on|[Tt]ues|[Ww]ed(nes)?|[Tt]hur(s)?|[Ff]ri|[Ss]at(ur)?|[Ss]un)(day)?\\s)?([Jj]an(uary)?|[Ff]eb(ruary)?|[Mm]ar(ch)?|[Aa]pr(il)?|[Mm]ay|[Jj]un(e)?|[Jj]ul(y)?|[Aa]ug(ust)?|[Aa]go|[Ss]ep(tember)?|[Oo]ct(ober)?|[Nn]ov(ember)?|[Dd]ec(ember)?)\\s\\d{1,2},?(\\s\\d{4})?)\\b" # date +- identifier: "\\b(\\d{2,4}[-/\\.]?\\d{2,3}[-/\\.]?\\d{2,4})\\b" # date +- identifier: "\\b(\\d{2}:\\d{2}(:\\d{2})?([\\.,]?\\d{1,8}[\\.\\+,]?\\d{1,8}?)?([\\.\\+,]?\\d{1,8}[\\.\\+,]?\\d{1,8}?)?([\\.\\+,]?\\d{1,8}?)?(\\s-\\d{0,4})?)\\b" # time +- identifier: "^([0-2][0-9][0-2][0-9][-/]?[0-9][0-9][-/]?[0-9][0-9])" +# - identifier: "^([0-2][0-9][0-2][0-9][-/]?[0-9][0-9][-/]?[0-9][0-9]\\s[0-9][0-9]:[0-9][0-9](:[0-9][0-9])?(\\.?[0-9][0-9][0-9])?)" +- identifier: "^(\\d{4}[-/]?\\d{2}[-/]?\\d{2}\\s\\d{2}:\\d{2}(:\\d{2})?(\\.?\\d{2,8})?)" +- identifier: "^([0-2][0-9]|[0-2]-?[0-9][0-9]-?[0-9][0-9])\\-([0-1][0-9])\\-([0-3][0-9]) ([0-2][0-9])\\:([0-5][0-9])\\:([0-5][0-9]),([0-9][0-9][0-9])" +# Complete precision: +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))" +# No milliseconds: +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))" +# No Seconds: +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))" +# Putting it all together: +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))" +# Complete precision: +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+)" +# No milliseconds +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d)" +# No Seconds +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d)" +# Putting it all together +- identifier: "^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+)|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d)|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d)" + +# link +- constant.string.url: + start: "https?://" + end: "\\s" + rules: [] + +# path +# - constant.string.url: "\\b(.+)/([^/]+)\\b" # linux +# - constant.string.url: "\\b(^[a-zA-Z]:)\\b" # windowns + +- diff-modified: "([Cc]ommit:)\\s\\w+\\[\\w+]" diff --git a/config/micro/syntax/lua.yaml b/config/micro/syntax/lua.yaml new file mode 100644 index 0000000..ddf0d05 --- /dev/null +++ b/config/micro/syntax/lua.yaml @@ -0,0 +1,111 @@ +filetype: lua + +detect: + filename: "\\.lua$" + +rules: + - statement: "\\b(do|end|while|break|repeat|until|if|elseif|then|else|for|in|function|local|return|goto)\\b" + - statement: "\\b(not|and|or)\\b" + - statement: "\\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\\b\\." + - statement: "\\b(_ENV|_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\\s*\\(" + - identifier: "io\\.\\b(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\\b" + - identifier: "math\\.\\b(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|maxinteger|min|mininteger|modf|pi|pow|rad|random|randomseed|sin|sqrt|tan|tointeger|type|ult)\\b" + - identifier: "os\\.\\b(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\\b" + - identifier: "package\\.\\b(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\\b" + - identifier: "string\\.\\b(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\\b" + - identifier: "table\\.\\b(concat|insert|maxn|move|pack|remove|sort|unpack)\\b" + - identifier: "utf8\\.\\b(char|charpattern|codes|codepoint|len|offset)\\b" + - identifier: "coroutine\\.\\b(create|isyieldable|resume|running|status|wrap|yield)\\b" + - identifier: "debug\\.\\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\\b" + - identifier: "bit32\\.\\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\\b" + - identifier: "\\:\\b(close|flush|lines|read|seek|setvbuf|write|byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\\b" + - identifier: "\\b(self|arg)\\b" + - constant: "\\b(false|nil|true)\\b" + - statement: "(\\b(dofile|require|include)|%q|%!|%Q|%r|%x)\\b" + + - symbol.brackets: "[(){}\\[\\]]" + - symbol: "(\\*|//|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|[\\.]{2,3}|#)" + + - constant.number: "\\b((0[xX](([0-9A-Fa-f]+\\.[0-9A-Fa-f]*)|(\\.?[0-9A-Fa-f]+))([pP][-+]?[0-9]+)?)|((([0-9]+\\.[0-9]*)|(\\.?[0-9]+))([eE][-+]?[0-9]+)?))" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([abfnrtvz\\'\"]|[0-9]{1,3}|x[0-9a-fA-F][0-9a-fA-F]|u\\{[0-9a-fA-F]+\\})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([abfnrtvz\\'\"]|[0-9]{1,3}|x[0-9a-fA-F][0-9a-fA-F]|u\\{[0-9a-fA-F]+\\})" + + - constant.string: + start: "\\[\\[" + end: "\\]\\]" + rules: [] + +# support first few lengths of "long brackets" explicitly +# brackets longer than that will give false positives + + - constant.string: + start: "\\[=\\[" + end: "\\]=\\]" + rules: [] + + - constant.string: + start: "\\[==\\[" + end: "\\]==\\]" + rules: [] + + - constant.string: + start: "\\[===\\[" + end: "\\]===\\]" + rules: [] + + - constant.string: + start: "\\[====+\\[" + end: "\\]====+\\]" + rules: [] + + - comment.block: + start: "\\-\\-\\[\\[" + end: "\\]\\]" + rules: + - todo: "(TODO|NOTE|FIXME):?" + +# support long brackets, same as with multiline strings + + - comment.block: + start: "\\-\\-\\[=\\[" + end: "\\]=\\]" + rules: + - todo: "(TODO|NOTE|FIXME):?" + + - comment.block: + start: "\\-\\-\\[==\\[" + end: "\\]==\\]" + rules: + - todo: "(TODO|NOTE|FIXME):?" + + - comment.block: + start: "\\-\\-\\[===\\[" + end: "\\]===\\]" + rules: + - todo: "(TODO|NOTE|FIXME):?" + + - comment.block: + start: "\\-\\-\\[====+\\[" + end: "\\]====+\\]" + rules: + - todo: "(TODO|NOTE|FIXME):?" + +# this has to go after block comment or block comment does not work + + - comment: + start: "\\-\\-" + end: "$" + rules: + - todo: "(TODO|NOTE|FIXME):?" diff --git a/config/micro/syntax/mail.yaml b/config/micro/syntax/mail.yaml new file mode 100644 index 0000000..6ffe873 --- /dev/null +++ b/config/micro/syntax/mail.yaml @@ -0,0 +1,25 @@ +filetype: mail + +detect: + filename: "(.*/mutt-.*|\\.eml)$" + header: "^From .* \\d+:\\d+:\\d+ \\d+" + +rules: + - type: "^From .*" + - identifier: "^[^[:space:]]+:" + - preproc: "^List-(Id|Archive|Subscribe|Unsubscribe|Post|Help):" + - constant: "^(To|From):" + - constant.string: + start: "^Subject:.*" + end: "$" + rules: + - constant.specialChar: "\\\\." + - statement: "?" + - default: + start: "^\\n\\n" + end: ".*" + rules: [] + - comment: + start: "^>.*" + end: "$" + rules: [] diff --git a/config/micro/syntax/make_headers.go b/config/micro/syntax/make_headers.go new file mode 100644 index 0000000..dba810c --- /dev/null +++ b/config/micro/syntax/make_headers.go @@ -0,0 +1,80 @@ +//go:build ignore +// +build ignore + +package main + +import ( + "bytes" + "fmt" + "os" + "strings" + "time" + + yaml "gopkg.in/yaml.v2" +) + +type HeaderYaml struct { + FileType string `yaml:"filetype"` + Detect struct { + FNameRgx string `yaml:"filename"` + HeaderRgx string `yaml:"header"` + SignatureRgx string `yaml:"signature"` + } `yaml:"detect"` +} + +type Header struct { + FileType string + FNameRgx string + HeaderRgx string + SignatureRgx string +} + +func main() { + if len(os.Args) > 1 { + os.Chdir(os.Args[1]) + } + files, _ := os.ReadDir(".") + for _, f := range files { + fname := f.Name() + if strings.HasSuffix(fname, ".yaml") { + convert(fname[:len(fname)-5]) + } + } +} + +func convert(name string) { + filename := name + ".yaml" + var hdr HeaderYaml + source, err := os.ReadFile(filename) + if err != nil { + panic(err) + } + err = yaml.Unmarshal(source, &hdr) + if err != nil { + panic(err) + } + encode(name, hdr) +} + +func encode(name string, c HeaderYaml) { + f, _ := os.Create(name + ".hdr") + f.WriteString(c.FileType + "\n") + f.WriteString(c.Detect.FNameRgx + "\n") + f.WriteString(c.Detect.HeaderRgx + "\n") + f.WriteString(c.Detect.SignatureRgx + "\n") + f.Close() +} + +func decode(name string) Header { + start := time.Now() + data, _ := os.ReadFile(name + ".hdr") + strs := bytes.Split(data, []byte{'\n'}) + var hdr Header + hdr.FileType = string(strs[0]) + hdr.FNameRgx = string(strs[1]) + hdr.HeaderRgx = string(strs[2]) + hdr.SignatureRgx = string(strs[3]) + fmt.Printf("took %v\n", time.Since(start)) + + return hdr +} diff --git a/config/micro/syntax/makefile.yaml b/config/micro/syntax/makefile.yaml new file mode 100644 index 0000000..7e90cde --- /dev/null +++ b/config/micro/syntax/makefile.yaml @@ -0,0 +1,38 @@ +filetype: makefile + +detect: + filename: "([Mm]akefile|\\.ma?k)$" + header: "^#!.*/(env +)?[bg]?make( |$)" + +rules: + - preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>" + - statement: "^(export|include|override)\\>" + - symbol.operator: "^[^:= ]+:" + - symbol.operator: "([=,%]|\\+=|\\?=|:=|&&|\\|\\|)" + - statement: "\\$\\((abspath|addprefix|addsuffix|and|basename|call|dir)[[:space:]]" + - statement: "\\$\\((error|eval|filter|filter-out|findstring|firstword)[[:space:]]" + - statement: "\\$\\((flavor|foreach|if|info|join|lastword|notdir|or)[[:space:]]" + - statement: "\\$\\((origin|patsubst|realpath|shell|sort|strip|suffix)[[:space:]]" + - statement: "\\$\\((value|warning|wildcard|word|wordlist|words)[[:space:]]" + - identifier: "^.+:" + - identifier: "[()$]" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))" + - identifier: "\\$[@^<*?%|+]|\\$\\([@^<*?%+-][DF]\\)" + - identifier: "\\$\\$|\\\\.?" + - comment: + start: "#" + end: "$" + rules: [] + diff --git a/config/micro/syntax/man.yaml b/config/micro/syntax/man.yaml new file mode 100644 index 0000000..8e26c66 --- /dev/null +++ b/config/micro/syntax/man.yaml @@ -0,0 +1,12 @@ +filetype: man + +detect: + filename: "\\.[1-9]x?$" + +rules: + - green: "\\.(S|T)H.*$" + - brightgreen: "\\.(S|T)H|\\.TP" + - brightred: "\\.(BR?|I[PR]?).*$" + - brightblue: "\\.(BR?|I[PR]?|PP)" + - brightwhite: "\\\\f[BIPR]" + - yellow: "\\.(br|DS|RS|RE|PD)" diff --git a/config/micro/syntax/markdown.yaml b/config/micro/syntax/markdown.yaml new file mode 100644 index 0000000..7ea4326 --- /dev/null +++ b/config/micro/syntax/markdown.yaml @@ -0,0 +1,49 @@ +filetype: markdown + +detect: + filename: "\\.(livemd|md|mkd|mkdn|markdown)$" + +rules: + # Tables (Github extension) + - type: ".*[ :]\\|[ :].*" + + # quotes + - statement: "^>.*" + + # Emphasis + - type: "(^|[[:space:]])(_[^ ][^_]*_|\\*[^ ][^*]*\\*)" + + # Strong emphasis + - type: "(^|[[:space:]])(__[^ ][^_]*__|\\*\\*[^ ][^*]*\\*\\*)" + + # strike-through + - type: "(^|[[:space:]])~~[^ ][^~]*~~" + + # horizontal rules + - special: "^(---+|===+|___+|\\*\\*\\*+)\\s*$" + + # headlines + - special: "^#{1,6}.*" + + # lists + - identifier: "^[[:space:]]*[\\*+-] |^[[:space:]]*[0-9]+\\. " + + # misc + - preproc: "(\\(([CcRr]|[Tt][Mm])\\)|\\.{3}|(^|[[:space:]])\\-\\-($|[[:space:]]))" + + # links + - constant: "\\[[^]]+\\]" + - constant: "\\[([^][]|\\[[^]]*\\])*\\]\\([^)]+\\)" + + # images + - underlined: "!\\[[^][]*\\](\\([^)]+\\)|\\[[^]]+\\])" + + # urls + - underlined: "https?://[^ )>]+" + + - special: "^```$" + + - special: + start: "`" + end: "`" + rules: [] diff --git a/config/micro/syntax/mc.yaml b/config/micro/syntax/mc.yaml new file mode 100644 index 0000000..bcf1177 --- /dev/null +++ b/config/micro/syntax/mc.yaml @@ -0,0 +1,23 @@ +# sendmail config files + +filetype: mc + +detect: + filename: "\\.mc$" + +rules: + - statement: "^(divert|VERSIONID|OSTYPE|DOMAIN|FEATURE|define)" + - statement: "^(DAEMON_OPTIONS|MAILER)" + - comment: + start: "#" + end: "$" + rules: [] + - comment: + start: "dnl" + end: "$" + rules: [] + - constant.string: + start: "`" + end: "'" + rules: [] + diff --git a/config/micro/syntax/meson.yaml b/config/micro/syntax/meson.yaml new file mode 100755 index 0000000..744abc2 --- /dev/null +++ b/config/micro/syntax/meson.yaml @@ -0,0 +1,51 @@ +filetype: meson + +detect: + filename: "(meson\\.build|meson_options\\.txt|meson\\.options)" + +rules: + + # refer to https://mesonbuild.com/Syntax.html + + - statement: "\\b(elif|else|if|endif)\\b" + - statement: "\\b(foreach|endforeach)\\b" + - statement: "\\b(continue|break)\\b" + - statement: "\\b(and|not|or|in)\\b" + + - symbol.operator: "[<>?:+*/-]|[+!<>=]?=" + - symbol.brackets: "[(){}\\[\\]]" + + - constant.number: "\\b(0|[1-9][0-9]*)\\b" # decimal + - constant.number: "\\b(0b[01]+)\\b" # bin + - constant.number: "\\b(0o[0-7]+)\\b" # oct + - constant.number: "\\b(0x[0-9a-fA-F]+)\\b" # hex + + # meson builtins + - identifier: "\\b(add_global_arguments|add_global_link_arguments|add_languages|add_project_arguments|add_project_dependencies)\\b" + - identifier: "\\b(add_project_link_arguments|add_test_setup|alias_target|assert|benchmark|both_libraries|build_machine|build_target|configuration_data)\\b" + - identifier: "\\b(configure_file|custom_target|debug|declare_dependency|dependency|disabler|environment|error|executable|files)\\b" + - identifier: "\\b(find_program|generator|get_option|get_variable|host_machine|import|include_directories|install_data|install_emptydir)\\b" + - identifier: "\\b(install_headers|install_man|install_subdir|install_symlink|is_disabler|is_variable|jar|join_paths|library|meson)\\b" + - identifier: "\\b(message|option|project|range|run_command|run_target|set_variable|shared_library|shared_module|static_library)\\b" + - identifier: "\\b(structured_sources|subdir|subdir_done|subproject|summary|target_machine|test|unset_variable|vcs_tag|warning)\\b" + + - constant.bool: "\\b(true|false)\\b" + + - comment: + start: "#" + end: "$" + rules: [] + + # multiline strings do not support escape sequences + - constant.string: + start: "'''" + end: "'''" + rules: [] + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\[abfnrtv\\\\']" + - constant.specialChar: "\\\\([0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|N\\{[^\\}]+\\})" diff --git a/config/micro/syntax/micro.yaml b/config/micro/syntax/micro.yaml new file mode 100644 index 0000000..276fb09 --- /dev/null +++ b/config/micro/syntax/micro.yaml @@ -0,0 +1,34 @@ +filetype: micro + +detect: + filename: "\\.(micro)$" + +rules: + - statement: "\\b(syntax|color(-link)?)\\b" + - statement: "\\b(start=|end=)\\b" + # Simple one-liners + - identifier: "\\b(default|number|statement|underlined|error|todo|statusline|indent-char|cursor\\-line|color\\-column|ignore|divider|tabbar)\\b" + # Separate identifiers to keep "complex" regex clean + - identifier: "\\b(special(Char)?)\\b" + - identifier: "\\b((current\\-)?line\\-number)\\b" + - identifier: "\\b(gutter\\-(info|error|warning){1})\\b" + - identifier: "\\b(comment(\\.bright)?)\\b" + - identifier: "\\b(symbol(\\.(brackets|operator|tag))?)\\b" + - identifier: "\\b(identifier(\\.(class|macro|var))?)\\b" + - identifier: "\\b(constant(\\.(bool(\\.(true|false){1})?|number|specialChar|string(\\.url)?){1})?)\\b" + - identifier: "\\b(preproc(\\.shebang)?)\\b" + - identifier: "\\b(type(\\.keyword)?)\\b" + - constant.number: "\\b(|h|A|0x)+[0-9]+(|h|A)+\\b" + - constant.number: "\\b0x[0-9 a-f A-F]+\\b" + - comment: + start: "#" + end: "$" + rules: + - todo: "(FIXME|TODO|NOTE):?" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.number: "#[0-9 A-F a-f]+" diff --git a/config/micro/syntax/mpdconf.yaml b/config/micro/syntax/mpdconf.yaml new file mode 100644 index 0000000..002ea6c --- /dev/null +++ b/config/micro/syntax/mpdconf.yaml @@ -0,0 +1,13 @@ +filetype: mpd + +detect: + filename: "mpd\\.conf$" + +rules: + - statement: "\\b(user|group|bind_to_address|host|port|plugin|name|type)\\b" + - statement: "\\b((music|playlist)_directory|(db|log|state|pid|sticker)_file)\\b" + - special: "^(input|audio_output|decoder)[[:space:]]*\\{|\\}" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/msbuild.yaml b/config/micro/syntax/msbuild.yaml new file mode 100644 index 0000000..2c79213 --- /dev/null +++ b/config/micro/syntax/msbuild.yaml @@ -0,0 +1,6 @@ +filetype: msbuild +detect: + filename: "\\.(.*proj|props|targets|tasks)$" + +rules: + - include: "xml" diff --git a/config/micro/syntax/nanorc.yaml b/config/micro/syntax/nanorc.yaml new file mode 100644 index 0000000..36ae25a --- /dev/null +++ b/config/micro/syntax/nanorc.yaml @@ -0,0 +1,16 @@ +filetype: nanorc + +detect: + filename: "\\.?nanorc$" + +rules: + - default: "(?i)^[[:space:]]*((un)?set|include|syntax|i?color).*$" + - type: "(?i)^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\\>|^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\\b" + - preproc: "(?i)^[[:space:]]*(set|unset|include|syntax|header)\\b" + - constant.bool.true: "(?i)(set)\\b" + - constant.bool.false: "(?i)(unset)\\b" + - identifier: "(?i)^[[:space:]]*(i)?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\\b" + - special: "(?i)^[[:space:]]*(i)?color\\b|\\b(start|end)=" + - constant.string: "\"(\\\\.|[^\"])*\"" + - comment: "^[[:space:]]*#.*$" + - comment.bright: "^[[:space:]]*##.*$" diff --git a/config/micro/syntax/nftables.yaml b/config/micro/syntax/nftables.yaml new file mode 100644 index 0000000..489fdb0 --- /dev/null +++ b/config/micro/syntax/nftables.yaml @@ -0,0 +1,30 @@ +filetype: nftables + +detect: + filename: "(nftables\\.(conf|rules)$|nftables(\\.rules)?\\.d/)" + header: "^(#!.*/(env +)?nft( |$)|flush +ruleset)" + +rules: + - type: "\\b(chain|counter|map|rule|ruleset|set|table)\\b" + - type: "\\b(ether|inet|i(cm)?p(x|(v?(4|6))?)|tcp|udp|8021q)\\b" + - special: "\\b(element(s)?|hook|policy|priority|type|state)\\b" + - identifier: "\\b(ct|iif|iifname|meta|oif|oifname|th|dport|sport|saddr|daddr|l4proto)\\b" + - statement: "\\b(accept|drop|goto|jump|log|masquerade|reject|limit|queue)\\b" + - preproc: "\\b(add|define|flush|include|delete)\\b" + - symbol.operator: "[<>.&|^!=:;,@]|\\b(and|ge|gt|le|lt|or|xor)\\b" + - constant.string: + start: "\"" + end: "\"" + rules: [] + # Integer Constants + - constant.number: "\\b([0-9]+)\\b" + - constant.number: "\\b(0x[0-9a-fA-F]+)\\b" + - identifier.var: "[$@][a-zA-Z_.][a-zA-Z0-9_/.-]*" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|FIXME):?" diff --git a/config/micro/syntax/nginx.yaml b/config/micro/syntax/nginx.yaml new file mode 100644 index 0000000..af4598b --- /dev/null +++ b/config/micro/syntax/nginx.yaml @@ -0,0 +1,22 @@ +filetype: nginx + +detect: + filename: "nginx.*\\.conf$|\\.nginx$|\\.sub(domain|folder)\\.conf$" + header: "^(server|upstream)[a-z ]*\\{$" + +rules: + - preproc: "\\b(events|server|http|location|upstream)[[:space:]]*\\{" + - statement: "(^|[[:space:]{;])(access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth_basic|auth_basic_user_file|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|default_type|deny|directio|directio_alignment|disable_symlinks|empty_gif|env|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|log_format|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|port_in_redirect|postpone_output|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_header|proxy_read_timeout|proxy_redirect|proxy_send_timeout|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|working_directory|xml_entities|xslt_stylesheet|xslt_types)([[:space:]]|$)" + - constant.bool.true: "\\b(on)\\b" + - constant.bool.false: "\\b(off)\\b" + - identifier: "\\$[A-Za-z][A-Za-z0-9_]*" + - symbol: "[*]" + - constant-string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - constant.string: + start: "'$" + end: "';$" + rules: [] + + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/nim.yaml b/config/micro/syntax/nim.yaml new file mode 100644 index 0000000..45f73d1 --- /dev/null +++ b/config/micro/syntax/nim.yaml @@ -0,0 +1,27 @@ +filetype: nim + +detect: + filename: "\\.nims?$|nim.cfg" + +rules: + - preproc: "[\\{\\|]\\b(atom|lit|sym|ident|call|lvalue|sideeffect|nosideeffect|param|genericparam|module|type|let|var|const|result|proc|method|iterator|converter|macro|template|field|enumfield|forvar|label|nk[a-zA-Z]+|alias|noalias)\\b[\\}\\|]" + - statement: "\\b(addr|and|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|div|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|in|include|interface|is|isnot|iterator|let|macro|method|mixin|mod|nil|not|notin|object|of|or|out|proc|ptr|raise|ref|return|shl|shr|static|template|try|tuple|type|using|var|when|while|with|without|xor|yield)\\b" + - statement: "\\b(deprecated|noSideEffect|constructor|destructor|override|procvar|compileTime|noReturn|acyclic|final|shallow|pure|asmNoStackFrame|error|fatal|warning|hint|line|linearScanEnd|computedGoto|unroll|immediate|checks|boundsChecks|overflowChecks|nilChecks|assertations|warnings|hints|optimization|patterns|callconv|push|pop|global|pragma|experimental|bitsize|volatile|noDecl|header|incompleteStruct|compile|link|passC|passL|emit|importc|importcpp|importobjc|codegenDecl|injectStmt|intdefine|strdefine|varargs|exportc|extern|bycopy|byref|union|packed|unchecked|dynlib|cdecl|thread|gcsafe|threadvar|guard|locks|compileTime)\\b" + - symbol.operator: "[=\\+\\-\\*/<>@\\$~&%\\|!\\?\\^\\.:\\\\]+" + - special: "\\{\\.|\\.\\}|\\[\\.|\\.\\]|\\(\\.|\\.\\)|;|,|`" + - statement: "\\.\\." + - type: "\\b(int|cint|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|enum|string|cstring|cstringArray|cdouble|csize_t|pointer|array|openarray|seq|varargs|tuple|object|set|void|auto|cshort|clong|range|nil|T|untyped|typedesc)\\b" + - type: "'[iI](8|16|32|64)?\\b|'[uU](8|16|32|64)?\\b|'[fF](32|64|128)?\\b|'[dD]\\b" + - constant.number: "\\b[0-9]+\\b" + - constant.number: "\\b0[xX][0-9A-Fa-f][0-9_A-Fa-f]+\\b" + - constant.number: "\\b0[ocC][0-7][0-7_]+\\b" + - constant.number: "\\b0[bB][01][01_]+\\b" + - constant.number: "\\b[0-9_]((\\.?)[0-9_]+)?[eE][+\\-][0-9][0-9_]+\\b" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - comment: "[[:space:]]*(?:[^\\\\]|^)#.*$" + - comment: + start: "\\#\\[" + end: "\\]\\#" + rules: [] + + - todo: "(TODO|FIXME|XXX):?" diff --git a/config/micro/syntax/nix.yaml b/config/micro/syntax/nix.yaml new file mode 100644 index 0000000..a60780a --- /dev/null +++ b/config/micro/syntax/nix.yaml @@ -0,0 +1,32 @@ +filetype: nix + +detect: + filename: "\\.nix$" + +rules: + - special: "\\b(Ellipsis|null|self|super|true|false|abort)\\b" + - statement: "\\b(let|in|with|import|rec|inherit)\\b" + - symbol.operator: "([~^.:;,+*|=!\\%@]|<|>|/|-|&)" + - symbol.brackets: "([(){}]|\\[|\\])" + + - constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" + + - constant.string: + start: "\"" + end: "\"" + rules: [] + + - constant.string: + start: "''" + end: "''" + rules: [] + + - comment: + start: "#" + end: "$" + rules: [] + + - comment: + start: "/\\*" + end: "\\*/" + rules: [] diff --git a/config/micro/syntax/nu.yaml b/config/micro/syntax/nu.yaml new file mode 100644 index 0000000..cdf7d1a --- /dev/null +++ b/config/micro/syntax/nu.yaml @@ -0,0 +1,110 @@ +filetype: nu + +detect: + filename: "\\.nu$" + +rules: + - symbol: "[-+/*=<>!~%?:&|]" + # https://www.nushell.sh/book/command_reference.html + - statement: "\\b(agg-groups|agg|alias|all-false|all-true|all?|ansi gradient)\\b" + - statement: "\\b(ansi strip|ansi|any?|append|append|arg-max)\\b" + - statement: "\\b(arg-min|arg-sort|arg-true|arg-unique|as-date)\\b" + - statement: "\\b(as-datetime|as|benchmark|build-string|cache|cal|cd)\\b" + - statement: "\\b(char|clear|col|collect|columns|compact|complete)\\b" + - statement: "\\b(concatenate|config|config env|config nu|contains)\\b" + - statement: "\\b(count|count-null|cp|cumulative|date format|date humanize)\\b" + - statement: "\\b(date list-timezone|date now|date to-record|date to-table)\\b" + - statement: "\\b(date to-timezone|date|db and|db as|db col|db collect)\\b" + - statement: "\\b(db describe|db fn|db from|db group-by|db join|db limit)\\b" + - statement: "\\b(db open|db or|db order-by|db over|db query|db schema)\\b" + - statement: "\\b(db select|db testing|db where|db|debug|decode)\\b" + - statement: "\\b(def-env|default|def|describe|describe|detect columns)\\b" + - statement: "\\b(df-not|do|drop|drop|drop column|drop nth|drop-duplicates)\\b" + - statement: "\\b(drop-nulls|dtypes|du|each while|each|echo|empty?)\\b" + - statement: "\\b(enter|env|error make|every|exec|exit|explode)\\b" + - statement: "\\b(export alias|export def|export def-env|export env)\\b" + - statement: "\\b(export extern|export|expr-not|extern|fetch|fill-na)\\b" + - statement: "\\b(fill-null|filter-with|find|first|flatten)\\b" + - statement: "\\b(fmt|format filesize|format|for|from csv|from eml)\\b" + - statement: "\\b(from ics|from ini|from json|from nuon|from ods|from ssv)\\b" + - statement: "\\b(from toml|from tsv|from url|from vcf|from xlsx|from xml)\\b" + - statement: "\\b(from yaml|from yml|from|get-day|get-hour|get-minute)\\b" + - statement: "\\b(get-month|get-nanosecond|get-ordinal|get-second|get-week)\\b" + - statement: "\\b(get-weekday|get-year|get|glob|grid|group-by)\\b" + - statement: "\\b(group|gstat|g|hash base64|hash md5|hash sha256|hash)\\b" + - statement: "\\b(headers|help|hide|histogram|history|if|ignore)\\b" + - statement: "\\b(inc|input|insert|into binary|into bool|into datetime|into decimal)\\b" + - statement: "\\b(into duration|into filesize|into int|into string|into)\\b" + - statement: "\\b(is-admin|is-duplicated|is-in|is-not-null)\\b" + - statement: "\\b(is-null|is-unique|join|keep|keep until)\\b" + - statement: "\\b(keep while|keybindings default|keybindings listen|keybindings list)\\b" + - statement: "\\b(keybindings|kill|last|length|let-env|let)\\b" + - statement: "\\b(lines|list|lit|load-env|ls|ls-df|match|math abs)\\b" + - statement: "\\b(math avg|math ceil|math eval|math floor|math max)\\b" + - statement: "\\b(math median|math min|math mode|math product|math round)\\b" + - statement: "\\b(math sqrt|math stddev|math sum|math variance|math|max)\\b" + - statement: "\\b(mean|median|melt|merge|metadata)\\b" + - statement: "\\b(min|mkdir|module|move|mv|n|n-unique|n-unique)\\b" + - statement: "\\b(nth|nu-highlight|open|open-df|otherwise|overlay)\\b" + - statement: "\\b(overlay add|overlay list|overlay new|overlay remove|p)\\b" + - statement: "\\b(par-each|parse|path basename|path dirname|path exists)\\b" + - statement: "\\b(path expand|path join|path parse|path relative-to|path split)\\b" + - statement: "\\b(path type|path|pivot|post|prepend|print|ps|quantile)\\b" + - statement: "\\b(quantile|query json|query web|query xml|query|random bool)\\b" + - statement: "\\b(random chars|random decimal|random dice|random integer)\\b" + - statement: "\\b(random uuid|random|range|reduce|register|reject|rename)\\b" + - statement: "\\b(replace|replace-all|reverse|reverse|rm|roll down)\\b" + - statement: "\\b(roll left|roll right|roll up|rolling|roll|rotate)\\b" + - statement: "\\b(run-external|sample|save|select|select|seq|seq char)\\b" + - statement: "\\b(seq date|set|set-with-idx|shape|shells|shift|shuffle)\\b" + - statement: "\\b(size|skip until|skip while|skip|sleep|slice|sort)\\b" + - statement: "\\b(sort-by|source|split chars|split column|split row)\\b" + - statement: "\\b(split-by|split|std|std|str camel-case|str capitalize)\\b" + - statement: "\\b(str collect|str contains|str downcase|str ends-with|str find-replace)\\b" + - statement: "\\b(str index-of|str kebab-case|str length|str lpad|str pascal-case)\\b" + - statement: "\\b(str replace|str reverse|str rpad|str screaming-snake-case)\\b" + - statement: "\\b(str snake-case|str starts-with|str substring|str title-case)\\b" + - statement: "\\b(str to-datetime|str to-decimal|str to-int|str trim|str upcase)\\b" + - statement: "\\b(str-lengths|str-slice|strftime|str|sum|sys|table)\\b" + - statement: "\\b(take until|take while|take|term size|to csv)\\b" + - statement: "\\b(to html|to json|to md|to nuon|to text|to toml|to tsv)\\b" + - statement: "\\b(to url|to xml|to yaml|to-csv|to-df|to-dummies|to-lazy)\\b" + - statement: "\\b(to-lowercase|to-nu|to-parquet|to-uppercase|touch|to)\\b" + - statement: "\\b(transpose|tutor|unalias|uniq|unique|update|update cells)\\b" + - statement: "\\b(upsert|url host|url path|url query|url scheme|url)\\b" + - statement: "\\b(use|value-counts|var|version|view-source|watch)\\b" + - statement: "\\b(when|where|which|window|with-column|with-env|wrap)\\b" + # https://www.nushell.sh/book/types_of_data.html#booleans + - constant: "\\b(false|true)\\b" + - constant.number: "\\b[-+]?([1-9][0-9])*\\b" + # https://www.nushell.sh/book/types_of_data.html#binary-data + - constant.number: "\\b[-+]?(0(x|b|o)\\[[0-9a-fA-F ]+\\])" + # https://www.nushell.sh/book/types_of_data.html#file-sizes + - constant.number: "\\b[-+]?([0-9]+[BbMmGgTtPp][i]?[Bb]?)?\\b" + # https://www.nushell.sh/book/types_of_data.html#duration + - constant.number: "\\b[-+]?([0-9]+[num]?[s])?\\b" + - constant.number: "\\b[-+]?([0-9]+(sec|min|hr|day|wk))?\\b" + # https://www.nushell.sh/book/types_of_data.html#dates + - constant.number: "\\b([0-9]+[-][0-9]+[-][0-9]+([T][0-9]+[:][0-9]+[:][0-9]+)?([\\+][0-9]+[:][0-9]+)?)\\b" + # https://www.nushell.sh/book/types_of_data.html#ranges + - constant.number: "([0-9]+(\\.\\.)[0-9]+)?" + # https://www.nushell.sh/book/types_of_data.html#open-ended-ranges + - constant.number: "((\\.\\.)[0-9]+)?" + - constant.number: "([0-9]+(\\.\\.))?" + - comment: + start: "#" + end: "$" + rules: + - todo: "(FIXME|TODO|NOTE):?" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." diff --git a/config/micro/syntax/objc.yaml b/config/micro/syntax/objc.yaml new file mode 100644 index 0000000..d4cccac --- /dev/null +++ b/config/micro/syntax/objc.yaml @@ -0,0 +1,60 @@ +filetype: objective-c + +detect: + filename: "\\.(m|mm|h)$" + signature: "(obj|objective)-c|#import|@(encode|end|interface|implementation|selector|protocol|synchronized|try|catch|finally|property|optional|required|import|autoreleasepool)" + +rules: + - type: "\\b(float|double|CGFloat|id|bool|BOOL|Boolean|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|Class|SEL|IMP|NS(U)?Integer)\\b" + - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b" + - type: "\\b[A-Z][A-Z][[:alnum:]]*\\b" + - type: "\\b[A-Za-z0-9_]*_t\\b" + - type: "\\bdispatch_[a-zA-Z0-9_]*_t\\b" + + - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__|__unused|_Nonnull|_Nullable|__block|__builtin.*)" + - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b" + - statement: "\\b(for|if|while|do|else|case|default|switch)\\b" + - statement: "\\b(try|throw|catch|operator|new|delete)\\b" + - statement: "\\b(goto|continue|break|return)\\b" + - statement: "\\b(nonatomic|atomic|readonly|readwrite|strong|weak|assign)\\b" + - statement: "@(encode|end|interface|implementation|class|selector|protocol|synchronized|try|catch|finally|property|optional|required|import|autoreleasepool)" + + - preproc: "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma).*$" + - preproc: "__[A-Z0-9_]*__" + + - special: "^[[:space:]]*[#|@][[:space:]]*(import|include)[[:space:]]*[\"|<].*\\/?[>|\"][[:space:]]*$" + + - statement: "([.:;,+*|=!\\%\\[\\]]|<|>|/|-|&)" + + - constant.number: "(\\b(-?)?[0-9]+\\b|\\b\\[0-9]+\\.[0-9]+\\b|\\b0x[0-9a-fA-F]+\\b)" + - constant: "(@\\[(\\\\.|[^\\]])*\\]|@\\{(\\\\.|[^\\}])*\\}|@\\((\\\\.|[^\\)])*\\))" + - constant: "\\b<(\\\\.[^\\>])*\\>\\b" + - constant: "\\b(nil|NULL|YES|NO|TRUE|true|FALSE|false|self)\\b" + - constant: "\\bk[[:alnum]]*\\b" + - constant.string: "'.'" + + - constant.string: + start: "@\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/ocaml.yaml b/config/micro/syntax/ocaml.yaml new file mode 100644 index 0000000..d7915e5 --- /dev/null +++ b/config/micro/syntax/ocaml.yaml @@ -0,0 +1,43 @@ +filetype: ocaml + +detect: + filename: "\\.mli?$" + +rules: + - identifier: "\\b[A-Z][0-9a-z_]{2,}\\b" + #declarations + - statement: "\\b(let|val|method|in|and|rec|private|virtual|constraint)\\b" + #structure items + - type: "\\b(type|open|class|module|exception|external)\\b" + #patterns + - statement: "\\b(fun|function|functor|match|try|with)\\b" + #patterns-modifiers + - statement: "\\b(as|when|of)\\b" + #conditions + - statement: "\\b(if|then|else)\\b" + #blocs + - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b" + - type: "'[0-9A-Za-z_]+" + #constantes + - constant.bool: "\\b(true|false)\\b" + #modules/classes + - special: "\\b(include|inherit|initializer)\\b" + #expr modifiers + - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b" + #character literal + - constant.string: "'(\\\\[0-7]{3}|\\\\x[A-Fa-f0-9]{2}|\\\\u[A-Fa-f0-9]{4}|\\\\U[A-Fa-f0-9]{8}|\\\\[abfnrtv'\\\"\\\\]|.)'" + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + #string literal + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + - comment: + start: "\\(\\*" + end: "\\*\\)" + rules: [] diff --git a/config/micro/syntax/octave.yaml b/config/micro/syntax/octave.yaml new file mode 100644 index 0000000..ce740a2 --- /dev/null +++ b/config/micro/syntax/octave.yaml @@ -0,0 +1,83 @@ +# References +# https://github.com/micro-editor/micro/blob/master/runtime/syntax/go.yaml +# https://github.com/vim-scripts/octave.vim--/blob/master/syntax/octave.vim +# +# TODO +# include only needed operators +# ... highlighting +# built-in function highlighting? +# highlight eps/pi/e etc. as functions when followed by () +# what are skip and error fields in strings? +# multiline comments not working + +filetype: octave + +detect: + filename: "\\.m$" + +rules: + # Statements https://www.gnu.org/software/octave/doc/v4.0.0/Statements.html + - statement: "\\b(function|endfunction|return|end|global|persistent)\\b" + - statement: "\\b(if|elseif|else|endif|switch|case|otherwise|endswitch)\\b" + - statement: "\\b(while|endwhile|do|until|for|endfor|parfor|endparfor|break|continue)\\b" + - statement: "\\b(unwind_protect|unwind_protect_cleanup|end_unwind_protect|try|catch|end_try_catch)\\b" + + # Operators + - symbol.operator: "[-+/*=<>!~%&|^]|:=" + + # Brackets + - symbol.brackets: "(\\{|\\})" + - symbol.brackets: "(\\(|\\))" + - symbol.brackets: "(\\[|\\])" + + # Commas + - symbol: "," + + # Numbers https://www.gnu.org/software/octave/doc/v4.0.1/Mathematical-Constants.html + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" + - constant.number: "\\b(pi|e|I|Inf|NaN|eps|realmax|realmin)\\b|" + + # Boolean + - constant.bool: "\\b(true|false)\\b" + + # Strings https://www.gnu.org/software/octave/doc/v4.0.1/Strings.html + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%" + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "%" + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + # Comments https://www.gnu.org/software/octave/doc/v4.2.1/Comments.html + - comment: + start: "%" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + - comment: + start: "%{" + end: "%}" + rules: + - todo: "(TODO|XXX|FIXME):?" + - comment: + start: "#{" + end: "#}" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/odin.yaml b/config/micro/syntax/odin.yaml new file mode 100644 index 0000000..1326356 --- /dev/null +++ b/config/micro/syntax/odin.yaml @@ -0,0 +1,64 @@ +filetype: odin + +detect: + filename: "\\.odin$" + +rules: + # Conditionals and control flow + - special: "\\b(asm|auto_cast|break|case|cast|context|continue|do|dynamic|fallthrough|return|transmute|using|where)\\b" + - statement: "\\b(else|for|if|switch|in|not_in|or_else|or_return|when)\\b" + - preproc: "\\b(assert|package|foreign|import|proc|defer|make|new|free|delete|copy|len|cap|append|raw_data)\\b" + - preproc: "\\b((size|align|offset|type|type_info|typeid)_of|offset_of_by_string)\\b" + - preproc: "\\b(swizzle|complex|quaternion|real|imag|jmag|kmag|conj|expand_to_tuple|min|max|abs|clamp|soa_zip|soa_unzip|transpose|outer_product|hadamard_product|matrix_flatten)\\b" + - symbol.operator: "[-+/*=<>!~%&|^@]|:\\s*=|:\\s*:|\\?" + + # Types + - symbol: "(,|\\.)" + - type: "\\b(b(8|16|32|64)|(i|u)(8|(16|32|64|128)(le|be)?)|f(16|32|64)(le|be)?|complex(32|64|128)|quaternion(64|128|256))\\b" + - type: "\\b(any|bool|byte|rune|u?int|uintptr|rawptr|c?string|map|matrix|typeid)\\b" + - type.keyword: "\\b(distinct|struct|enum|union|bit_set)\\b" + - constant.bool: "\\b(true|false|nil)\\b" + + # Brackets + - symbol.brackets: "(\\{|\\})" + - symbol.brackets: "(\\(|\\))" + - symbol.brackets: "(\\[|\\])" + + # Numbers and strings + - constant.number: "\\b(0b[01]*|0o[0-7]*|0x[0-9a-fA-F]*|[0-9_]+|0d[0-9]*|0z[0-9abAB]*)\\b|'.'" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" + + - constant.string: + start: "`" + end: "`" + rules: [] + + - comment: + start: "//" + end: "$" + rules: + - todo: "TODO:?|NOTE(\\(.*\\))?:?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "TODO:?|NOTE(\\(.*\\))?:?" diff --git a/config/micro/syntax/pascal.yaml b/config/micro/syntax/pascal.yaml new file mode 100644 index 0000000..ca6a416 --- /dev/null +++ b/config/micro/syntax/pascal.yaml @@ -0,0 +1,45 @@ +filetype: pascal + +detect: + filename: "\\.pas$" + +rules: + - type: "\\b(?i:(string|ansistring|widestring|shortstring|char|ansichar|widechar|boolean|byte|shortint|word|smallint|longword|cardinal|longint|integer|int64|single|currency|double|extended))\\b" + - statement: "\\b(?i:(and|asm|array|begin|break|case|const|constructor|continue|destructor|div|do|downto|else|end|file|for|function|goto|if|implementation|in|inline|interface|label|mod|not|object|of|on|operator|or|packed|procedure|program|record|repeat|resourcestring|set|shl|shr|then|to|type|unit|until|uses|var|while|with|xor))\\b" + - statement: "\\b(?i:(as|class|dispose|except|exit|exports|finalization|finally|inherited|initialization|is|library|new|on|out|property|raise|self|threadvar|try))\\b" + - statement: "\\b(?i:(absolute|abstract|alias|assembler|cdecl|cppdecl|default|export|external|forward|generic|index|local|name|nostackframe|oldfpccall|override|pascal|private|protected|public|published|read|register|reintroduce|safecall|softfloat|specialize|stdcall|virtual|write))\\b" + - constant: "\\b(?i:(false|true|nil))\\b" + - special: + start: "asm" + end: "end" + rules: [] + - constant.number: "\\$[0-9A-Fa-f]+" + - constant.number: "\\b[+-]?[0-9]+([.]?[0-9]+)?(?i:e[+-]?[0-9]+)?" + - constant.string: + start: "#[0-9]{1,}" + end: "$" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - preproc: + start: "{\\$" + end: "}" + rules: [] + - comment: + start: "//" + end: "$" + rules: [] + - comment: + start: "\\(\\*" + end: "\\*\\)" + rules: [] + - comment: + start: "({)(?:[^$])" + end: "}" + rules: [] + diff --git a/config/micro/syntax/patch.yaml b/config/micro/syntax/patch.yaml new file mode 100644 index 0000000..996bdc3 --- /dev/null +++ b/config/micro/syntax/patch.yaml @@ -0,0 +1,14 @@ +filetype: patch + +detect: + filename: "\\.(patch|diff)$" + header: "^diff" + +rules: + - brightgreen: "^\\+.*" + - green: "^\\+\\+\\+.*" + - brightblue: "^ .*" + - brightred: "^-.*" + - red: "^---.*" + - brightyellow: "^@@.*" + - magenta: "^diff.*" diff --git a/config/micro/syntax/peg.yaml b/config/micro/syntax/peg.yaml new file mode 100644 index 0000000..0b8d1ed --- /dev/null +++ b/config/micro/syntax/peg.yaml @@ -0,0 +1,16 @@ +filetype: peg + +detect: + filename: "\\.l?peg$" + +rules: + - identifier: "^[[:space:]]*[A-Za-z][A-Za-z0-9_]*[[:space:]]*<-" + - constant.number: "\\^[+-]?[0-9]+" + - symbol.operator: "[-+*?^/!&]|->|<-|=>" + - identifier.var: "%[A-Za-z][A-Za-z0-9_]*" + - special: "\\[[^]]*\\]" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - comment: "(^|[[:space:]])\\-\\-.*$" + - todo: "TODO:?" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/perl.yaml b/config/micro/syntax/perl.yaml new file mode 100644 index 0000000..2b01b89 --- /dev/null +++ b/config/micro/syntax/perl.yaml @@ -0,0 +1,58 @@ +filetype: perl + +detect: + filename: "\\.p[lmp]$" + header: "^#!.*/(env +)?perl( |$)" + +rules: + - type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|homp|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\\b|\\b(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\\b|\\b(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|say|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\\b|\\b(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\\b|\\b(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b" + - statement: "\\b(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\\b" + + - special: "\\-\\>" + - symbol: "(,|\\.)" + + #regexes + - identifier.macro: "m?\\/.*?\\/[a-z]*" + - identifier.macro: "m?\\|.*?\\|[a-z]*" + - identifier.macro: "\\bs/.*?/.*?/[a-z]*" + - identifier.macro: "\\bs\\|.*?\\|.*?\\|[a-z]*" + + - constant.string: + start: '"' + end: '"' + skip: '\\"' + rules: + - identifier.var: '[\\$@%].[a-zA-Z0-9_]*' + + - constant.string: + start: "'" + end: "'" + skip: "\\\\'" + rules: [] + + - comment: + start: "#" + end: "$" + rules: [] + + - constant.string: "\"\\(.*\\)\"|qq?\\|.*\\||qq?\\{.*\\}|qq?\\/.*\\/" + - constant.number: "\\b([0-9]*[.])?[0-9]+" + - constant.number: "\\b[0-9]+" + - constant.number: "\\b0x[a-f0-9]+" + - constant.string.url: "`(.+?)`" + - identifier.var: '[\\$@%].[a-zA-Z0-9_]*' + + - preproc: + start: "(^use| = new)" + end: ";" + rules: [] + + - comment: + start: "^=" + end: "^=cut" + rules: [] + + - identifier.macro: + start: "<< 'STOP'" + end: "STOP" + rules: [] diff --git a/config/micro/syntax/php.yaml b/config/micro/syntax/php.yaml new file mode 100644 index 0000000..eb8cbdc --- /dev/null +++ b/config/micro/syntax/php.yaml @@ -0,0 +1,60 @@ +filetype: php + +detect: + filename: "\\.php[2345s~]?$" + +rules: + - symbol.operator: "<|>" + - error: "<[^!].*?>" + - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>" + - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>" + - preproc: "(?i)<[/]?(script|style)( .*|>)*?>" + - preproc: "<\\?(php|=)?" + - preproc: "\\?>" + - preproc: "" + - special: "&[^;[[:space:]]]*;" + - symbol: "[:=]" + - identifier: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)=" + - constant.number: "(?i)#[0-9a-fA-F]{6,6}" + - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+" + - comment: "" + - default: "<\\?(php|=)\" end=\"\\?>" + - identifier.class: "([a-zA-Z0-9_-]+)\\(" + - type: "\\b(array|bool|callable|float|int|iterable|object|mixed|string|void)\\b" + - identifier.class: "[a-zA-Z\\\\]+::" + - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b" + - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]" + - type.keyword: "\\b(global|final|public|private|protected|static|const|var)\\b" + - statement: "\\b(abstract|catch|class|declare|do|else(if)?|end(declare|for(each)?|if|switch|while)|enum|finally|for(each)|function|if|interface|namespace|switch|trait|try|while)\\b" + - identifier: "\\bnew\\s+([a-zA-Z0-9\\\\]+)" + - special: "\\b(as|and|break|case|clone|continue|default|die|fn|echo|empty|eval|exit|extends|goto|or|include(_once)?|implements|instanceof|insteadof|isset|list|match|new|print|return|require(_once)?|unset|use|throw|xor|yield(\\s+from))\\b" + - constant.bool: "\\b(true|false|null|TRUE|FALSE|NULL)\\b" + - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]" + - constant.number: "[0-9]" + - identifier: "(\\$this|parent|self|\\$this->)" + - symbol.operator: "(=>|===|!==|==|!=|&&|\\|\\||::|=|->|\\!)" + - identifier.var: "(\\$[a-zA-Z0-9\\-_]+)" + - symbol.operator: "[\\(|\\)|/|+|\\-|\\*|\\[|.|,|;]" + - symbol.brackets: "(\\[|\\]|\\{|\\}|[()])" + + - comment: + start: "(^|[[:space:]])*(//|#)" + end: "$" + rules: [] + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" diff --git a/config/micro/syntax/pkg-config.yaml b/config/micro/syntax/pkg-config.yaml new file mode 100644 index 0000000..8a2b56a --- /dev/null +++ b/config/micro/syntax/pkg-config.yaml @@ -0,0 +1,12 @@ +filetype: pc + +detect: + filename: "\\.pc$" + +rules: + - preproc: "^(Name|Description|URL|Version|Conflicts|Cflags):" + - preproc: "^(Requires|Libs)(\\.private)?:" + - symbol.operator: "=" + - identifier.var: "\\$\\{[A-Za-z_][A-Za-z0-9_]*\\}" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/po.yaml b/config/micro/syntax/po.yaml new file mode 100644 index 0000000..7b157fb --- /dev/null +++ b/config/micro/syntax/po.yaml @@ -0,0 +1,12 @@ +filetype: po + +detect: + filename: "\\.pot?$" + +rules: + - preproc: "\\b(msgid|msgstr)\\b" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - special: "\\\\.?" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/pony.yaml b/config/micro/syntax/pony.yaml new file mode 100644 index 0000000..214f11d --- /dev/null +++ b/config/micro/syntax/pony.yaml @@ -0,0 +1,37 @@ +filetype: pony + +detect: + filename: "\\.pony$" + +rules: + - statement: "\\b(type|interface|trait|primitive|class|struct|actor)\\b" + - statement: "\\b(compiler_intrinsic)\\b" + - statement: "\\b(use)\\b" + - statement: "\\b(var|let|embed)\\b" + - statement: "\\b(new|be|fun)\\b" + - statement: "\\b(iso|trn|ref|val|box|tag|consume)\\b" + - statement: "\\b(break|continue|return|error)\\b" + - statement: "\\b(if|then|elseif|else|end|match|where|try|with|as|recover|object|lambda|as|digestof|ifdef)\\b" + - statement: "\\b(while|do|repeat|until|for|in)\\b" + - statement: "(\\?|=>)" + - statement: "(\\||\\&|\\,|\\^)" + - symbol.operator: "(\\-|\\+|\\*|/|\\!|%|<<|>>)" + - symbol.operator: "(==|!=|<=|>=|<|>)" + - statement: "\\b(is|isnt|not|and|or|xor)\\b" + - type: "\\b(_*[A-Z][_a-zA-Z0-9\\']*)\\b" + - constant: "\\b(this)\\b" + - constant.bool: "\\b(true|false)\\b" + - constant.number: "\\b((0b[0-1_]*)|(0o[0-7_]*)|(0x[0-9a-fA-F_]*)|([0-9_]+(\\.[0-9_]+)?((e|E)(\\\\+|-)?[0-9_]+)?))\\b" + - constant.string: "\"(\\\\.|[^\"])*\"" + - comment: + start: "\"\"\"[^\"]*" + end: "\"\"\"" + rules: [] + + - comment: "(^|[[:space:]])//.*" + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + + - todo: "TODO:?" diff --git a/config/micro/syntax/pov.yaml b/config/micro/syntax/pov.yaml new file mode 100644 index 0000000..ddf8496 --- /dev/null +++ b/config/micro/syntax/pov.yaml @@ -0,0 +1,21 @@ +filetype: pov + +detect: + filename: "\\.(pov|POV|povray|POVRAY)$" + +rules: + - preproc: "^[[:space:]]*#[[:space:]]*(declare)" + - statement: "\\b(sphere|cylinder|translate|matrix|rotate|scale)\\b" + - statement: "\\b(orthographic|location|up|right|direction|clipped_by)\\b" + - statement: "\\b(fog_type|fog_offset|fog_alt|rgb|distance|transform)\\b" + - identifier: "^\\b(texture)\\b" + - identifier: "\\b(light_source|background)\\b" + - identifier: "\\b(fog|object|camera)\\b" + - symbol.operator: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)" + - special: "\\b(union|group|subgroup)\\b" + - comment: "//.*" + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + diff --git a/config/micro/syntax/privoxy-action.yaml b/config/micro/syntax/privoxy-action.yaml new file mode 100644 index 0000000..6ecb877 --- /dev/null +++ b/config/micro/syntax/privoxy-action.yaml @@ -0,0 +1,14 @@ +filetype: privoxy-action + +detect: + filename: "\\.action$" + +rules: + - constant.bool.false: "[{[:space:]]\\-block([[:space:]{}]|$)" + - constant.bool.true: "[{[:space:]]\\+block([[:space:]{}]|$)" + - constant.bool.false: "-(add-header|change-x-forwarded-for|client-header-filter|client-header-tagger|content-type-overwrite|crunch-client-header|crunch-if-none-match|crunch-incoming-cookies|crunch-outgoing-cookies|crunch-server-header|deanimate-gifs|downgrade-http-version|fast-redirects|filter|force-text-mode|forward-override|handle-as-empty-document|handle-as-image|hide-accept-language|hide-content-disposition|hide-from-header|hide-if-modified-since|hide-referrer|hide-user-agent|limit-connect|overwrite-last-modified|prevent-compression|redirect|server-header-filter|server-header-tagger|session-cookies-only|set-image-blocker)" + - constant.bool.true: "\\+(add-header|change-x-forwarded-for|client-header-filter|client-header-tagger|content-type-overwrite|crunch-client-header|crunch-if-none-match|crunch-incoming-cookies|crunch-outgoing-cookies|crunch-server-header|deanimate-gifs|downgrade-http-version|fast-redirects|filter|force-text-mode|forward-override|handle-as-empty-document|handle-as-image|hide-accept-language|hide-content-disposition|hide-from-header|hide-if-modified-since|hide-referrer|hide-user-agent|limit-connect|overwrite-last-modified|prevent-compression|redirect|server-header-filter|server-header-tagger|session-cookies-only|set-image-blocker)" + - constant.specialChar: "\\\\.?" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/privoxy-config.yaml b/config/micro/syntax/privoxy-config.yaml new file mode 100644 index 0000000..7eb0898 --- /dev/null +++ b/config/micro/syntax/privoxy-config.yaml @@ -0,0 +1,10 @@ +filetype: privoxy-config + +detect: + filename: "privoxy/config$" + +rules: + - statement: "(accept-intercepted-requests|actionsfile|admin-address|allow-cgi-request-crunching|buffer-limit|compression-level|confdir|connection-sharing|debug|default-server-timeout|deny-access|enable-compression|enable-edit-actions|enable-remote-http-toggle|enable-remote-toggle|enforce-blocks|filterfile|forward|forwarded-connect-retries|forward-socks4|forward-socks4a|forward-socks5|handle-as-empty-doc-returns-ok|hostname|keep-alive-timeout|listen-address|logdir|logfile|max-client-connections|permit-access|proxy-info-url|single-threaded|socket-timeout|split-large-forms|templdir|toggle|tolerate-pipelining|trustfile|trust-info-url|user-manual)[[:space:]]" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/privoxy-filter.yaml b/config/micro/syntax/privoxy-filter.yaml new file mode 100644 index 0000000..5213938 --- /dev/null +++ b/config/micro/syntax/privoxy-filter.yaml @@ -0,0 +1,12 @@ +filetype: privoxy-filter + +detect: + filename: "\\.filter$" + +rules: + - statement: "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER): [a-z-]+" + - identifier: "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER):" + - constant.specialChar: "\\\\.?" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/proto.yaml b/config/micro/syntax/proto.yaml new file mode 100644 index 0000000..01e2ee0 --- /dev/null +++ b/config/micro/syntax/proto.yaml @@ -0,0 +1,40 @@ +filetype: proto + +detect: + filename: "(\\.(proto)$$)" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" + - type: "\\b(int(8|16|32|64))|string|bytes|repeated|bool|required|map|optional|oneof|union\\b" + - statement: "\\b(import|service|enum|syntax|package|option|message|rpc|returns|extensions|to)\\b" + - constant: "'\\\\(([0-3]?[0-7]{1,2}))'" + - constant: "'\\\\x[0-9A-Fa-f]{1,2}'" + - symbol.brackets: "[(){}]|\\[|\\]" + - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - preproc: "..+" + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/prql.yaml b/config/micro/syntax/prql.yaml new file mode 100644 index 0000000..e05aaa9 --- /dev/null +++ b/config/micro/syntax/prql.yaml @@ -0,0 +1,84 @@ +# https://prql-lang.org/ +# https://github.com/PRQL/prql +filetype: prql + +detect: + filename: "\\.prql$" + +rules: + - statement: "\\b(let|module|into|case|type|func)\\b" + + # Types + - type: "\\b(u?int(8|16|32|64)?|float(32|64)|bool|text|date|time|timestamp)\\b" + - type.keyword: "\\b(enum)\\b" + - constant.bool: "\\b(true|false|null|this|that)\\b" + + # Built-in functions + - identifier: "\\b(abs|floor|ceil|pi|exp|ln|log10|log|sqrt|degrees|radians|cos|acos|sin|asin|tan|atan|pow|round)\\b" # Math module + - identifier: "\\b(min|max|sum|average|stddev|all|any|concat_array|count)\\b" # Aggregate functions + - identifier: "\\b(lag|lead|first|last|rank|rank_dense|row_number)\\b" # Window functions + - identifier: "\\b(tuple_every|tuple_map|tuple_zip|_eq|_is_null)\\b" # Tuple functions + - identifier: "\\b(as|in|from_text)\\b" # Misc + - identifier: "\\b(lower|upper|ltrim|rtrim|trim|length|extract|replace|starts_with|contains|ends_with)\\b" # Text module + - identifier: "\\b(to_text)\\b" # Date module + - identifier: "\\b(read_parquet|read_csv)\\b" # File-reading functions + + # Modules + - identifier.class: "\\b(math|text|date|prql)\\b" + + # Transforms + - statement: "\\b(aggregate|derive|filter|from|group|join|select|sort|take|window)\\b" + + # Operators + - symbol.operator: "([~^.:;,+*|=!\\%@?]|<|>|/|-|&)" + + # Brackets + - symbol.brackets: "[{}()\\[\\]]" + + # Numbers + - constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal + - constant.number: "\\b0b(_?[01])+\\b" # bin + - constant.number: "\\b0o(_?[0-7])+\\b" # oct + - constant.number: "\\b0x(_?[0-9a-fA-F])+\\b" # hex + - constant: "\\b[0-9]+(years|months|weeks|days|hours|minutes|seconds|milliseconds|microseconds)\\b" + + - constant.string: + start: "[frs]?\"\"\"" + end: "\"\"\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\[bfnrt'\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})" + + - constant.string: + start: "[frs]?'''" + end: "'''" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\[bfnrt'\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})" + + - constant.string: + start: "[frs]?\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\[bfnrt'\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})" + + - constant.string: + start: "[frs]?'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\[bfnrt'\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|FIXME|NOTE):?" + + # Decorators + - preproc: "@\\{([a-z]+(=[a-z0-9]+,?)?)*\\}" diff --git a/config/micro/syntax/puppet.yaml b/config/micro/syntax/puppet.yaml new file mode 100644 index 0000000..63a11eb --- /dev/null +++ b/config/micro/syntax/puppet.yaml @@ -0,0 +1,22 @@ +filetype: puppet + +detect: + filename: "\\.pp$" + +rules: + - default: "^[[:space:]]([a-z][a-z0-9_]+)" + - identifier.var: "\\$[a-z:][a-z0-9_:]+" + - type: "\\b(augeas|computer|cron|exec|file|filebucket|group|host|interface|k5login|macauthorization|mailalias|maillist|mcx|mount|nagios_command|nagios_contact|nagios_contactgroup|nagios_host|nagios_hostdependency|nagios_hostescalation|nagios_hostextinfo|nagios_hostgroup|nagios_service|nagios_servicedependency|nagios_serviceescalation|nagios_serviceextinfo|nagios_servicegroup|nagios_timeperiod|notify|package|resources|router|schedule|scheduled_task|selboolean|selmodule|service|ssh_authorized_key|sshkey|stage|tidy|user|vlan|yumrepo|zfs|zone|zpool|anchor)\\b" + - statement: "\\b(class|define|if|else|undef|inherits)\\b" + - symbol: "(=|-|~|>)" + - identifier.var: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" + - symbol: "([ ]|^):[0-9A-Z_]+\\b" + - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*" + - constant.string: "`[^`]*`|%x\\{[^}]*\\}" + - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!" + - special: "\\$\\{[^}]*\\}" + - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!" + - comment: "#[^{].*$|#$" + - comment.bright: "##[^{].*$|##$" + - todo: "(XXX|TODO|FIXME|\\?\\?\\?)" + - indent-char.whitespace: "[[:space:]]+$" diff --git a/config/micro/syntax/python2.yaml b/config/micro/syntax/python2.yaml new file mode 100644 index 0000000..3a993b0 --- /dev/null +++ b/config/micro/syntax/python2.yaml @@ -0,0 +1,60 @@ +filetype: python2 + +detect: + filename: "\\.py2$" + header: "^#!.*/(env +)?python2$" + +rules: + + # built-in objects + - constant: "\\b(None|self|True|False)\\b" + # built-in attributes + - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b" + # built-in functions + - identifier: "\\b(abs|apply|callable|chr|cmp|compile|delattr|dir|divmod|eval|exec|execfile|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|len|locals|max|min|next|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|unichr|vars|zip|__import__)\\b" + # special method names + - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__dict__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b" + # types + - type: "\\b(basestring|bool|buffer|bytearray|bytes|classmethod|complex|dict|enumerate|file|float|frozenset|int|list|long|map|memoryview|object|property|reversed|set|slice|staticmethod|str|super|tuple|type|unicode|xrange)\\b" + # definitions + - identifier: "def [a-zA-Z_0-9]+" + # keywords + - statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\\b" + # decorators + - preproc: "^\\s*@[^(]*" + # operators + - symbol.operator: "([.:;,+*|=!\\%@]|<|>|/|-|&)" + # parentheses + - symbol.brackets: "([(){}]|\\[|\\])" + # numbers + - constant.number: "\\b[0-9]+\\b" + + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + rules: [] + + - constant.string: + start: "'''" + end: "'''" + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: [] + diff --git a/config/micro/syntax/python3.yaml b/config/micro/syntax/python3.yaml new file mode 100644 index 0000000..a87a2cb --- /dev/null +++ b/config/micro/syntax/python3.yaml @@ -0,0 +1,62 @@ +filetype: python + +detect: + filename: "\\.py(3|w)?$" + header: "^#!.*/(env +)?python(3)?$" + +rules: + # built-in objects + - constant: "\\b(Ellipsis|None|self|cls|True|False)\\b" + # built-in attributes + - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b" + # built-in functions + - identifier: "\\b(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|nonlocal|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\\b" + # special method names + - identifier: "\\b__(abs|add|and|call|cmp|coerce|complex|concat|contains|delattr|delitem|delslice|del|dict|divmod|div|float|getattr|getitem|getslice|hash|hex|iadd|iand|iconcat|ifloordiv|ilshift|imatmul|imod|imul|init|int|invert|inv|ior|ipow|irshift|isub|iter|itruediv|ixor|len|long|lshift|mod|mul|neg|next|nonzero|oct|or|pos|pow|radd|rand|rcmp|rdivmod|rdiv|repeat|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|setslice|str|sub|xor)__\\b" + # types + - type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b" + # definitions + - identifier: "def [a-zA-Z_0-9]+" + # keywords + - statement: "\\b(and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b" + # decorators + - preproc: "^\\s*@[^(]*" + # operators + - symbol.operator: "([~^.:;,+*|=!\\%@]|<|>|/|-|&)" + # parentheses + - symbol.brackets: "([(){}]|\\[|\\])" + # numbers + - constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal + - constant.number: "\\b0b(_?[01])+\\b" # bin + - constant.number: "\\b0o(_?[0-7])+\\b" # oct + - constant.number: "\\b0x(_?[0-9a-fA-F])+\\b" # hex + + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + rules: [] + + - constant.string: + start: "'''" + end: "'''" + rules: [] + + - constant.string: + start: "\"" + end: "(\"|$)" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "('|$)" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: # AKA Code tags (PEP 350) + - todo: "(TODO|FIXME|HACK|BUG|NOTE|FAQ|MNEMONIC|REQ|RFE|IDEA|PORT|\\?\\?\\?|!!!|GLOSS|SEE|TODOC|STAT|RVD|CRED):?" diff --git a/config/micro/syntax/r.yaml b/config/micro/syntax/r.yaml new file mode 100644 index 0000000..d764c11 --- /dev/null +++ b/config/micro/syntax/r.yaml @@ -0,0 +1,32 @@ +filetype: r + +detect: + filename: "\\.(r|R)$" + +rules: + + - statement: "\\b(library|require|break|else|for|function|if|ifelse|in|next|names|switch|repeat|print|try|tryCatch|isTRUE|return|while)\\b" + - constant: "\\b(T|TRUE|F|FALSE|NULL|Inf|NaN|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\\b" + - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)" + - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&|\\^|\\$)" + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + diff --git a/config/micro/syntax/raku.yaml b/config/micro/syntax/raku.yaml new file mode 100644 index 0000000..7523be5 --- /dev/null +++ b/config/micro/syntax/raku.yaml @@ -0,0 +1,42 @@ +filetype: raku + +detect: + filename: "\\.(p(l|m|od)?6|raku(mod|doc|test)?|nqp)$" + +rules: + - type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b" + - statement: "\\b(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\\b" + - special: "\\b(has|is|class|role|given|when|BUILD|multi|returns|method|submethod|slurp|say|sub)\\b" + + - identifier: "[$@%&](\\.|!|\\^)?([[:alpha:]]|_)" + - identifier: "[$@%&](\\.|!|^)?([[:alpha:]]|_)([[:alnum:]]|-|_)*([[:alnum:]]|_)" + - identifier: "[$@%&](\\?|\\*)([A-Z])([A-Z]|-)*([A-Z])" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - preproc: + start: "(^use| = new)" + end: ";" + rules: [] + + - identifier.macro: + start: "<" + - special: "^%(build$|changelog|check$|clean$|description)" + - special: "^%(files|install$|package|prep$)" + - special: "^%(pre|preun|pretrans|post|postun|posttrans)" + - special: "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)" + - comment: "(^|[[:space:]])#([^{].*)?$" + - constant: "^\\*.*$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" + - todo: "TODO:?" diff --git a/config/micro/syntax/ruby.yaml b/config/micro/syntax/ruby.yaml new file mode 100644 index 0000000..dadb4c2 --- /dev/null +++ b/config/micro/syntax/ruby.yaml @@ -0,0 +1,73 @@ +filetype: ruby + +detect: + filename: '\.(rb|rake|gemspec)$|^(.*[\\/])?(Gemfile|config\.ru|Rakefile|Capfile|Vagrantfile|Guardfile|Appfile|Fastfile|Pluginfile|Podfile|\.?[Bb]rewfile)$' + header: "^#!.*/(env +)?ruby( |$)" + +rules: + - comment.bright: + start: "##" + end: "$" + rules: + - todo: "(XXX|TODO|FIXME|BUG|\\?\\?\\?)" + - comment: + start: "#" + end: "$" + rules: + - todo: "(XXX|TODO|FIXME|BUG|\\?\\?\\?)" + + - statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|for|if|in|module|next|nil|not|or|private|protected|public|redo|rescue|retry|return|self|super|then|undef|unless|until|when|while|yield)\\b" + - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" + - constant.number: "(?i)\\b0x[0-9a-fA-F][0-9a-f_]*\\b" + - constant.number: "(?i)\\b0b[01][01_]*\\b" + - constant.number: "(?i)\\b[0-9][0-9_]*(['.'][0-9_]+)?(e[\\-]?[0-9_]+)?\\b" + # Predefined global variables + - constant: + start: "[$]([!@&`'+~=/\\\\,;.<>*$?:\"_]|-[A-Za-z0-9_]|[0-9]+)" + end: "\\B|\\b" + rules: [] + # Ruby "Symbols" + - constant: "(i?)([ ]|^):[0-9A-Z_]+\\b" + - constant: "\\b(__FILE__|__LINE__)\\b" + - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - symbol.brackets: + start: "#\\{" + end: "\\}" + rules: + - default: ".*" + + - constant.string.exec: + start: "`" + end: "`" + skip: "\\\\." + rules: + - symbol.brackets: + start: "#\\{" + end: "\\}" + rules: + - default: ".*" + + - constant.string: "%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!" + - constant.string: "%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!" + - constant.string.exec: "%[x]\\{[^}]*\\}|%[x]\\([^)]*\\)|%[x]<[^>]*>|%[x]\\[[^]]*\\]|%[x]\\$[^$]*\\$|%[x]\\^[^^]*\\^|%[x]![^!]*!" + - constant.bool: "\\b(true|false|nil|TRUE|FALSE|NIL)\\b" + - symbol.operator: "[-+/*=<>!~%&|^]|\\b:" + - symbol.brackets: "([(){}]|\\[|\\])" + - constant.macro: + start: "<<-?'?EOT'?" + end: "^EOT" + rules: [] + + - preproc.shebang: "^#!.+?( |$)" diff --git a/config/micro/syntax/rust.yaml b/config/micro/syntax/rust.yaml new file mode 100644 index 0000000..5347e70 --- /dev/null +++ b/config/micro/syntax/rust.yaml @@ -0,0 +1,78 @@ +filetype: rust + +detect: + filename: "\\.rs$" + +rules: + # function definition + - identifier: "fn [a-z0-9_]+" + # Reserved words + - statement: "\\b(abstract|alignof|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|false|final|fn|for|gen|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|try|union|unsafe|unsized|use|virtual|where|while|yield)\\b" + # macros + - special: "[a-z_]+!" + # Constants + - constant: "\\b[A-Z][A-Z_0-9]+\\b" + # Numbers + - constant.number: "\\b[0-9]+\\b" + # Booleans + - constant: "\\b(true|false)\\b" + # Traits/Enums/Structs/Types/etc. + - type: "\\b[A-Z]+[a-zA-Z_0-9]*[a-z]+[a-zA-Z_0-9]*\\b" + # Builtin types that start with lowercase. + - type: "\\b(bool|str|char|((i|u)(8|16|32|64|128|size))|f(16|32|64|128))\\b" + + - constant.string: + start: "[bc]?\"" + end: "\"" + skip: '\\.' + rules: + - constant.specialChar: '\\.' + + - constant.string: + start: "[bc]?r#\"" + end: "\"#" + rules: [] + + - constant.string: + start: "[bc]?r##\"" + end: "\"##" + rules: [] + + - constant.string: + start: "[bc]?r###\"" + end: "\"###" + rules: [] + + - constant.string: + start: "[bc]?r####+\"" + end: "\"####+" + rules: [] + + # Character literals + # NOTE: This is an ugly hack to work around the fact that rust uses + # single quotes both for character literals and lifetimes. + # Match all character literals. + - constant.string: "'(\\\\.|.)'" + # Match the '"' literal which would otherwise match + # as a double quoted string and destroy the highlighting. + - constant.string: + start: "'\"" + end: "'" + rules: [] + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - special: + start: "#!\\[" + end: "\\]" + rules: [] diff --git a/config/micro/syntax/sage.yaml b/config/micro/syntax/sage.yaml new file mode 100644 index 0000000..e24fbeb --- /dev/null +++ b/config/micro/syntax/sage.yaml @@ -0,0 +1,60 @@ +filetype: sage + +detect: + filename: "\\.sage$" + header: "^#!.*/(env +)?sage( |$)" + +rules: + + # built-in objects + - constant: "\\b(None|self|True|False)\\b" + # built-in attributes + - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b" + # built-in functions + - identifier: "\\b(abs|apply|callable|chr|cmp|compile|delattr|dir|divmod|eval|exec|execfile|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|len|locals|max|min|next|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|unichr|vars|zip|__import__)\\b" + # special method names + - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__dict__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b" + # types + - type: "\\b(basestring|bool|buffer|bytearray|bytes|classmethod|complex|dict|enumerate|file|float|frozenset|int|list|long|map|memoryview|object|property|reversed|set|slice|staticmethod|str|super|tuple|type|unicode|xrange)\\b" + # definitions + - identifier: "def [a-zA-Z_0-9]+" + # keywords + - statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\\b" + # decorators + - brightgreen: "@.*[(]" + # operators + - statement: "([.:;,+*|=!\\%@]|<|>|/|-|&)" + # parentheses + - statement: "([(){}]|\\[|\\])" + # numbers + - constant.number: "\\b[0-9]+\\b" + + - comment: + start: "\"\"\"" + end: "\"\"\"" + rules: [] + + - comment: + start: "'''" + end: "'''" + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: [] + diff --git a/config/micro/syntax/scad.yaml b/config/micro/syntax/scad.yaml new file mode 100644 index 0000000..0108e3a --- /dev/null +++ b/config/micro/syntax/scad.yaml @@ -0,0 +1,53 @@ +filetype: OpenSCAD + +# OpenSCAD is a functional programming language used for representing +# 2D/3D models for use in the program of the same name. +# +# The following documents were used as reference material: +# https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language +# https://openscad.org/cheatsheet/index.html + +detect: + filename: "\\.scad$" + +rules: + - identifier: "\\b(function|module) +[a-z0-9_]+" + + - statement: "\\b(abs|acos|asin|assert|atan|atan2|ceil|child|children|chr|circle|color|concat|cos|cross|cube|cylinder|difference|dxf_cross|dxf_dim|each|echo|else|exp|floor|for|function|hull|if|import|import_dxf|intersection|intersection_for|is_bool|is_function|is_list|is_num|is_string|is_undef|len|let|linear_extrude|ln|log|lookup|max|min|minkowski|mirror|module|multmatrix|norm|offset|ord|parent_module|polygon|polyhedron|pow|projection|rands|render|resize|rotate|rotate_extrude|round|scale|search|sign|sin|sphere|sqrt|square|str|surface|tan|text|translate|union|version|version_num)\\b" + + - symbol: "[,\\.;:?]" + - symbol.operator: "[-+*/%^<>!=]|[<=>!]=|&&|\\|\\|" + - symbol.brackets: "[{(<>)}]|\\[|\\]" + + # modifiers that change interpretation of the subtree after it + - special: "[#%!*]" + + # special variables start with a dollar sign + - special: "\\B\\$[a-z]+\\b" + + - preproc: + start: "^ *(use|include) <" + end: ">;?" + rules: [] + + - constant.number: "\\b[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?|PI|inf|nan\\b" + - constant.bool: "\\b(true|false)\\b" + - constant: "\\b(undef)\\b" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/scala.yaml b/config/micro/syntax/scala.yaml new file mode 100644 index 0000000..e38137c --- /dev/null +++ b/config/micro/syntax/scala.yaml @@ -0,0 +1,33 @@ +filetype: scala + +detect: + filename: "\\.sc(ala)?$|\\.sbt$" + +rules: + - type: "\\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\\b" + - statement: "\\b(match|val|var|break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\\b" + - statement: "\\b(def|object|case|trait|lazy|implicit|abstract|class|extends|with|final|implements|override|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile|sealed)\\b" + - constant.string: + start: "\"\"\"" + end: "\"\"\"" + rules: [] + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant: "\\b(true|false|null)\\b" + - comment: + start: "//" + end: "$" + rules: [] + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + - comment: + start: "/\\*\\*" + end: "\\*/" + rules: [] + diff --git a/config/micro/syntax/sed.yaml b/config/micro/syntax/sed.yaml new file mode 100644 index 0000000..ed33bae --- /dev/null +++ b/config/micro/syntax/sed.yaml @@ -0,0 +1,13 @@ +filetype: sed + +detect: + filename: "\\.sed$" + header: "^#!.*bin/(env +)?sed( |$)" + +rules: + - symbol.operator: "[|^$.*+]" + - constant.number: "\\{[0-9]+,?[0-9]*\\}" + - constant.specialChar: "\\\\." + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/sh.yaml b/config/micro/syntax/sh.yaml new file mode 100644 index 0000000..e6f75a8 --- /dev/null +++ b/config/micro/syntax/sh.yaml @@ -0,0 +1,69 @@ +filetype: shell + +# Detection based on filename is rather complicated as there are many +# different file extensions and special filenames in use. +# This expressions aims to capture them all while not matching +# filenames that coincidentally contain the same substring. +# +# File extensions: +# * .sh +# * .bash +# * .ash +# * .ebuild (Gentoo ebuild format) +# +# Special filenames: +# * .bashrc, .bash_aliases, .bash_functions .bash_profile +# * profile, .profile (/etc/profile or ~/.profile) +# * Pkgfile +# * pkgmk.conf +# * rc.conf +# * PKGBUILD (Arch Linux build scripts) +# * APKBUILD +# +# Fix command (fc) files: +# * bash-fc. (followed by a random string) +detect: + filename: "(\\.(sh|bash|ash|ebuild)$|(\\.bash(rc|_aliases|_functions|_profile)|\\.?profile|Pkgfile|pkgmk\\.conf|rc\\.conf|PKGBUILD|APKBUILD)$|bash-fc\\.)" + header: "^#!.*/(env +)?(ba)?(a)?(mk)?sh( |$)" + +rules: + # Numbers + - constant.number: "\\b[0-9]+\\b" + # Conditionals and control flow + - statement: "\\b(break|case|continue|do|done|elif|else|esac|exec|exit|fi|for|function|if|in|return|select|then|trap|until|wait|while)\\b" + - special: "[`$<>!=&~^\\{\\}\\(\\)\\;\\]\\[]+" + # Shell commands + - type: "\\b(cd|command|echo|eval|export|getopts|let|local|read|set|shift|time|umask|unset)\\b" + # Common linux commands + - type: "\\b((g|ig)?awk|bash|dash|find|getopt|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b" + # Coreutils commands + - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b" + # Conditional flags + - statement: "(\\s|^)(--?[A-Za-z0-9][\\w-]*)" + + - identifier: "\\$\\{[\\w:!%&=+#~@*^$?, .\\-\\/\\[\\]]+\\}" + - identifier: "\\$([0-9!#@*$?-]|[A-Za-z_]\\w*)" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: [] + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: [] + + - constant.string: + start: "<<[^\\s]+[-~.]*[A-Za-z0-9]+$" + end: "^[^\\s]+[A-Za-z0-9]+$" + skip: "\\\\." + rules: [] + + - comment: + start: "(^|\\s)#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/sls.yaml b/config/micro/syntax/sls.yaml new file mode 100644 index 0000000..d5da953 --- /dev/null +++ b/config/micro/syntax/sls.yaml @@ -0,0 +1,15 @@ +filetype: salt + +detect: + filename: "\\.sls$" + +rules: + - identifier.var: "^[^ -].*:$" + - identifier.var: ".*:" + - default: "salt:" + - constant.number: "/*[0-9]/*" + - constant.bool: "\\b(True|False)\\b" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - special: "\\b(grain|grains|compound|pcre|grain_pcre|list|pillar)\\b" + - comment: "^#.*" + - statement: "\\b(if|elif|else|or|not|and|endif|end)\\b" diff --git a/config/micro/syntax/smalltalk.yaml b/config/micro/syntax/smalltalk.yaml new file mode 100644 index 0000000..c595588 --- /dev/null +++ b/config/micro/syntax/smalltalk.yaml @@ -0,0 +1,55 @@ +filetype: smalltalk + +detect: + filename: "\\.(st|sources|changes)$" + +rules: + - statement: "\\b(self|nil|true|false|ifTrue|ifFalse|whileTrue|whileFalse)\\b" + - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*" + - constant.number: "(?i)\\b0x[0-9a-fA-F][0-9a-f_]*\\b" + - constant.number: "(?i)\\b0b[01][01_]*\\b" + - constant.number: "(?i)\\b[0-9][0-9_]*(['.'][0-9_]+)?(e[\\-]?[0-9_]+)?\\b" + # Ruby "Symbols" + - constant: "(i?)([ ]|^):[0-9A-Z_]+\\b" + - constant: "\\b(__FILE__|__LINE__)\\b" + - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - symbol.brackets: + start: "#\\{" + end: "\\}" + rules: + - default: ".*" + + - constant.string.exec: + start: "`" + end: "`" + skip: "\\\\." + rules: + - symbol.brackets: + start: "#\\{" + end: "\\}" + rules: + - default: ".*" + + - constant.string: "%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!" + - constant.string: "%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!" + - constant.string.exec: "%[x]\\{[^}]*\\}|%[x]\\([^)]*\\)|%[x]<[^>]*>|%[x]\\[[^]]*\\]|%[x]\\$[^$]*\\$|%[x]\\^[^^]*\\^|%[x]![^!]*!" + - symbol.operator: "[-+/*=<>!~%&|^]|\\b:" + - symbol.brackets: "([(){}]|\\[|\\])" + - constant.macro: + start: "<<-?'?EOT'?" + end: "^EOT" + rules: [] + + - preproc.shebang: "^#!.+?( |$)" diff --git a/config/micro/syntax/solidity.yaml b/config/micro/syntax/solidity.yaml new file mode 100644 index 0000000..32fd40b --- /dev/null +++ b/config/micro/syntax/solidity.yaml @@ -0,0 +1,41 @@ +filetype: solidity + +detect: + filename: "\\.sol$" + +rules: + - preproc: "\\b(contract|library|pragma)\\b" + - constant.number: "\\b[-]?([0-9]+|0x[0-9a-fA-F]+)\\b" + - identifier: "[a-zA-Z][_a-zA-Z0-9]*[[:space:]]*" + - statement: "\\b(assembly|break|continue|do|for|function|if|else|new|return|returns|while)\\b" + - special: "\\b(\\.send|throw)\\b" # make sure they are very visible + - type.keyword: "\\b(anonymous|constant|indexed|payable|public|private|external|internal)\\b" + - constant: "\\b(block(\\.(blockhash|coinbase|difficulty|gaslimit|number|timestamp))?|msg(\\.(data|gas|sender|value))?|now|tx(\\.(gasprice|origin))?)\\b" + - constant: "\\b(keccak256|sha3|sha256|ripemd160|ecrecover|addmod|mulmod|this|super|selfdestruct|\\.balance)\\b" + - constant: "\\b(true|false)\\b" + - constant: "\\b(wei|szabo|finney|ether|seconds|minutes|hours|days|weeks|years)\\b" + - type: "\\b(address|bool|mapping|string|var|int(\\d*)|uint(\\d*)|byte(\\d*)|fixed(\\d*)|ufixed(\\d*))\\b" + - error: "\\b(abstract|after|case|catch|default|final|in|inline|interface|let|match|null|of|pure|relocatable|static|switch|try|type|typeof|view)\\b" + - operator: "[-+/*=<>!~%?:&|]" + - comment: + start: "//" + end: "$" + rules: [] + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + - todo: "TODO:?" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + diff --git a/config/micro/syntax/sql.yaml b/config/micro/syntax/sql.yaml new file mode 100644 index 0000000..b41c11e --- /dev/null +++ b/config/micro/syntax/sql.yaml @@ -0,0 +1,35 @@ +filetype: sql + +detect: + filename: "\\.sql$|sqliterc$" + +rules: + - statement: "(?i)\\b(ALL|ASC|AS|ALTER|AND|ADD|AUTO_INCREMENT)\\b" + - statement: "(?i)\\b(BETWEEN|BINARY|BOTH|BY|BOOLEAN)\\b" + - statement: "(?i)\\b(CHANGE|CHECK|COLUMNS|COLUMN|CROSS|CREATE)\\b" + - statement: "(?i)\\b(DATABASES|DATABASE|DATA|DELAYED|DESCRIBE|DESC|DISTINCT|DELETE|DROP|DEFAULT)\\b" + - statement: "(?i)\\b(ENCLOSED|ESCAPED|EXISTS|EXPLAIN)\\b" + - statement: "(?i)\\b(FIELDS|FIELD|FLUSH|FOR|FOREIGN|FUNCTION|FROM)\\b" + - statement: "(?i)\\b(GROUP|GRANT|HAVING)\\b" + - statement: "(?i)\\b(IGNORE|INDEX|INFILE|INSERT|INNER|INTO|IDENTIFIED|IN|IS|IF)\\b" + - statement: "(?i)\\b(JOIN|KEYS|KILL|KEY)\\b" + - statement: "(?i)\\b(LEADING|LIKE|LIMIT|LINES|LOAD|LOCAL|LOCK|LOW_PRIORITY|LEFT|LANGUAGE)\\b" + - statement: "(?i)\\b(MODIFY|NATURAL|NOT|NULL|NEXTVAL)\\b" + - statement: "(?i)\\b(OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUTFILE|OR|OUTER|ON)\\b" + - statement: "(?i)\\b(PROCEDURE|PROCEDURAL|PRIMARY)\\b" + - statement: "(?i)\\b(READ|REFERENCES|REGEXP|RENAME|REPLACE|RETURN|REVOKE|RLIKE|RIGHT)\\b" + - statement: "(?i)\\b(SHOW|SONAME|STATUS|STRAIGHT_JOIN|SELECT|SETVAL|SET)\\b" + - statement: "(?i)\\b(TABLES|TERMINATED|TO|TRAILING|TRUNCATE|TABLE|TEMPORARY|TRIGGER|TRUSTED)\\b" + - statement: "(?i)\\b(UNIQUE|UNLOCK|USE|USING|UPDATE|VALUES|VARIABLES|VIEW)\\b" + - statement: "(?i)\\b(WITH|WRITE|WHERE|ZEROFILL|TYPE|XOR)\\b" + - type: "(?i)\\b(VARCHAR|TINYINT|TEXT|DATE|SMALLINT|MEDIUMINT|INT|INTEGER|BIGINT|FLOAT|DOUBLE|DECIMAL|DATETIME|TIMESTAMP|TIME|YEAR|UNSIGNED|CHAR|TINYBLOB|TINYTEXT|BLOB|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|ENUM|BOOL|BINARY|VARBINARY)\\b" + - preproc: "(?i)\\.\\b(databases|dump|echo|exit|explain|header(s)?|help)\\b" + - preproc: "(?i)\\.\\b(import|indices|mode|nullvalue|output|prompt|quit|read)\\b" + - preproc: "(?i)\\.\\b(schema|separator|show|tables|timeout|width)\\b" + - constant.bool: "\\b(ON|OFF)\\b" + - constant.number: "\\b([0-9]+)\\b" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - constant.string: "`(\\\\.|[^\\\\`])*`" + - comment: "\\-\\-.*$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/stata.yaml b/config/micro/syntax/stata.yaml new file mode 100644 index 0000000..5239c6c --- /dev/null +++ b/config/micro/syntax/stata.yaml @@ -0,0 +1,67 @@ +filetype: stata + +detect: + filename: "\\.a?do$" + +rules: + - constant.string: + start: "`\"" + end: "\"'" + rules: + - identifier.macro: + start: "`" + end: "'" + rules: [] + - identifier.macro: "\\$\\w+" + - constant.specialChar: "\\\\." + + - constant.string: + start: "\"" + end: "\"" + rules: + - identifier.macro: + start: "`" + end: "'" + rules: [] + - identifier.macro: "\\$\\w+" + - constant.specialChar: "\\\\." + + # Built-in functions + - identifier: + "\\b(_caller|abbrev|abs|acos|acosh|asin|asinh|atan|atan2|atanh|autocode|betaden|binomial|binomialp|binomialtail|binormal|bofd|byteorder|c|cauchy|cauchyden|cauchytail|Cdhms|ceil|char|chi2|chi2den|chi2tail|Chms|cholesky|chop|clip|Clock|cloglog|Cmdyhms|Cofc|Cofd|coleqnumb|collatorlocale|collatorversion|colnfreeparms|colnumb|colsof|comb|cond|corr|cos|cosh|date|day|det|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|dhms|diag|diag0cnt|digamma|dofb|dofC|dofh|dofm|dofq|dofw|dofy|dow|doy|dunnettprob|e|el|epsdouble|epsfloat|exp|exponential|exponentialden|exponentialtail|F|Fden|fileexists|fileread|filereaderror|filewrite|float|floor|fmtwidth|Ftail|gammaden|gammap|gammaptail|hadamard|halfyear|halfyearly|has_eprop|hh|hhC|hms|hofd|hours|hypergeometric|hypergeometricp|I|ibeta|ibetatail|igaussian|igaussianden|igaussiantail|indexnot|inlist|inrange|int|inv|invbinomial|invbinomialtail|invcauchy|invcauchytail|invchi2|invchi2tail|invcloglog|invdunnettprob|invexponential|invexponentialtail|invF|invFtail|invgammap|invgammaptail|invibeta|invibetatail|invigaussian|invigaussiantail|invlaplace|invlaplacetail|invlogistic|invlogistictail|invlogit|invnbinomial|invnbinomialtail|invnchi2|invnchi2tail|invnF|invnFtail|invnibeta|invnormal|invnt|invnttail|invpoisson|invpoissontail|invsym|invt|invttail|invtukeyprob|invweibull|invweibullph|invweibullphtail|invweibulltail|irecode|issymmetric|J|laplace|laplaceden|laplacetail|ln|lncauchyden|lnfactorial|lngamma|lnigammaden|lnigaussianden|lniwishartden|lnlaplaceden|lnmvnormalden|lnnormal|lnnormalden|lnwishartden|log|log10|logistic|logisticden|logistictail|logit|matmissing|matrix|matuniform|max|maxbyte|maxdouble|maxfloat|maxint|maxlong|mdy|mdyhms|missing|min|minbyte|mindouble|minfloat|minint|minlong|minutes|mm|mmC|mod|mofd|month|monthly|mreldif|msofhours|msofminutes|msofseconds|nbetaden|nbinomial|nbinomialp|nbinomialtail|nchi2|nchi2den|nchi2tail|nF|nFden|nFtail|nibeta|normal|normalden|npnchi2|npnF|npnt|nt|ntden|nttail|nullmat|plural|poisson|poissonp|poissontail|qofd|quarter|quarterly|r|rbeta|rbinomial|rcauchy|rchi2|real|recode|regexm|regexr|regexs|reldif|replay|return|rexponential|rgamma|rhypergeometric|rigaussian|rlaplace|rlogistic|rnbinomial|rnormal|round|roweqnumb|rownfreeparms|rownumb|rowsof|rpoisson|rt|runiform|runiformint|rweibull|rweibullph|s|scalar|seconds|sign|sin|sinh|smallestdouble|soundex|sqrt|ss|ssC|strcat|strdup|strofreal|string|strtrim|stritrim|strltrim|strrtrim|strlen|strupper|strlower|strproper|strmatch|strpos|strrpos|strreverse|strtoname|subinstr|subinword|substr|sum|sweep|t|tan|tanh|tC|td|tden|th|tin|tm|tobytes|tq|trace|trigamma|ttail|tukeyprob|tw|twithin|uchar|udstrlen|udsubstr|uisdigit|uisletter|ustrcompare|ustrsortkey|ustrcompareex|ustrsortkeyex|ustrfix|ustrto|ustrfrom|ustrlen|ustrinvalidcnt|usubstr|ustrleft|ustrright|ustrupper|ustrlower|ustrtitle|ustrtrim|ustrltrim|ustrrtrim|ustrnormalize|ustrpos|ustrrpos|ustrregexm|ustrregexrf|ustrregexra|ustrregexs|ustrreverse|ustrunescape|ustrtohex|ustrtoname|ustrword|ustrwordcount|usubinstr|vec|vecdiag|week|weekly|weibull|weibullden|weibullph|weibullphden|weibullphtail|weibulltail|wofd|word|wordbreaklocale|year|yearly|yh|ym|yofd|yq|yw)\\b" + # Built-in commands + - statement: + "\\b(if|else|else\\s+if|in|foreach|for|forv|forva|forval|forvalu|forvalue|forvalues|by|bys|bysort|quietly|qui|about|ac|ac_7|acprplot|acprplot_7|adjust|ado|adopath|adoupdate|alpha|ameans|an|ano|anov|anova|anova_estat|anova_terms|anovadef|aorder|ap|app|appe|appen|append|arch|arch_dr|arch_estat|arch_p|archlm|areg|areg_p|args|arima|arima_dr|arima_estat|arima_p|as|asmprobit|asmprobit_estat|asmprobit_lf|asmprobit_mfx__dlg|asmprobit_p|ass|asse|asser|assert|avplot|avplot_7|avplots|avplots_7|bcskew0|bgodfrey|binreg|bip0_lf|biplot|bipp_lf|bipr_lf|bipr_p|biprobit|bitest|bitesti|bitowt|blogit|bmemsize|boot|bootsamp|bootstrap|bootstrap_8|boxco_l|boxco_p|boxcox|boxcox_6|boxcox_p|bprobit|br|break|brier|bro|brow|brows|browse|brr|brrstat|bs|bs_7|bsampl_w|bsample|bsample_7|bsqreg|bstat|bstat_7|bstat_8|bstrap|bstrap_7|ca|ca_estat|ca_p|cabiplot|camat|canon|canon_8|canon_8_p|canon_estat|canon_p|cap|caprojection|capt|captu|captur|capture|cat|cc|cchart|cchart_7|cci|cd|censobs_table|centile|cf|char|chdir|checkdlgfiles|checkestimationsample|checkhlpfiles|checksum|chelp|ci|cii|cl|class|classutil|clear|cli|clis|clist|clo|clog|clog_lf|clog_p|clogi|clogi_sw|clogit|clogit_lf|clogit_p|clogitp|clogl_sw|cloglog|clonevar|clslistarray|cluster|cluster_measures|cluster_stop|cluster_tree|cluster_tree_8|clustermat|cmdlog|cnr|cnre|cnreg|cnreg_p|cnreg_sw|cnsreg|codebook|collaps4|collapse|colormult_nb|colormult_nw|compare|compress|conf|confi|confir|confirm|conren|cons|const|constr|constra|constrai|constrain|constraint|continue|contract|copy|copyright|copysource|cor|corc|corr|corr2data|corr_anti|corr_kmo|corr_smc|corre|correl|correla|correlat|correlate|corrgram|cou|coun|count|cox|cox_p|cox_sw|coxbase|coxhaz|coxvar|cprplot|cprplot_7|crc|cret|cretu|cretur|creturn|cross|cs|cscript|cscript_log|csi|ct|ct_is|ctset|ctst_5|ctst_st|cttost|cumsp|cumsp_7|cumul|cusum|cusum_7|cutil|d|datasig|datasign|datasigna|datasignat|datasignatu|datasignatur|datasignature|datetof|db|dbeta|de|dec|deco|decod|decode|deff|des|desc|descr|descri|describ|describe|destring|dfbeta|dfgls|dfuller|di|di_g|dir|dirstats|dis|discard|disp|disp_res|disp_s|displ|displa|display|distinct|do|doe|doed|doedi|doedit|dotplot|dotplot_7|dprobit|drawnorm|drop|ds|ds_util|dstdize|duplicates|durbina|dwstat|dydx|e|ed|edi|edit|egen|eivreg|emdef|end|en|enc|enco|encod|encode|eq|erase|ereg|ereg_lf|ereg_p|ereg_sw|ereghet|ereghet_glf|ereghet_glf_sh|ereghet_gp|ereghet_ilf|ereghet_ilf_sh|ereghet_ip|eret|eretu|eretur|ereturn|err|erro|error|est|est_cfexist|est_cfname|est_clickable|est_expand|est_hold|est_table|est_unhold|est_unholdok|estat|estat_default|estat_summ|estat_vce_only|esti|estimates|etodow|etof|etomdy|ex|exi|exit|expand|expandcl|fac|fact|facto|factor|factor_estat|factor_p|factor_pca_rotated|factor_rotate|factormat|fcast|fcast_compute|fcast_graph|fdades|fdadesc|fdadescr|fdadescri|fdadescrib|fdadescribe|fdasav|fdasave|fdause|fh_st|open|read|close|file|filefilter|fillin|find_hlp_file|findfile|findit|findit_7|fit|fl|fli|flis|flist|for5_0|form|forma|format|fpredict|frac_154|frac_adj|frac_chk|frac_cox|frac_ddp|frac_dis|frac_dv|frac_in|frac_mun|frac_pp|frac_pq|frac_pv|frac_wgt|frac_xo|fracgen|fracplot|fracplot_7|fracpoly|fracpred|fron_ex|fron_hn|fron_p|fron_tn|fron_tn2|frontier|ftodate|ftoe|ftomdy|ftowdate|g|gamhet_glf|gamhet_gp|gamhet_ilf|gamhet_ip|gamma|gamma_d2|gamma_p|gamma_sw|gammahet|gdi_hexagon|gdi_spokes|ge|gen|gene|gener|genera|generat|generate|genrank|genstd|genvmean|gettoken|gl|gladder|gladder_7|glim_l01|glim_l02|glim_l03|glim_l04|glim_l05|glim_l06|glim_l07|glim_l08|glim_l09|glim_l10|glim_l11|glim_l12|glim_lf|glim_mu|glim_nw1|glim_nw2|glim_nw3|glim_p|glim_v1|glim_v2|glim_v3|glim_v4|glim_v5|glim_v6|glim_v7|glm|glm_6|glm_p|glm_sw|glmpred|glo|glob|globa|global|glogit|glogit_8|glogit_p|gmeans|gnbre_lf|gnbreg|gnbreg_5|gnbreg_p|gomp_lf|gompe_sw|gomper_p|gompertz|gompertzhet|gomphet_glf|gomphet_glf_sh|gomphet_gp|gomphet_ilf|gomphet_ilf_sh|gomphet_ip|gphdot|gphpen|gphprint|gprefs|gprobi_p|gprobit|gprobit_8|gr|gr7|gr_copy|gr_current|gr_db|gr_describe|gr_dir|gr_draw|gr_draw_replay|gr_drop|gr_edit|gr_editviewopts|gr_example|gr_example2|gr_export|gr_print|gr_qscheme|gr_query|gr_read|gr_rename|gr_replay|gr_save|gr_set|gr_setscheme|gr_table|gr_undo|gr_use|graph|graph7|grebar|greigen|greigen_7|greigen_8|grmeanby|grmeanby_7|gs_fileinfo|gs_filetype|gs_graphinfo|gs_stat|gsort|gwood|h|hadimvo|hareg|hausman|haver|he|heck_d2|heckma_p|heckman|heckp_lf|heckpr_p|heckprob|hel|help|hereg|hetpr_lf|hetpr_p|hetprob|hettest|hexdump|hilite|hist|hist_7|histogram|hlogit|hlu|hmeans|hotel|hotelling|hprobit|hreg|hsearch|icd9|icd9_ff|icd9p|iis|impute|imtest|inbase|include|inf|infi|infil|infile|infix|inp|inpu|input|ins|insheet|insp|inspe|inspec|inspect|integ|inten|intreg|intreg_7|intreg_p|intrg2_ll|intrg_ll|intrg_ll2|ipolate|iqreg|ir|irf|irf_create|irfm|iri|is_svy|is_svysum|isid|istdize|ivprob_1_lf|ivprob_lf|ivprobit|ivprobit_p|ivreg|ivreg_footnote|ivtob_1_lf|ivtob_lf|ivtobit|ivtobit_p|jackknife|jacknife|jknife|jknife_6|jknife_8|jkstat|joinby|kalarma1|kap|kap_3|kapmeier|kappa|kapwgt|kdensity|kdensity_7|keep|ksm|ksmirnov|ktau|kwallis|l|la|lab|labe|label|labelbook|ladder|levels|levelsof|leverage|lfit|lfit_p|li|lincom|line|linktest|lis|list|lloghet_glf|lloghet_glf_sh|lloghet_gp|lloghet_ilf|lloghet_ilf_sh|lloghet_ip|llogi_sw|llogis_p|llogist|llogistic|llogistichet|lnorm_lf|lnorm_sw|lnorma_p|lnormal|lnormalhet|lnormhet_glf|lnormhet_glf_sh|lnormhet_gp|lnormhet_ilf|lnormhet_ilf_sh|lnormhet_ip|lnskew0|loadingplot|loc|loca|local|log|logi|logis_lf|logistic|logistic_p|logit|logit_estat|logit_p|loglogs|logrank|loneway|lookfor|lookup|lowess|lowess_7|lpredict|lrecomp|lroc|lroc_7|lrtest|ls|lsens|lsens_7|lsens_x|lstat|ltable|ltable_7|ltriang|lv|lvr2plot|lvr2plot_7|m|ma|mac|macr|macro|makecns|man|manova|manova_estat|manova_p|manovatest|mantel|mark|markin|markout|marksample|mat|mat_capp|mat_order|mat_put_rr|mat_rapp|mata|mata_clear|mata_describe|mata_drop|mata_matdescribe|mata_matsave|mata_matuse|mata_memory|mata_mlib|mata_mosave|mata_rename|mata_which|matalabel|matcproc|matlist|matname|matr|matri|matrix|matrix_input__dlg|matstrik|mcc|mcci|md0_|md1_|md1debug_|md2_|md2debug_|mds|mds_estat|mds_p|mdsconfig|mdslong|mdsmat|mdsshepard|mdytoe|mdytof|me_derd|mean|means|median|memory|memsize|meqparse|mer|merg|merge|mfp|mfx|mhelp|mhodds|minbound|mixed_ll|mixed_ll_reparm|mkassert|mkdir|mkmat|mkspline|ml|ml_5|ml_adjs|ml_bhhhs|ml_c_d|ml_check|ml_clear|ml_cnt|ml_debug|ml_defd|ml_e0|ml_e0_bfgs|ml_e0_cycle|ml_e0_dfp|ml_e0i|ml_e1|ml_e1_bfgs|ml_e1_bhhh|ml_e1_cycle|ml_e1_dfp|ml_e2|ml_e2_cycle|ml_ebfg0|ml_ebfr0|ml_ebfr1|ml_ebh0q|ml_ebhh0|ml_ebhr0|ml_ebr0i|ml_ecr0i|ml_edfp0|ml_edfr0|ml_edfr1|ml_edr0i|ml_eds|ml_eer0i|ml_egr0i|ml_elf|ml_elf_bfgs|ml_elf_bhhh|ml_elf_cycle|ml_elf_dfp|ml_elfi|ml_elfs|ml_enr0i|ml_enrr0|ml_erdu0|ml_erdu0_bfgs|ml_erdu0_bhhh|ml_erdu0_bhhhq|ml_erdu0_cycle|ml_erdu0_dfp|ml_erdu0_nrbfgs|ml_exde|ml_footnote|ml_geqnr|ml_grad0|ml_graph|ml_hbhhh|ml_hd0|ml_hold|ml_init|ml_inv|ml_log|ml_max|ml_mlout|ml_mlout_8|ml_model|ml_nb0|ml_opt|ml_p|ml_plot|ml_query|ml_rdgrd|ml_repor|ml_s_e|ml_score|ml_searc|ml_technique|ml_unhold|mleval|mlf_|mlmatbysum|mlmatsum|mlog|mlogi|mlogit|mlogit_footnote|mlogit_p|mlopts|mlsum|mlvecsum|mnl0_|mor|more|mov|move|mprobit|mprobit_lf|mprobit_p|mrdu0_|mrdu1_|mvdecode|mvencode|mvreg|mvreg_estat|n|nbreg|nbreg_al|nbreg_lf|nbreg_p|nbreg_sw|nestreg|net|newey|newey_7|newey_p|news|nl|nl_7|nl_9|nl_9_p|nl_p|nl_p_7|nlcom|nlcom_p|nlexp2|nlexp2_7|nlexp2a|nlexp2a_7|nlexp3|nlexp3_7|nlgom3|nlgom3_7|nlgom4|nlgom4_7|nlinit|nllog3|nllog3_7|nllog4|nllog4_7|nlog_rd|nlogit|nlogit_p|nlogitgen|nlogittree|nlpred|no|nobreak|noi|nois|noisi|noisil|noisily|note|notes|notes_dlg|nptrend|numlabel|numlist|odbc|old_ver|olo|olog|ologi|ologi_sw|ologit|ologit_p|ologitp|on|one|onew|onewa|oneway|op_colnm|op_comp|op_diff|op_inv|op_str|opr|opro|oprob|oprob_sw|oprobi|oprobi_p|oprobit|oprobitp|opts_exclusive|order|orthog|orthpoly|ou|out|outf|outfi|outfil|outfile|outs|outsh|outshe|outshee|outsheet|ovtest|pac|pac_7|palette|parse|parse_dissim|pause|pca|pca_8|pca_display|pca_estat|pca_p|pca_rotate|pcamat|pchart|pchart_7|pchi|pchi_7|pcorr|pctile|pentium|pergram|pergram_7|permute|permute_8|personal|peto_st|pkcollapse|pkcross|pkequiv|pkexamine|pkexamine_7|pkshape|pksumm|pksumm_7|pl|plo|plot|plugin|pnorm|pnorm_7|poisgof|poiss_lf|poiss_sw|poisso_p|poisson|poisson_estat|post|postclose|postfile|postutil|pperron|pr|prais|prais_e|prais_e2|prais_p|predict|predictnl|preserve|print|pro|prob|probi|probit|probit_estat|probit_p|proc_time|procoverlay|procrustes|procrustes_estat|procrustes_p|profiler|prog|progr|progra|program|prop|proportion|prtest|prtesti|pwcorr|pwd|q|s|qby|qbys|qchi|qchi_7|qladder|qladder_7|qnorm|qnorm_7|qqplot|qqplot_7|qreg|qreg_c|qreg_p|qreg_sw|qu|quadchk|quantile|quantile_7|que|quer|query|range|ranksum|ratio|rchart|rchart_7|rcof|recast|reclink|recode|reg|reg3|reg3_p|regdw|regr|regre|regre_p2|regres|regres_p|regress|regress_estat|regriv_p|remap|ren|rena|renam|rename|renpfix|repeat|replace|report|reshape|restore|ret|retu|retur|return|rm|rmdir|robvar|roccomp|roccomp_7|roccomp_8|rocf_lf|rocfit|rocfit_8|rocgold|rocplot|rocplot_7|roctab|roctab_7|rolling|rologit|rologit_p|rot|rota|rotat|rotate|rotatemat|rreg|rreg_p|ru|run|runtest|rvfplot|rvfplot_7|rvpplot|rvpplot_7|sa|safesum|sample|sampsi|sav|save|savedresults|saveold|sc|sca|scal|scala|scalar|scatter|scm_mine|sco|scob_lf|scob_p|scobi_sw|scobit|scor|score|scoreplot|scoreplot_help|scree|screeplot|screeplot_help|sdtest|sdtesti|se|search|separate|seperate|serrbar|serrbar_7|serset|set|set_defaults|sfrancia|sh|she|shel|shell|shewhart|shewhart_7|signestimationsample|signrank|signtest|simul|simul_7|simulate|simulate_8|sktest|sleep|slogit|slogit_d2|slogit_p|smooth|snapspan|so|sor|sort|spearman|spikeplot|spikeplot_7|spikeplt|spline_x|split|sqreg|sqreg_p|sret|sretu|sretur|sreturn|ssc|st|st_ct|st_hc|st_hcd|st_hcd_sh|st_is|st_issys|st_note|st_promo|st_set|st_show|st_smpl|st_subid|stack|statsby|statsby_8|stbase|stci|stci_7|stcox|stcox_estat|stcox_fr|stcox_fr_ll|stcox_p|stcox_sw|stcoxkm|stcoxkm_7|stcstat|stcurv|stcurve|stcurve_7|stdes|stem|stepwise|stereg|stfill|stgen|stir|stjoin|stmc|stmh|stphplot|stphplot_7|stphtest|stphtest_7|stptime|strate|strate_7|streg|streg_sw|streset|sts|sts_7|stset|stsplit|stsum|sttocc|sttoct|stvary|stweib|su|suest|suest_8|sum|summ|summa|summar|summari|summariz|summarize|sunflower|sureg|survcurv|survsum|svar|svar_p|svmat|svy|svy_disp|svy_dreg|svy_est|svy_est_7|svy_estat|svy_get|svy_gnbreg_p|svy_head|svy_header|svy_heckman_p|svy_heckprob_p|svy_intreg_p|svy_ivreg_p|svy_logistic_p|svy_logit_p|svy_mlogit_p|svy_nbreg_p|svy_ologit_p|svy_oprobit_p|svy_poisson_p|svy_probit_p|svy_regress_p|svy_sub|svy_sub_7|svy_x|svy_x_7|svy_x_p|svydes|svydes_8|svygen|svygnbreg|svyheckman|svyheckprob|svyintreg|svyintreg_7|svyintrg|svyivreg|svylc|svylog_p|svylogit|svymarkout|svymarkout_8|svymean|svymlog|svymlogit|svynbreg|svyolog|svyologit|svyoprob|svyoprobit|svyopts|svypois|svypois_7|svypoisson|svyprobit|svyprobt|svyprop|svyprop_7|svyratio|svyreg|svyreg_p|svyregress|svyset|svyset_7|svyset_8|svytab|svytab_7|svytest|svytotal|sw|sw_8|swcnreg|swcox|swereg|swilk|swlogis|swlogit|swologit|swoprbt|swpois|swprobit|swqreg|swtobit|swweib|symmetry|symmi|symplot|symplot_7|syntax|sysdescribe|sysdir|sysuse|szroeter|ta|tab|tab1|tab2|tab_or|tabd|tabdi|tabdis|tabdisp|tabi|table|tabodds|tabodds_7|tabstat|tabu|tabul|tabula|tabulat|tabulate|te|tempfile|tempname|tempvar|tes|test|testnl|testparm|teststd|tetrachoric|time_it|timer|tis|tob|tobi|tobit|tobit_p|tobit_sw|token|tokeni|tokeniz|tokenize|tostring|total|translate|translator|transmap|treat_ll|treatr_p|treatreg|trim|trnb_cons|trnb_mean|trpoiss_d2|trunc_ll|truncr_p|truncreg|tsappend|tset|tsfill|tsline|tsline_ex|tsreport|tsrevar|tsrline|tsset|tssmooth|tsunab|ttest|ttesti|tut_chk|tut_wait|tutorial|tw|tware_st|two|twoway|twoway__fpfit_serset|twoway__function_gen|twoway__histogram_gen|twoway__ipoint_serset|twoway__ipoints_serset|twoway__kdensity_gen|twoway__lfit_serset|twoway__normgen_gen|twoway__pci_serset|twoway__qfit_serset|twoway__scatteri_serset|twoway__sunflower_gen|twoway_ksm_serset|ty|typ|type|typeof|u|unab|unabbrev|unabcmd|update|us|use|uselabel|var|var_mkcompanion|var_p|varbasic|varfcast|vargranger|varirf|varirf_add|varirf_cgraph|varirf_create|varirf_ctable|varirf_describe|varirf_dir|varirf_drop|varirf_erase|varirf_graph|varirf_ograph|varirf_rename|varirf_set|varirf_table|varlist|varlmar|varnorm|varsoc|varstable|varstable_w|varstable_w2|varwle|vce|vec|vec_fevd|vec_mkphi|vec_p|vec_p_w|vecirf_create|veclmar|veclmar_w|vecnorm|vecnorm_w|vecrank|vecstable|verinst|vers|versi|versio|version|view|viewsource|vif|vwls|wdatetof|webdescribe|webseek|webuse|weib1_lf|weib2_lf|weib_lf|weib_lf0|weibhet_glf|weibhet_glf_sh|weibhet_glfa|weibhet_glfa_sh|weibhet_gp|weibhet_ilf|weibhet_ilf_sh|weibhet_ilfa|weibhet_ilfa_sh|weibhet_ip|weibu_sw|weibul_p|weibull|weibull_c|weibull_s|weibullhet|wh|whelp|whi|which|whil|while|wilc_st|wilcoxon|win|wind|windo|window|winexec|wntestb|wntestb_7|wntestq|xchart|xchart_7|xcorr|xcorr_7|xi|xi_6|xmlsav|xmlsave|xmluse|xpose|xsh|xshe|xshel|xshell|xt_iis|xt_tis|xtab_p|xtabond|xtbin_p|xtclog|xtcloglog|xtcloglog_8|xtcloglog_d2|xtcloglog_pa_p|xtcloglog_re_p|xtcnt_p|xtcorr|xtdata|xtdes|xtfront_p|xtfrontier|xtgee|xtgee_elink|xtgee_estat|xtgee_makeivar|xtgee_p|xtgee_plink|xtgls|xtgls_p|xthaus|xthausman|xtht_p|xthtaylor|xtile|xtint_p|xtintreg|xtintreg_8|xtintreg_d2|xtintreg_p|xtivp_1|xtivp_2|xtivreg|xtline|xtline_ex|xtlogit|xtlogit_8|xtlogit_d2|xtlogit_fe_p|xtlogit_pa_p|xtlogit_re_p|xtmixed|xtmixed_estat|xtmixed_p|xtnb_fe|xtnb_lf|xtnbreg|xtnbreg_pa_p|xtnbreg_refe_p|xtpcse|xtpcse_p|xtpois|xtpoisson|xtpoisson_d2|xtpoisson_pa_p|xtpoisson_refe_p|xtpred|xtprobit|xtprobit_8|xtprobit_d2|xtprobit_re_p|xtps_fe|xtps_lf|xtps_ren|xtps_ren_8|xtrar_p|xtrc|xtrc_p|xtrchh|xtrefe_p|xtreg|xtreg_be|xtreg_fe|xtreg_ml|xtreg_pa_p|xtreg_re|xtregar|xtrere_p|xtset|xtsf_ll|xtsf_llti|xtsum|xttab|xttest0|xttobit|xttobit_8|xttobit_p|xttrans|yx|yxview__barlike_draw|yxview_area_draw|yxview_bar_draw|yxview_dot_draw|yxview_dropline_draw|yxview_function_draw|yxview_iarrow_draw|yxview_ilabels_draw|yxview_normal_draw|yxview_pcarrow_draw|yxview_pcbarrow_draw|yxview_pccapsym_draw|yxview_pcscatter_draw|yxview_pcspike_draw|yxview_rarea_draw|yxview_rbar_draw|yxview_rbarm_draw|yxview_rcap_draw|yxview_rcapsym_draw|yxview_rconnected_draw|yxview_rline_draw|yxview_rscatter_draw|yxview_rspike_draw|yxview_spike_draw|yxview_sunflower_draw|zap_s|zinb|zinb_llf|zinb_plf|zip|zip_llf|zip_p|zip_plf|zt_ct_5|zt_hc_5|zt_hcd_5|zt_is_5|zt_iss_5|zt_sho_5|zt_smp_5|ztbase_5|ztcox_5|ztdes_5|ztereg_5|ztfill_5|ztgen_5|ztir_5|ztjoin_5|ztnb|ztnb_p|ztp|ztp_p|zts_5|ztset_5|ztspli_5|ztsum_5|zttoct_5|ztvary_5|ztweib_5)\\b" + - constant.number: "\\b[+-]?([0-9]+(\\.[0-9]+)?|\\.[0-9]+|\\.)([eE][+-]?[0-9]+)?[i]?\\b" + - symbol.operator: "-|==|<=|>=|<|>|&|!=" + - symbol.operator: "\\*|\\+|\\^|/|!|~|=|~=" + - symbol.brackets: "[\\{\\}\\(\\)\\[\\]]" + + - identifier: "%-?\\d{1,2}(\\.\\d{1,2})?[gfe]c?" + - identifier: "%(21x|16H|16L|8H|8L)" + - identifier: "%-?(tc|tC|td|tw|tm|tq|th|ty|tg).{0,32}" + - identifier: "%[-~]?\\d{1,4}s" + + - identifier.macro: "\\$\\w{1,32}" + - identifier.macro: + start: "`" + end: "'" + rules: [] + + - comment: + start: "///?" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "^\\s*\\*" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/svelte.yaml b/config/micro/syntax/svelte.yaml new file mode 100644 index 0000000..698299f --- /dev/null +++ b/config/micro/syntax/svelte.yaml @@ -0,0 +1,27 @@ +filetype: svelte + +detect: + filename: "\\.svelte$" + +rules: + - default: + start: "" + rules: + - include: "javascript" + + - default: + start: "" + rules: + - include: "typescript" + - default: + start: "" + end: "" + rules: + - include: "css" + - default: + start: "^" + end: "$" + rules: + - include: "html5" diff --git a/config/micro/syntax/swift.yaml b/config/micro/syntax/swift.yaml new file mode 100644 index 0000000..4874132 --- /dev/null +++ b/config/micro/syntax/swift.yaml @@ -0,0 +1,103 @@ +filetype: swift + +detect: + filename: "\\.swift$" + header: "^#!.*bin/(env +)?swift( |$)" + +rules: + + # Patterns + - type: \b(_)\b + + # Operators + - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&) + + # Declaration Keywords + - statement.declaration: \b(associatedtype|class|deinit|enum|extension|fileprivate|func|import|init)\b + - statement.declaration: \b(inout|internal|let|open|operator|private|protocol|public|static|struct|subscript|typealias|var)\b + + # Statements Keywords + - statement: \b(break|case|continue|default|defer|do|else|fallthrough|for|guard)\b + - statement: \b(if|inif|repeat|return|switch|where|while)\b + + # keyword.reserved + - statement.reserved: \b(associativity|convenience|dynamic|didSet|final|get|infix|indirect|lazy|left|mutating)\b + - statement.reserved: \b(none|nonmutating|override|postfix|precedence|prefix|Protocol|required)\b + - statement.reserved: \b(right|set|Type|unowned|weak|willSet)\b + + # Expression and types + - type: \b(as|Any|catch|is|rethrows|super|self|throw|throws|try)\b + + - statement.built_in: \b(abs|advance|alignof|alignofValue|anyGenerator|assert|assertionFailure|bridgeFromObjectiveC)\b + - statement.built_in: \b(bridgeFromObjectiveCUnconditional|bridgeToObjectiveC|bridgeToObjectiveCUnconditional|contains)\b + - statement.built_in: \b(count|countElements|countLeadingZeros|debugPrint|debugPrintln|distance|dropFirst|dropLast|dump|encodeBitsAsWords)\b + - statement.built_in: \b(enumerate|equal|fatalError|filter|find|getBridgedObjectiveCType|getVaList|indices|insertionSort)\b + - statement.built_in: \b(isBridgedToObjectiveC|isBridgedVerbatimToObjectiveC|isUniquelyReferenced|isUniquelyReferencedNonObjC)\b + - statement.built_in: \b(join|lexicographicalCompare|map|max|maxElement|min|minElement|numericCast|overlaps|partition|posix)\b + - statement.built_in: \b(precondition|preconditionFailure|print|println|quickSort|readLine|reduce|reflect)\b + - statement.built_in: \b(reinterpretCast!reverse|roundUpToAlignment|sizeof|sizeofValue|sort|split|startsWith|stride)\b + - statement.built_in: \b(strideof|strideofValue|swap|toString|transcode|underestimateCount|unsafeAddressOf|unsafeBitCast)\b + - statement.built_in: \b(unsafeDowncast|unsafeUnwrap|unsafeReflect|withExtendedLifetime|withObjectAtPlusZero|withUnsafePointer)\b + - statement.built_in: \b(withUnsafePointerToObject|withUnsafeMutablePointer|withUnsafeMutablePointers|withUnsafePointer)\b + - statement.built_in: \b(withUnsafePointers|withVaList|zip)\b + + # Meta + - statement.meta: \@\b(autoclosure|available|convention|exported|IBAction|IBDesignable|IBOutlet|IBInspectable|infix)\b + - statement.meta: \@\b(lazy|noreturn|noescape|nonobjc|NSApplicationMain|NSCopying|NSManaged|objc|prefix|postfix)\b + - statement.meta: \@\b(required|testable|warn_unused_result|UIApplicationMain)\b + + #preprocessor + - preproc: ^[[:space:]]*#[[:space:]]*(define|else|elseif|endif|if|selector)\b + - preproc.DebugIdentifier: \b(__COLUMN__|__FILE__|__FUNCTION__|__LINE__)\b + - preproc.DebugIdentifier: ^[[:space:]]*#[[:space:]]*(column|file|function|line)\b + + # Constant + - constant: \b(true|false|nil) + - constant.number: ([0-9]+) + + # Storage Types + - type.storage: \b((U)?Int(8|16|32|64))\b + - type.storage: \b(Int|UInt|String|Bit|Bool|Character|Double|Optional|Float|Range)\b + - type.storage: \b(AnyObject)\b + + # Collections + - type.collections: \b(Array|Dictionary|Set)\b + + # Ctypes + - type.ctypes: \b(CBool|CChar|CUnsignedChar|CShort|CUnsignedShort|CInt|CUnsignedInt|CLong|CUnsignedLong|CLongLong|CUnsignedLongLong|CWideChar|CChar16|CChar32|CFloat|CDouble)\b + + # String + - constant.string: + start: \" + end: \" + skip: \\. + rules: + - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\') + - constant.interpolation: \\\([[:graph:]]*\) + - constant.unicode: \\u\{[[:xdigit:]]+} + + # Shebang Line + - comment.shebang: ^(#!).* + + # Doc Comment + - comment.doc: (///).* + + # Line Comment + - comment.line: "//.*" + + # Block Comment + - comment.block: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + # Doc Block Comment + - comment.block: + start: "/\\*\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" + + # Todo + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/syntax_converter.go b/config/micro/syntax/syntax_converter.go new file mode 100644 index 0000000..1f3de5b --- /dev/null +++ b/config/micro/syntax/syntax_converter.go @@ -0,0 +1,165 @@ +//go:build ignore + +package main + +import ( + "fmt" + "os" + "regexp" + "strings" +) + +type SingleRule struct { + color string + regex string +} + +type MultiRule struct { + color string + start string + end string +} + +// JoinRule takes a syntax rule (which can be multiple regular expressions) +// and joins it into one regular expression by ORing everything together +func JoinRule(rule string) string { + split := strings.Split(rule, `" "`) + joined := strings.Join(split, "|") + return joined +} + +func parseFile(text, filename string) (filetype, syntax, header string, rules []any) { + lines := strings.Split(text, "\n") + + // Regex for parsing syntax statements + syntaxParser := regexp.MustCompile(`syntax "(.*?)"\s+"(.*)"+`) + // Regex for parsing header statements + headerParser := regexp.MustCompile(`header "(.*)"`) + + // Regex for parsing standard syntax rules + ruleParser := regexp.MustCompile(`color (.*?)\s+(?:\((.+?)?\)\s+)?"(.*)"`) + // Regex for parsing syntax rules with start="..." end="..." + ruleStartEndParser := regexp.MustCompile(`color (.*?)\s+(?:\((.+?)?\)\s+)?start="(.*)"\s+end="(.*)"`) + + for lineNum, line := range lines { + line = strings.TrimSpace(line) + if line == "" { + continue + } + if strings.HasPrefix(line, "#") { + continue + } + if strings.HasPrefix(line, "syntax") { + syntaxMatches := syntaxParser.FindSubmatch([]byte(line)) + if len(syntaxMatches) == 3 { + filetype = string(syntaxMatches[1]) + syntax = JoinRule(string(syntaxMatches[2])) + } else { + fmt.Println(filename, lineNum, "Syntax statement is not valid: "+line) + continue + } + } + if strings.HasPrefix(line, "header") { + // Header statement + headerMatches := headerParser.FindSubmatch([]byte(line)) + if len(headerMatches) == 2 { + header = JoinRule(string(headerMatches[1])) + } else { + fmt.Println(filename, lineNum, "Header statement is not valid: "+line) + continue + } + } + + // Syntax rule, but it could be standard or start-end + if ruleParser.MatchString(line) { + // Standard syntax rule + // Parse the line + submatch := ruleParser.FindSubmatch([]byte(line)) + var color string + var regexStr string + var flags string + if len(submatch) == 4 { + // If len is 4 then the user specified some additional flags to use + color = string(submatch[1]) + flags = string(submatch[2]) + if flags != "" { + regexStr = "(?" + flags + ")" + JoinRule(string(submatch[3])) + } else { + regexStr = JoinRule(string(submatch[3])) + } + } else if len(submatch) == 3 { + // If len is 3, no additional flags were given + color = string(submatch[1]) + regexStr = JoinRule(string(submatch[2])) + } else { + // If len is not 3 or 4 there is a problem + fmt.Println(filename, lineNum, "Invalid statement: "+line) + continue + } + + rules = append(rules, SingleRule{color, regexStr}) + } else if ruleStartEndParser.MatchString(line) { + // Start-end syntax rule + submatch := ruleStartEndParser.FindSubmatch([]byte(line)) + var color string + var start string + var end string + // Use m and s flags by default + if len(submatch) == 5 { + // If len is 5 the user provided some additional flags + color = string(submatch[1]) + start = string(submatch[3]) + end = string(submatch[4]) + } else if len(submatch) == 4 { + // If len is 4 the user did not provide additional flags + color = string(submatch[1]) + start = string(submatch[2]) + end = string(submatch[3]) + } else { + // If len is not 4 or 5 there is a problem + fmt.Println(filename, lineNum, "Invalid statement: "+line) + continue + } + + // rules[color] = "(?" + flags + ")" + "(" + start + ").*?(" + end + ")" + rules = append(rules, MultiRule{color, start, end}) + } + } + + return +} + +func generateFile(filetype, syntax, header string, rules []any) string { + output := "" + + output += fmt.Sprintf("filetype: %s\n\n", filetype) + output += fmt.Sprintf("detect: \n filename: \"%s\"\n", strings.Replace(strings.Replace(syntax, "\\", "\\\\", -1), "\"", "\\\"", -1)) + + if header != "" { + output += fmt.Sprintf(" signature: \"%s\"\n", strings.Replace(strings.Replace(header, "\\", "\\\\", -1), "\"", "\\\"", -1)) + } + + output += "\nrules:\n" + + for _, r := range rules { + if rule, ok := r.(SingleRule); ok { + output += fmt.Sprintf(" - %s: \"%s\"\n", rule.color, strings.Replace(strings.Replace(rule.regex, "\\", "\\\\", -1), "\"", "\\\"", -1)) + } else if rule, ok := r.(MultiRule); ok { + output += fmt.Sprintf(" - %s:\n", rule.color) + output += fmt.Sprintf(" start: \"%s\"\n", strings.Replace(strings.Replace(rule.start, "\\", "\\\\", -1), "\"", "\\\"", -1)) + output += fmt.Sprintf(" end: \"%s\"\n", strings.Replace(strings.Replace(rule.end, "\\", "\\\\", -1), "\"", "\\\"", -1)) + } + } + + return output +} + +func main() { + if len(os.Args) < 2 { + fmt.Println("no args") + return + } + + data, _ := os.ReadFile(os.Args[1]) + fmt.Print(generateFile(parseFile(string(data), os.Args[1]))) +} diff --git a/config/micro/syntax/systemd.yaml b/config/micro/syntax/systemd.yaml new file mode 100644 index 0000000..a8650be --- /dev/null +++ b/config/micro/syntax/systemd.yaml @@ -0,0 +1,16 @@ +filetype: systemd + +detect: + filename: "\\.(service|socket|timer)$" + header: "^\\[Unit\\]$" + +rules: + - statement: "^(Accept|After|Alias|AllowIsolate|Also|ANSI_COLOR|_AUDIT_LOGINUID|_AUDIT_SESSION|Backlog|Before|BindIPv6Only|BindsTo|BindToDevice|BlockIOReadBandwidth|BlockIOWeight|BlockIOWriteBandwidth|_BOOT_ID|Broadcast|BUG_REPORT_URL|BusName|Capabilities|CapabilityBoundingSet|CHASSIS|cipher|class|_CMDLINE|CODE_FILE|CODE_FUNC|CODE_LINE|_COMM|Compress|ConditionACPower|ConditionCapability|ConditionDirectoryNotEmpty|ConditionFileIsExecutable|ConditionFileNotEmpty|ConditionHost|ConditionKernelCommandLine|ConditionNull|ConditionPathExists|ConditionPathExistsGlob|ConditionPathIsDirectory|ConditionPathIsMountPoint|ConditionPathIsReadWrite|ConditionPathIsSymbolicLink|ConditionSecurity|ConditionVirtualization|Conflicts|ControlGroup|ControlGroupAttribute|ControlGroupModify|ControlGroupPersistent|controllers|Controllers|CPE_NAME|CPUAffinity|CPUSchedulingPolicy|CPUSchedulingPriority|CPUSchedulingResetOnFork|CPUShares|CrashChVT|CrashShell|__CURSOR|debug|DefaultControllers|DefaultDependencies|DefaultLimitAS|DefaultLimitCORE|DefaultLimitCPU|DefaultLimitDATA|DefaultLimitFSIZE|DefaultLimitLOCKS|DefaultLimitMEMLOCK|DefaultLimitMSGQUEUE|DefaultLimitNICE|DefaultLimitNOFILE|DefaultLimitNPROC|DefaultLimitRSS|DefaultLimitRTPRIO|DefaultLimitRTTIME|DefaultLimitSIGPENDING|DefaultLimitSTACK|DefaultStandardError|DefaultStandardOutput|Description|DeviceAllow|DeviceDeny|DirectoryMode|DirectoryNotEmpty|Documentation|DumpCore|entropy|Environment|EnvironmentFile|ERRNO|event_timeout|_EXE|ExecReload|ExecStart|ExecStartPost|ExecStartPre|ExecStop|ExecStopPost|ExecStopPre|filter|FONT|FONT_MAP|FONT_UNIMAP|ForwardToConsole|ForwardToKMsg|ForwardToSyslog|FreeBind|freq|FsckPassNo|fstab|_GID|Group|GuessMainPID|HandleHibernateKey|HandleLidSwitch|HandlePowerKey|HandleSuspendKey|hash|HibernateKeyIgnoreInhibited|HOME_URL|_HOSTNAME|ICON_NAME|ID|IdleAction|IdleActionSec|ID_LIKE|ID_MODEL|ID_MODEL_FROM_DATABASE|IgnoreOnIsolate|IgnoreOnSnapshot|IgnoreSIGPIPE|InaccessibleDirectories|InhibitDelayMaxSec|init|IOSchedulingClass|IOSchedulingPriority|IPTOS|IPTTL|JobTimeoutSec|JoinControllers|KeepAlive|KEYMAP|KEYMAP_TOGGLE|KillExcludeUsers|KillMode|KillOnlyUsers|KillSignal|KillUserProcesses|LidSwitchIgnoreInhibited|LimitAS|LimitCORE|LimitCPU|LimitDATA|LimitFSIZE|LimitLOCKS|LimitMEMLOCK|LimitMSGQUEUE|LimitNICE|LimitNOFILE|LimitNPROC|LimitRSS|LimitRTPRIO|LimitRTTIME|LimitSIGPENDING|LimitSTACK|link_priority|valueListenDatagram|ListenFIFO|ListenMessageQueue|ListenNetlink|ListenSequentialPacket|ListenSpecial|ListenStream|LogColor|LogLevel|LogLocation|LogTarget|luks|_MACHINE_ID|MakeDirectory|Mark|MaxConnections|MaxFileSec|MaxLevelConsole|MaxLevelKMsg|MaxLevelStore|MaxLevelSyslog|MaxRetentionSec|MemoryLimit|MemorySoftLimit|MESSAGE|MESSAGE_ID|MessageQueueMaxMessages|MessageQueueMessageSize|__MONOTONIC_TIMESTAMP|MountFlags|NAME|NAutoVTs|Nice|NonBlocking|NoNewPrivileges|NotifyAccess|OnActiveSec|OnBootSec|OnCalendar|OnFailure|OnFailureIsolate|OnStartupSec|OnUnitActiveSec|OnUnitInactiveSec|OOMScoreAdjust|Options|output|PAMName|PartOf|PassCredentials|PassSecurity|PathChanged|PathExists|PathExistsGlob|PathModified|PermissionsStartOnly|_PID|PIDFile|PipeSize|PowerKeyIgnoreInhibited|PRETTY_HOSTNAME|PRETTY_NAME|Priority|PRIORITY|PrivateNetwork|PrivateTmp|PropagatesReloadTo|pss|RateLimitBurst|RateLimitInterval|ReadOnlyDirectories|ReadWriteDirectories|__REALTIME_TIMESTAMP|ReceiveBuffer|RefuseManualStart|RefuseManualStop|rel|ReloadPropagatedFrom|RemainAfterExit|RequiredBy|Requires|RequiresMountsFor|RequiresOverridable|Requisite|RequisiteOverridable|ReserveVT|ResetControllers|Restart|RestartPreventExitStatus|RestartSec|RootDirectory|RootDirectoryStartOnly|RuntimeKeepFree|RuntimeMaxFileSize|RuntimeMaxUse|RuntimeWatchdogSec|samples|scale_x|scale_y|Seal|SecureBits|_SELINUX_CONTEXT|SendBuffer|SendSIGKILL|Service|ShowStatus|ShutdownWatchdogSec|size|SmackLabel|SmackLabelIPIn|SmackLabelIPOut|SocketMode|Sockets|SourcePath|_SOURCE_REALTIME_TIMESTAMP|SplitMode|StandardError|StandardInput|StandardOutput|StartLimitAction|StartLimitBurst|StartLimitInterval|static_node|StopWhenUnneeded|Storage|string_escape|none|replaceSuccessExitStatus|SupplementaryGroups|SUPPORT_URL|SuspendKeyIgnoreInhibited|SyslogFacility|SYSLOG_FACILITY|SyslogIdentifier|SYSLOG_IDENTIFIER|SyslogLevel|SyslogLevelPrefix|SYSLOG_PID|SystemCallFilter|SYSTEMD_ALIAS|_SYSTEMD_CGROUP|_SYSTEMD_OWNER_UID|SYSTEMD_READY|_SYSTEMD_SESSION|_SYSTEMD_UNIT|_SYSTEMD_USER_UNIT|SYSTEMD_WANTS|SystemKeepFree|SystemMaxFileSize|SystemMaxUse|SysVStartPriority|TCPCongestion|TCPWrapName|timeout|TimeoutSec|TimeoutStartSec|TimeoutStopSec|TimerSlackNSec|Transparent|_TRANSPORT|tries|TTYPath|TTYReset|TTYVHangup|TTYVTDisallocate|Type|_UID|UMask|Unit|User|UtmpIdentifier|VERSION|VERSION_ID|WantedBy|Wants|WatchdogSec|What|Where|WorkingDirectory)=" + - preproc: "^\\.include\\>" + - symbol: "=" + - special: "^\\[(Unit|Install|Service|Socket|Timer)\\]" + - identifier.class: "\\$MAINPID" + - constant.bool: "\\b(true|false)\\b" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/tcl.yaml b/config/micro/syntax/tcl.yaml new file mode 100644 index 0000000..b87a7d7 --- /dev/null +++ b/config/micro/syntax/tcl.yaml @@ -0,0 +1,18 @@ +filetype: tcl + +detect: + filename: "\\.tcl$" + header: "^#!.*/(env +)?tclsh( |$)" + +rules: + - statement: "\\b(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|else|elseif|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\\b" + - statement: "\\b(array anymore|array donesearch|array exists|array get|array names|array nextelement|array set|array size|array startsearch|array statistics|array unset)\\b" + - statement: "\\b(string bytelength|string compare|string equal|string first|string index|string is|string last|string length|string map|string match|string range|string repeat|string replace|string to|string tolower|string totitle|string toupper|string trim|string trimleft|string trimright|string will|string wordend|string wordstart)\\b" + - statement: "\\b(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\\b" + - identifier.class: "proc[[:space:]]|(\\{|\\})" + - symbol.operator: "(\\(|\\)|\\;|`|\\\\|\\$|<|>|!|=|&|\\|)" + - constant.number: "\\b[0-9]+(\\.[0-9]+)?\\b" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - identifier.var: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" + - comment: "(^|;)[[:space:]]*#.*" + - indent-char.whitespace: "[[:space:]]+$" diff --git a/config/micro/syntax/terraform.yaml b/config/micro/syntax/terraform.yaml new file mode 100644 index 0000000..62dee25 --- /dev/null +++ b/config/micro/syntax/terraform.yaml @@ -0,0 +1,87 @@ +# +# This syntax definition is based on the Terraform guide: +# https://www.terraform.io/docs/configuration/index.html +# +# Formatting is loosely based on Sublime's and VSCode's syntax highlighting for Terraform: +# https://github.com/totoroot/Terraform.tmLanguage/blob/master/Terraform.sublime-syntax +# https://github.com/hashicorp/vscode-terraform/blob/main/syntaxes/terraform.tmGrammar.json +# + +filetype: terraform + +detect: + # File Extensions: + # + # - ".tf": the standard file extension + # https://www.terraform.io/docs/configuration/index.html#code-organization + # + # - ".hcl": non-terraform tools often use this HCL syntax, i.e. Vault + # https://www.vaultproject.io/docs/configuration/ + filename: "\\.tf$|\\.hcl$" + +rules: + # Named Values + # + # https://www.terraform.io/docs/language/expressions/references.html + - identifier: "\\b(var|local|module|data|path|terraform)\\b" + + # Block types + # + # resource: https://www.terraform.io/docs/language/resources/syntax.html + # provider: https://www.terraform.io/docs/language/providers/configuration.html + # variable: https://www.terraform.io/docs/language/values/variables.html + # output: https://www.terraform.io/docs/language/values/outputs.html + # locals: https://www.terraform.io/docs/language/values/locals.html + # module: https://www.terraform.io/docs/language/modules/syntax.html + # data: https://www.terraform.io/docs/language/data-sources/index.html + # terraform: https://www.terraform.io/docs/language/settings/index.html#terraform-block-syntax + - special: "\\b(resource|provider|variable|output|locals|module|terraform)\\b" + + # Built-In type keywords + # + # https://www.terraform.io/docs/language/expressions/type-constraints.html#primitive-types + # https://www.terraform.io/docs/language/expressions/type-constraints.html#dynamic-types-the-quot-any-quot-constraint + - type.keyword: "\\b(any|string|number|bool)\\b" + + # Built-In Functions + # + # https://www.terraform.io/docs/language/functions/index.html + - statement: "\\b(abs|ceil|floor|log|max|min|parseint|pow|signum|chomp|format|formatlist|indent|join|lower|regex|regexall|replace|split|strrev|substr|title|trim|trimprefix|trimsuffix|trimspace|upper|alltrue|anytrue|chunklist|coalesce|coalescelist|compact|concat|contains|distinct|element|flatten|index|keys|length|list|lookup|map|matchkeys|merge|one|range|reverse|setintersection|setproduct|setsubtract|setunion|slice|sort|sum|transpose|values|zipmap|base64decode|base64encode|base64gzip|csvdecode|jsondecode|jsonencode|textdecodebase64|textencodebase64|urlencode|yamldecode|yamlencode|abspath|dirname|pathexpand|basename|file|fileexists|fileset|filebase64|templatefile|formatdate|timeadd|timestamp|base64sha256|base64sha512|bcrypt|filebase64sha256|filebase64sha512|filemd5|filesha1|filesha256|filesha512|md5|rsadecrypt|sha1|sha256|sha512|uuid|uuidv5|cidrhost|cidrnetmask|cidrsubnet|cidrsubnets|can|defaults|nonsensitive|sensitive|tobool|tolist|tomap|tonumber|toset|tostring|try)\\b" + + - symbol.operator: "([~^.:;,+*|=!\\%@]|<|>|/|-|&)" + + - symbol.brackets: "([(){}]|\\[|\\])" + + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" + + - constant.bool: "\\b(true|false|null)\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - constant.string: + start: "''" + end: "''" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - comment: + start: "#|//" + end: "$\\n?" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/tex.yaml b/config/micro/syntax/tex.yaml new file mode 100644 index 0000000..3ff8448 --- /dev/null +++ b/config/micro/syntax/tex.yaml @@ -0,0 +1,32 @@ +filetype: tex + +detect: + filename: "\\.tex$|\\.bib$|\\.cls$" + +rules: + # colorize the identifiers of {} and [] + - identifier: + start: "\\{" + end: "\\}" + rules: [] + - identifier: + start: "\\[" + end: "\\]" + rules: [] + # numbers + - constant.number: "\\b[0-9]+(\\.[0-9]+)?([[:space:]](pt|mm|cm|in|ex|em|bp|pc|dd|cc|nd|nc|sp))?\\b" + # let brackets have the default color again + - default: "[{}\\[\\]]" + - special: "[&\\\\]" + # macros + - statement: "\\\\@?[a-zA-Z_]+" + - statement: "\\\\%" + # comments + - comment: + start: "[^\\\\]%|^%" + end: "$" + rules: [] + - comment: + start: "\\\\begin\\{comment\\}" + end: "\\\\end\\{comment\\}" + rules: [] diff --git a/config/micro/syntax/toml.yaml b/config/micro/syntax/toml.yaml new file mode 100644 index 0000000..807872d --- /dev/null +++ b/config/micro/syntax/toml.yaml @@ -0,0 +1,56 @@ +filetype: toml + +detect: + filename: "\\.toml" + +rules: + # Punctuation + - symbol: '[=,\.]' + - symbol.brackets: '[{\[\]}]' + # Strings + - constant.string: + start: '"""' + end: '\"{3,5}' + skip: '\\.' + rules: + - constant.specialChar: '\\u[[:xdigit:]]{4}' + - constant.specialChar: '\\U[[:xdigit:]]{8}' + - constant.specialChar: '\\[btnfr"\\]' + - constant.string: + start: '"' + end: '"' + skip: '\\.' + rules: + - constant.specialChar: '\\u[[:xdigit:]]{4}' + - constant.specialChar: '\\U[[:xdigit:]]{8}' + - constant.specialChar: '\\[btnfr"\\]' + - constant.string: + start: "'''" + end: "'{3,5}" + rules: [] + - constant.string: + start: "'" + end: "'" + rules: [] + # Integer + - constant.number: '[+-]?(\d+_)*\d+\b' + - constant.number: '(0x([[:xdigit:]]+_)*[[:xdigit:]]+|0o([0-7]_)*[0-7]+|0b([01]+_)*[01]+)' + # Float + - constant.number: '[+-]?(\d+_)*\d+\.(\d+_)*\d+' + - constant.number: '[+-]?(\d+_)*\d+(\.(\d+_)*\d+)?[Ee][+-]?(\d+_)*\d+' + - constant.number: '(\+|-)(inf|nan)' + # Bare key, keys starting with a digit or dash are ambiguous with numbers and are skipped + - identifier: '\b[A-Za-z_][A-Za-z0-9_-]*\b' + # Boolean and inf, nan without sign + - constant.bool.true: '\btrue\b' + - constant.bool.false: '\bfalse\b' + - constant.number: '\b(inf|nan)\b' + # Date and Time + - constant: '\d+-\d{2}-\d{2}([T ]\d{2}:\d{2}:\d{2}(\.\d+)?([+-]\d{2}:\d{2}|Z)?)?' + - constant: '\d{2}:\d{2}:\d{2}(\.\d+)?' + # Comments + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/twig.yaml b/config/micro/syntax/twig.yaml new file mode 100644 index 0000000..b5409d1 --- /dev/null +++ b/config/micro/syntax/twig.yaml @@ -0,0 +1,55 @@ +filetype: twig + +detect: + filename: "\\.twig$" + +rules: + - include: "html" + - symbol.tag: + start: "\\{\\{[[:space:]]" + end: "[[:space:]]\\}\\}" + rules: + - identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b" + - identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b" + - type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b" + - symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&" + - symbol.brackets: "[(){}]|\\[|\\]" + - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\" + rules: + - constant.specialChar: "\\\\." + - symbol.tag: + start: "\\{%[[:space:]]" + end: "[[:space:]]%\\}" + rules: + - identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b" + - identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b" + - type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b" + - symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&" + - symbol.brackets: "[(){}]|\\[|\\]" + - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\" + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\" + rules: + - constant.specialChar: "\\\\." + - comment: + start: "\\{#" + end: "#\\}" + rules: [] diff --git a/config/micro/syntax/typescript.yaml b/config/micro/syntax/typescript.yaml new file mode 100644 index 0000000..958a7db --- /dev/null +++ b/config/micro/syntax/typescript.yaml @@ -0,0 +1,49 @@ +filetype: typescript + +detect: + filename: "\\.tsx?$" + +rules: + - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b" + - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?" + - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?" + - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" + - statement: "\\b(abstract|as|async|await|break|case|catch|class|const|constructor|continue)\\b" + - statement: "\\b(debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from)\\b" + - statement: "\\b(function|get|if|implements|import|in|instanceof|interface|is|let|module|namespace)\\b" + - statement: "\\b(new|of|package|private|protected|public|require|return|set|static|super|switch)\\b" + - statement: "\\b(this|throw|try|type|typeof|var|void|while|with|yield)\\b" + - constant: "\\b(false|true|null|undefined|NaN)\\b" + - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b" + - type: "\\b(Number|Object|RegExp|String|Symbol)\\b" + - type: "\\b(any|unknown|boolean|never|number|string|symbol)\\b" + - statement: "[-+/*=<>!~%?:&|]" + - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*" + - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]" + - comment: + start: "//" + end: "$" + rules: [] + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "TODO:?" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "`" + end: "`" + rules: + - constant.specialChar: "\\\\." + - identifier: "\\x24\\{.*?\\}" diff --git a/config/micro/syntax/v.yaml b/config/micro/syntax/v.yaml new file mode 100644 index 0000000..304947b --- /dev/null +++ b/config/micro/syntax/v.yaml @@ -0,0 +1,80 @@ +filetype: v + +detect: + +rules: + # Conditionals and control flow + - preproc: "\\b(module|import)\\b" + - statement: "\\b(if|else|for|match|select|defer|or|unsafe)\\b" + - statement: "\\b(break|continue|goto|return)\\b" + - type.keyword: "\\b(assert|const|enum|fn|struct|interface|type)\\b" + - type.keyword: "\\b(pub|mut|__global)\\b" + + - preproc: "\\$\\b(if|else)\\b" + - identifier.os: "\\b(mac|macos|linux|windows|freebsd|openbsd|netbsd|dragonfly|android|solaris|haiku)\\b" + - identifier.compiler: "\\b(gcc|tinyc|clang|mingw|msvc|cplusplus)\\b" + - identifier.platform: "\\b(amd64|aarch64|x64|x32|little_endian|big_endian)\\b" + - identifier.other: "\\b(debug|test|js|glibc|prealloc|no_bounds_checking)\\b" + + - identifier.class: "\\b([A-Z][A-Za-z0-9_]*)\\b" + - identifier.function: "\\b([a-z_]+\\()" + - symbol.operator: "\\b(i[ns])\\b|[-+/*<>!=~*%&:|,.?]" + - symbol.attribute: + start: "^\\[" + end: "\\]$" + rules: + - default: ".*" + - symbol: "\\b(deprecated|direct_array_access|if|inline|live|ref_only|typedef|windows_stdcall)\\b" + + # Types + - type: "\\b(byte|u(16|32|64|128)|i(nt|8|16|64|128)|f(32|64))\\b" + - type: "\\b(bool|cha[nr]|map|rune|string)\\b" + - type: "\\b(any(_int|_float)?|size_t|(uint|byte|char|void)ptr)\\b" + - constant.bool: "\\b(true|false)\\b" + - constant.none: "\\b(none)\\b" + + # Brackets + - symbol.brackets: "(\\{|\\})" + - symbol.brackets: "(\\(|\\))" + - symbol.brackets: "(\\[|\\])" + + # Numbers and strings + - constant.number: "\\b(0b[01_]+)\\b" + - constant.number: "\\b(0o[0-7_]+)\\b" + - constant.number: "\\b(0x[0-9a-fA-F_]+)\\b" + - constant.number: "\\b([0-9_]+)\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abefnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "%." + - constant.specialChar: "\\\\[abefnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + + - constant.string: + start: "`" + end: "`" + rules: [] + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/vala.yaml b/config/micro/syntax/vala.yaml new file mode 100644 index 0000000..995c3fa --- /dev/null +++ b/config/micro/syntax/vala.yaml @@ -0,0 +1,26 @@ +filetype: vala + +detect: + filename: "\\.vala$" + +rules: + - type: "\\b(float|double|bool|u?char|u?int(8|16|32|64)?|u?short|u?long|void|s?size_t|unichar)\\b" + - identifier.class: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]" + - statement: "\\b(for|if|while|do|else|case|default|switch|try|throw|catch)\\b" + - statement: "\\b(inline|typedef|struct|enum|union|extern|static|const)\\b" + - statement: "\\b(operator|new|delete|return|null)\\b" + - statement: "\\b(class|override|private|public|signal|this|weak)\\b" + - special: "\\b(goto|break|continue)\\b" + - constant.bool: "\\b(true|false)\\b" + - constant.number: "\\b([0-9]+)\\b" + - symbol.operator: "[\\-+/*=<>?:!~%&|]|->" + - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'" + - comment: "(^|[[:space:]])//.*" + - comment: + start: "/\\*" + end: "\\*/" + rules: [] + + - todo: "TODO:?" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/verilog.yaml b/config/micro/syntax/verilog.yaml new file mode 100644 index 0000000..d6de753 --- /dev/null +++ b/config/micro/syntax/verilog.yaml @@ -0,0 +1,60 @@ +filetype: verilog + +detect: + filename: "\\.(v|vh|sv|svh)$" + +rules: + - preproc: "\\b(module|package|program|endmodule|endpackage|endprogram)\\b" + - type.keyword: "\\b(task|interface|class|endtask|endinterface|endclass)\\b" + # builtin functions like $display + - special: "\\$[0-9A-Za-z_]+" + + # Verilog keywords + - statement: "\\b(always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|cmos|config)\\b" + - statement: "\\b(deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate)\\b" + - statement: "\\b(endprimitive|endspecify|endtable|event|for|force|forever|fork|function|generate)\\b" + - statement: "\\b(genvar|highz0|highz1|if|iff|ifnone|incdir|include|initial|input|instance|join)\\b" + - statement: "\\b(large|liblist|library|localparam|macromodule|medium|nand|negedge|nmos|nor|noshowcancelled)\\b" + - statement: "\\b(not|notif0|notif1|null|or|output|parameter|pmos|posedge|primitive|pull0|pull1|pulldown|pullup)\\b" + - statement: "\\b(pulsestyle_onevent|pulsestyle_ondetect|rcmos|realtime|reg|release|repeat|rnmos|rpmos|rtran)\\b" + - statement: "\\b(rtranif0|rtranif1|scalared|showcancelled|small|specify|specparam|strong0|strong1|supply0)\\b" + - statement: "\\b(supply1|table|time|tran|tranif0|tranif1|tri0|tri1|triand|trior|trireg|use|uwire)\\b" + - statement: "\\b(vectored|wait|wand|weak0|weak1|while|wor|xnor|xor)\\b" + + # SystemVerilog keywords + - statement: "\\b(alias|always_comb|always_ff|always_latch|assert|assume|before|bind|bins|binsof|break)\\b" + - statement: "\\b(chandle|clocking|const|constraint|context|continue|cover|covergroup|coverpoint|cross|dist|do)\\b" + - statement: "\\b(endclocking|endgroup|endproperty|endsequence|enum)\\b" + - statement: "\\b(expect|export|extends|extern|final|first_match|foreach|forkjoin|ignore_bins|illegal_bins|import)\\b" + - statement: "\\b(inside|intersect|join_any|join_none|local|longint|matches|modport|new)\\b" + - statement: "\\b(packed|priority|property|protected|pure|rand|randc|randcase|randsequence|ref|return)\\b" + - statement: "\\b(sequence|solve|static|struct|super|tagged|this|throughout|timeprecision)\\b" + - statement: "\\b(timeunit|type|typedef|union|unique|virtual|wait_order|wildcard|with|within)\\b" + + # types + - type.keyword: "\\b(int|integer|logic|wire|tri|unsigned|signed|inout|var|shortint|shortreal|real|void|string|bit|byte)\\b" + + # constants + - constant.number: "\\b[0-9]+\\b" + - constant.number: "\\b'[su]?[dboh][0-9xzXZa-fA-F]+\\b" + # .asdf(...) argument syntax + - special: "\\.((\\*)|([A-Za-z][A-Za-z0-9_]*))" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/vhdl.yaml b/config/micro/syntax/vhdl.yaml new file mode 100644 index 0000000..2c04318 --- /dev/null +++ b/config/micro/syntax/vhdl.yaml @@ -0,0 +1,37 @@ +filetype: vhdl + +detect: + filename: "\\.vhdl?$" + +rules: + - type: "(?i)\\b(string|integer|natural|positive|(un)?signed|std_u?logic(_vector)?|bit(_vector)?|boolean|u?x01z?|array|range)\\b" + - identifier: "(?i)library[[:space:]]+[a-zA-Z_0-9]+" + - identifier: "(?i)use[[:space:]]+[a-zA-Z_0-9\\.]+" + - identifier: "(?i)component[[:space:]]+[a-zA-Z_0-9]+" + - identifier: "(?i)(architecture|configuration)[[:space:]]+[a-zA-Z_0-9]+[[:space:]]+of[[:space:]]+[a-zA-Z_0-9]+" + - identifier: "(?i)(entity|package)[[:space:]]+[a-zA-Z_0-9]+[[:space:]]+is" + - identifier: "(?i)end[[:space:]]+((architecture|entity|component|process|package|generate)[[:space:]]+)?[a-zA-Z_0-9]+" + - statement: "(?i)\\b(abs|access|after|alias|all|and|architecture|assert|attribute)\\b" + - statement: "(?i)\\b(begin|block|body|buffer|bus|case|component|configuration|constant)\\b" + - statement: "(?i)\\b(disconnect|downto|else|elsif|end|entity|exit)\\b" + - statement: "(?i)\\b(file|for|function|generate|generic|guarded)\\b" + - statement: "(?i)\\b(if|impure|in|inertial|inout|is)\\b" + - statement: "(?i)\\b(label|library|linkage|literal|loop|map|mod)\\b" + - statement: "(?i)\\b(nand|new|next|nor|not|null|of|on|open|or|others|out)\\b" + - statement: "(?i)\\b(package|port|postponed|procedure|process|pure)\\b" + - statement: "(?i)\\b(range|record|register|reject|rem|report|return|rol|ror)\\b" + - statement: "(?i)\\b(select|severity|shared|signal|sla|sll|sra|srl|subtype)\\b" + - statement: "(?i)\\b(then|to|transport|type|unaffected|units|until|use)\\b" + - statement: "(?i)\\b(variable|wait|when|while|with|xnor|xor)\\b" + - statement: "(?i)'(base|left|right|high|low|pos|val|succ|pred|leftof|rightof|image|(last_)?value)" + - statement: "(?i)'((reverse_)?range|length|ascending|event|stable)" + - statement: "(?i)'(simple|path|instance)_name" + - statement: "(?i)\\b(std_match|(rising|falling)_edge|is_x)\\b" + - statement: "(?i)\\bto_(unsigned|signed|integer|u?x01z?|stdu?logic(vector)?)\\b" + - symbol.operator: "(\\+|-|\\*|/|&|<|>|=|\\.|:)" + - constant.number: "(?i)'([0-1]|u|x|z|w|l|h|-)'|[box]?\"([0-1a-fA-F]|u|x|z|w|l|h|-)+\"" + - constant.number: "(?i)\\b[0-9\\._]+(e[\\-]?[0-9]+)?( ?[fpnum]?s)?\\b" + - constant.bool: "(?i)\\b(true|false)\\b" + - constant: "(?i)\\b(note|warning|error|failure)\\b" + - constant.string: "\"[^\"]*\"" + - comment: "--.*" diff --git a/config/micro/syntax/vi.yaml b/config/micro/syntax/vi.yaml new file mode 100644 index 0000000..2a828dc --- /dev/null +++ b/config/micro/syntax/vi.yaml @@ -0,0 +1,31 @@ +filetype: vi + +detect: + filename: "(^|/|\\.)(ex|vim)rc$|\\.vim" + +rules: + - identifier: "[A-Za-z_][A-Za-z0-9_]*[(]+[A-Za-z0-9_:.,\\s]*[)]+" + - special: "[()]+" + - statement: "\\b([nvxsoilc]?(nore|un)?map|[nvlx]n|[ico]?no|[cilovx][um]|s?unm)\\b" + - statement: "\\b(snor|nun|nm|set|if|endif|let|unlet|source)\\b" + - statement: "[!&=?]" + - constant.number: "\\b[0-9]+\\b" + + - comment: + start: "(^\"|[ \t]+\" |[ \t]+\"$)" + end: "$" + rules: [] + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." diff --git a/config/micro/syntax/vue.yaml b/config/micro/syntax/vue.yaml new file mode 100644 index 0000000..d5e10c3 --- /dev/null +++ b/config/micro/syntax/vue.yaml @@ -0,0 +1,64 @@ +filetype: vue + +detect: + filename: "\\.vue$" + +rules: + - default: + start: "" + end: "" + limit-group: symbol.tag + rules: + - error: "<[^!].*?>" + - symbol.tag: "(?i)<[/]?(a|a(bbr|ddress|rea|rticle|side|udio)|b|b(ase|d(i|o)|lockquote|r|utton)|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata|atalist|d|el|etails|fn|ialog|l|t)|em|embed|fieldset|fig(caption|ure)|form|iframe|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li|link|ma(in|p|rk)|menu|menuitem|met(a|er)|nav|noscript|o(bject|l|pt(group|ion)|utput)|p|param|picture|pre|progress|q|r(p|t|uby)|s|samp|se(ction|lect)|svg|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u|ul|var|video|wbr)( .*)*?>" + - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>" + - preproc: "(?i)<[/]?(script|style)( .*)*?>" + - special: "&[^;[[:space:]]]*;" + + - identifier: "(alt|bgcolor|class|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|placeholder|size|span|src|style|target|type|value|width)=" + - symbol: "[:=]" + - constant.string: "\"[^\"]*\"" + - constant.number: "(?i)#[0-9a-fA-F]{6,6}" + + - symbol.tag: "<|>" + - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+" + - comment: "" + #- preproc: "" + - comment.block: + start: "" + rules: [] + + # Bootstrap + - symbol.tag.extended: "(?i)<[/]?(b-alert|b-aspect|b-avatar|b-badge|b-icon|b-breadcrumb|b-button-group|b-button-toolbar|b-button|b-calendar|b-card-text|b-card-input|b-card|b-carousel-slide|b-carousel|b-collapse|b-dropdown|b-dropdown-item|b-dropdown-divider|b-embed|b-form-checkbox-group|b-form-checkbox|b-form-datepicker|b-form-file|b-form-group|b-form-input|b-form-radio|b-form-rating|b-form-select|b-form-spinbutton|b-form-tags|b-form-textarea|b-form|b-form-timepicker|b-img-lazy|b-img|b-input-group|b-jumbotron|b-input|b-container|b-row|b-col|b-link|b-list-group|b-list-group-item|b-media|b-modal|b-nav|b-nav-item|b-nav-item-dropdown|b-nav-text|b-nav-form|b-navbar|b-navbar-brand|b-navbar-toggle|b-navbar-nav|b-overlay|b-pagination|b-pagination-nav|b-popover|b-progress|b-progress-bar|b-sidebar|b-skeleton-wrapper|b-skeleton|b-spinner|b-table|b-table-lite|b-table-simple|b-tabs|b-tab|b-time|b-toast|b-tooltip)\\b" + - identifier: "(variant|title|show|shadow|icon|align-h|align-v|label-for|@submit|tag|img-alt|img-src|data-toggle|data-target|aria-controls|aria-expanded|aria-label|aria-disabled|tabindex|:interval|background|img-width|img-height|@sliding-start|@sliding-end|cols|header|@reset)=" + - symbol: "[:=]" + # Vue + - symbol.tag.extended: "(?i)<[/]?(component|transition|transition-group|keep-alive|slot)\\b" + - identifier: "(v-text|v-html|v-show|v-if|v-else|v-else-if|v-for|v-on|v-bind|v-model|v-slot|v-pre|v-cloak|v-once|key|ref|is|@click)=" + - symbol: "[:=]" + # Vue-router + - symbol.tag.extended: "(?i)<[/]?(router-link|router-view)\\b" + - identifier: "(to|v-slot)=" + - symbol: "[:=]" + + + - default: + start: "" + limit-group: symbol.tag + rules: + - include: "javascript" + + - default: + start: "" + end: "" + rules: + - include: "typescript" + + - default: + start: "" + end: "" + limit-group: symbol.tag + rules: + - include: "css" diff --git a/config/micro/syntax/xml.yaml b/config/micro/syntax/xml.yaml new file mode 100644 index 0000000..df4cde8 --- /dev/null +++ b/config/micro/syntax/xml.yaml @@ -0,0 +1,37 @@ +filetype: xml + +detect: + filename: "\\.(xml|sgml?|rng|svg|plist)$" + header: "<\\?xml.*\\?>" + +rules: + - preproc: + start: "" + rules: [] + + - comment: + start: "" + rules: [] + + - symbol.tag: + start: "<\\??" + end: "\\??>" + rules: + - identifier: + start: " " + end: "=" + rules: [] + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." diff --git a/config/micro/syntax/xresources.yaml b/config/micro/syntax/xresources.yaml new file mode 100644 index 0000000..d8b877c --- /dev/null +++ b/config/micro/syntax/xresources.yaml @@ -0,0 +1,14 @@ +filetype: xresources + +detect: + filename: "X(defaults|resources)$" + +rules: + - special: "^[[:alnum:]]+\\*" + - identifier.var: "\\*[[:alnum:]]+\\:" + - constant.number: "\\b[0-9]+\\b" + - symbol.operator: "[*:=]" + - constant.bool: "\\b(true|false)\\b" + - comment: "(^|[[:space:]])!([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/yaml.yaml b/config/micro/syntax/yaml.yaml new file mode 100644 index 0000000..54d4a64 --- /dev/null +++ b/config/micro/syntax/yaml.yaml @@ -0,0 +1,34 @@ +filetype: yaml + +detect: + filename: "\\.ya?ml$" + header: "%YAML" + +rules: + - type: "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) " + - constant: "\\b(YES|yes|Y|y|ON|on|TRUE|True|true|NO|no|N|n|OFF|off|FALSE|False|false)\\b" + - statement: "(:[[:space:]]|\\[|\\]|:[[:space:]]+[|>]|^[[:space:]]*- )" + - identifier: "[[:space:]][\\*&][A-Za-z0-9]+" + - type: "[-.\\w]+:" + - statement: ":" + - special: "(^---|^\\.\\.\\.|^%YAML|^%TAG)" + + - constant.string: + start: "(^| )\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "(^| )'" + end: "'" + skip: "(\\\\.)|('')" + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/yum.yaml b/config/micro/syntax/yum.yaml new file mode 100644 index 0000000..0c7fd1b --- /dev/null +++ b/config/micro/syntax/yum.yaml @@ -0,0 +1,12 @@ +filetype: yum + +detect: + filename: "\\.repo$|yum.*\\.conf$" + +rules: + - identifier: "^[[:space:]]*[^=]*=" + - constant.specialChar: "^[[:space:]]*\\[.*\\]$" + - statement: "\\$(releasever|arch|basearch|uuid|YUM[0-9])" + - comment: "(^|[[:space:]])#([^{].*)?$" + - indent-char.whitespace: "[[:space:]]+$" + - indent-char: " + +| + +" diff --git a/config/micro/syntax/zig.yaml b/config/micro/syntax/zig.yaml new file mode 100644 index 0000000..7317d35 --- /dev/null +++ b/config/micro/syntax/zig.yaml @@ -0,0 +1,52 @@ +filetype: zig + +detect: + filename: "\\.z(ig|on)$" + +rules: + # Reserved words + - statement: "\\b(addrspace|align|allowzero|and|asm|async|await|break|callconv|catch|comptime|const|continue|defer|else|errdefer|error|export|extern|fn|for|if|inline|noalias|noinline|nosuspend|or|orelse|packed|pub|resume|return|linksection|suspend|switch|test|threadlocal|try|unreachable|usingnamespace|var|volatile|while)\\b" + # builtin functions + - special: "@[a-zA-Z_]+" + # Primitive Types + - type: "\\b(anyframe|anytype|anyerror|anyopaque|bool|comptime_int|comptime_float|enum|f(16|32|64|80|128)|i(8|16|32|64|128)|isize|noreturn|opaque|struct|type|union|u(8|16|32|64|128)|usize|void)\\b" + - type: "\\b(c_u?(short|int|long(long)?)|c_longdouble|c_void)\\b" + + # Operators + - symbol.operator: "[-!|=;%.+^*:&?<>~]" + + # Parenthesis + - symbol.brackets: "[(){}]|\\[|\\]" + + # Constants + - constant: "\\b(null|undefined)\\b" + - constant.number: "\\b(0b[01_]+|0o[0-7_]+|[0-9_]+|0x[a-fA-F0-9_]+)\\b" + - constant.bool: "\\b(true|false)\\b" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" + + - constant.string: + start: "\\\\\\\\" + end: "$" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/zscript.yaml b/config/micro/syntax/zscript.yaml new file mode 100644 index 0000000..d20b561 --- /dev/null +++ b/config/micro/syntax/zscript.yaml @@ -0,0 +1,72 @@ +filetype: zscript +# Loosely based on the csharp.yaml definition +# (?i) on everything because ZScript isn't case sensitive + +detect: + filename: "(?i)\\.z(c|sc)$" + +rules: + + # ZScript only has one preprocessor directive and a required engine version declaration + - preproc: "(?i)#include" + - preproc: "(?i)version" + + # State labels ("goto" word overridden by state logic rule below) + - symbol.tag: "(?i)[a-z0-9.]+:" + - symbol.tag: "(?i)goto [a-z0-9]+[\\+0-9]*" + + # Classes + - identifier.class: "(?i)class +[a-z0-9_]+ *((:) +[a-z0-9.]+)?" + + # Functions (open paren overridden by symbol.brackets rule because perl regex apparently doesn't support postive lookahead) + - identifier: "(?i)[\\.]*[a-z0-9_]+[ ]*[(]+" + + # Variable types + - type: "(?i)\\b(actor|object|vector2|vector3|name|string|color|sound|void|double|bool|int|float|float64|uint8|uint16|uint|int8|int16|TextureID|SpriteID|Array|voidptr|short|action|state|statelabel)\\b" + + # Keywords + - statement: "(?i)\\b(class|default|private|static|native|return|if|else|for|while|do|deprecated|null|readonly|true|false|struct|extend|clearscope|vararg|ui|play|virtual|virtualscope|meta|Property|in|out|states|override|super|is|let|const|replaces|protected|self|abstract|enum|switch|case)\\b" + + # State logic keywords + - special: "(?i)\\b(goto|loop|stop|break|continue|fail)\\b" + + # Symbols + - symbol.operator: "[\\-+/*=<>?:!~%&|]" + - symbol.brackets: "[(){}]|\\[|\\]" + + # Constants + - constant.bool: "(?i)(\\b(true|false)\\b|NULL)" + - constant.number: "(?i)\\b([0-9][.]*[0-9]*)+?\\b" + - constant.number: "(?i)\\b(0x[A-Fa-f0-9_]+)?\\b" + - constant.number: "(?i)\\b(0b[0-1_]+)[FL]?\\b" + #- constant.number: "(?i)\\b(([0-9][.]*[0-9]*)+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b" + + # Strings + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" + - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" + - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" + + # Comments + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" diff --git a/config/micro/syntax/zsh.yaml b/config/micro/syntax/zsh.yaml new file mode 100644 index 0000000..a283213 --- /dev/null +++ b/config/micro/syntax/zsh.yaml @@ -0,0 +1,52 @@ +filetype: zsh + +detect: + filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)" + header: "^#!.*/(env +)?zsh( |$)" + +rules: + ## Numbers + - constant.number: "\\b[0-9]+\\b" + + ## Conditionals and control flow + - statement: "\\b(always|break|bye|case|continue|disown|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b" + + - statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)" + ## Conditional flags + - special: "-[Ldefgruwx]\\b" + - special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b" + + ## Bash-inherited + - statement: "\\b((un)?alias|bindkey|builtin|cd|declare|eval|exec|export|jobs|let|popd|pushd|set|source|typeset|umask|unset)\\b" + ## ZSH-specific + - type: "\\b(add-zsh-hook|autoload|chdir|compinit|dirs|(dis|en)able|echotc|emulate|print|prompt(init)?|(un)?setopt|zle|zmodload|zstyle|whence)\\b" + + ## Common linux commands + - statement: "\\b((g|ig)?awk|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|tar)\\b" + + ## Coreutils commands + - statement: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b" + + ## Function definition + - identifier: "^\\s+(function\\s+)[0-9A-Z_]+\\s+\\(\\)" # (i) + + ## Variables + - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" #(i) + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - constant.string: + start: "'" + end: "'" + rules: [] + + - comment: + start: "(^|\\s)#" + end: "$" + rules: [] + diff --git a/config/nvim/.gitignore b/config/nvim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/config/nvim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/config/nvim/.neoconf.json b/config/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/config/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/config/nvim/LICENSE b/config/nvim/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/config/nvim/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/config/nvim/README.md b/config/nvim/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/config/nvim/README.md @@ -0,0 +1,4 @@ +# 💤 LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..2514f9e --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,2 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json new file mode 100644 index 0000000..fa5801f --- /dev/null +++ b/config/nvim/lazy-lock.json @@ -0,0 +1,34 @@ +{ + "LazyVim": { "branch": "main", "commit": "459a4c3b1059671e766a46c7cc223827dc67e3d0" }, + "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "catppuccin": { "branch": "main", "commit": "0303a7208dba448c459767486a38a6ec05c4216b" }, + "conform.nvim": { "branch": "master", "commit": "619363c30309d29ffa631e67c8183f2a72caa373" }, + "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitsigns.nvim": { "branch": "main", "commit": "dd3f588bacbeb041be6facf1742e42097f62165d" }, + "grug-far.nvim": { "branch": "main", "commit": "5506c2f59dc9ab2ed6c233585412b24d31d51521" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, + "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "0a695750d747db1e7e70bcf0267ef8951c95fc83" }, + "mason.nvim": { "branch": "main", "commit": "16ba83bfc8a25f52bb545134f5bee082b195c460" }, + "mini.ai": { "branch": "main", "commit": "deacc8e9cf05df0297e3b14a08c2f8a415045c6f" }, + "mini.icons": { "branch": "main", "commit": "520995f1d75da0e4cc901ee95080b1ff2bc46b94" }, + "mini.pairs": { "branch": "main", "commit": "30cf2f01c4aaa2033db67376b9924fa2442c05d6" }, + "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-lint": { "branch": "master", "commit": "d48f3a76189d03b2239f6df1b2f7e3fa8353743b" }, + "nvim-lspconfig": { "branch": "master", "commit": "07dff35e7c95288861200b788ef32d6103f107f0" }, + "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e" }, + "nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" }, + "persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, + "ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/config/nvim/lazyvim.json b/config/nvim/lazyvim.json new file mode 100644 index 0000000..d8bcaf6 --- /dev/null +++ b/config/nvim/lazyvim.json @@ -0,0 +1,10 @@ +{ + "extras": [ + + ], + "install_version": 8, + "news": { + "NEWS.md": "11866" + }, + "version": 8 +} \ No newline at end of file diff --git a/config/nvim/lua/config/autocmds.lua b/config/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..4221e75 --- /dev/null +++ b/config/nvim/lua/config/autocmds.lua @@ -0,0 +1,8 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- +-- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/config/nvim/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..ace62cd --- /dev/null +++ b/config/nvim/lua/config/lazy.lua @@ -0,0 +1,79 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, + + { + "epwalsh/obsidian.nvim", + version = "*", + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + }, + opts = { + workspaces = { + { + name = "Notizen", + path = "~/documents/Notizen", + }, + { + name = "Publikationen", + path = "~/documents/Publikationen", + }, + }, + completion = { + nvim_cmp = true, + min_chars = 2, + }, + }, + }, +}) diff --git a/config/nvim/lua/config/options.lua b/config/nvim/lua/config/options.lua new file mode 100644 index 0000000..8d7b461 --- /dev/null +++ b/config/nvim/lua/config/options.lua @@ -0,0 +1,5 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here +vim.opt.spell = true +vim.opt.spelllang = "de_DE" diff --git a/config/nvim/lua/plugins/example.lua b/config/nvim/lua/plugins/example.lua new file mode 100644 index 0000000..17f53d6 --- /dev/null +++ b/config/nvim/lua/plugins/example.lua @@ -0,0 +1,197 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").lsp.on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, { + function() + return "😄" + end, + }) + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, +} diff --git a/config/nvim/stylua.toml b/config/nvim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/config/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file diff --git a/config/yazi/flavors/catppuccin-frappe.yazi/LICENSE b/config/yazi/flavors/catppuccin-frappe.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/config/yazi/flavors/catppuccin-frappe.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/yazi/flavors/catppuccin-frappe.yazi/LICENSE-tmtheme b/config/yazi/flavors/catppuccin-frappe.yazi/LICENSE-tmtheme new file mode 100644 index 0000000..006383b --- /dev/null +++ b/config/yazi/flavors/catppuccin-frappe.yazi/LICENSE-tmtheme @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Catppuccin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/yazi/flavors/catppuccin-frappe.yazi/README.md b/config/yazi/flavors/catppuccin-frappe.yazi/README.md new file mode 100644 index 0000000..737a6aa --- /dev/null +++ b/config/yazi/flavors/catppuccin-frappe.yazi/README.md @@ -0,0 +1,36 @@ +
+ Yazi logo +
+ +

+ Catppuccin Frappe Flavor for Yazi +

+ +## 👀 Preview + + + +## 🎨 Installation + +```sh +ya pkg add yazi-rs/flavors:catppuccin-frappe +``` + +## ⚙️ Usage + +Set the content of your `theme.toml` to enable it as your _dark_ flavor: + +```toml +[flavor] +dark = "catppuccin-frappe" +``` + +Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor. + +See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details. + +## 📜 License + +The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed. + +Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details. diff --git a/config/yazi/flavors/catppuccin-frappe.yazi/flavor.toml b/config/yazi/flavors/catppuccin-frappe.yazi/flavor.toml new file mode 100644 index 0000000..3f730f8 --- /dev/null +++ b/config/yazi/flavors/catppuccin-frappe.yazi/flavor.toml @@ -0,0 +1,215 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +# : Manager {{{ + +[mgr] +cwd = { fg = "#81c8be" } + +# Find +find_keyword = { fg = "#e5c890", bold = true, italic = true, underline = true } +find_position = { fg = "#f4b8e4", bg = "reset", bold = true, italic = true } + +# Marker +marker_copied = { fg = "#a6d189", bg = "#a6d189" } +marker_cut = { fg = "#e78284", bg = "#e78284" } +marker_marked = { fg = "#81c8be", bg = "#81c8be" } +marker_selected = { fg = "#e5c890", bg = "#e5c890" } + +# Count +count_copied = { fg = "#303446", bg = "#a6d189" } +count_cut = { fg = "#303446", bg = "#e78284" } +count_selected = { fg = "#303446", bg = "#e5c890" } + +# Border +border_symbol = "│" +border_style = { fg = "#838ba7" } + +# : }}} + + +# : Tabs {{{ + +[tabs] +active = { fg = "#303446", bg = "#8caaee", bold = true } +inactive = { fg = "#8caaee", bg = "#414559" } + +# : }}} + + +# : Mode {{{ + +[mode] + +normal_main = { fg = "#303446", bg = "#8caaee", bold = true } +normal_alt = { fg = "#8caaee", bg = "#414559" } + +# Select mode +select_main = { fg = "#303446", bg = "#81c8be", bold = true } +select_alt = { fg = "#81c8be", bg = "#414559" } + +# Unset mode +unset_main = { fg = "#303446", bg = "#eebebe", bold = true } +unset_alt = { fg = "#eebebe", bg = "#414559" } + +# : }}} + + +# : Status bar {{{ + +[status] +# Permissions +perm_sep = { fg = "#838ba7" } +perm_type = { fg = "#8caaee" } +perm_read = { fg = "#e5c890" } +perm_write = { fg = "#e78284" } +perm_exec = { fg = "#a6d189" } + +# Progress +progress_label = { fg = "#ffffff", bold = true } +progress_normal = { fg = "#a6d189", bg = "#51576d" } +progress_error = { fg = "#e5c890", bg = "#e78284" } + +# : }}} + + +# : Pick {{{ + +[pick] +border = { fg = "#8caaee" } +active = { fg = "#f4b8e4", bold = true } +inactive = {} + +# : }}} + + +# : Input {{{ + +[input] +border = { fg = "#8caaee" } +title = {} +value = {} +selected = { reversed = true } + +# : }}} + + +# : Completion {{{ + +[cmp] +border = { fg = "#8caaee" } + +# : }}} + + +# : Tasks {{{ + +[tasks] +border = { fg = "#8caaee" } +title = {} +hovered = { fg = "#f4b8e4", bold = true } + +# : }}} + + +# : Which {{{ + +[which] +mask = { bg = "#414559" } +cand = { fg = "#81c8be" } +rest = { fg = "#949cbb" } +desc = { fg = "#f4b8e4" } +separator = "  " +separator_style = { fg = "#626880" } + +# : }}} + + +# : Help {{{ + +[help] +on = { fg = "#81c8be" } +run = { fg = "#f4b8e4" } +hovered = { reversed = true, bold = true } +footer = { fg = "#414559", bg = "#c6d0f5" } + +# : }}} + + +# : Spotter {{{ + +[spot] +border = { fg = "#8caaee" } +title = { fg = "#8caaee" } +tbl_col = { fg = "#81c8be" } +tbl_cell = { fg = "#f4b8e4", bg = "#51576d" } + +# : }}} + + +# : Notification {{{ + +[notify] +title_info = { fg = "#a6d189" } +title_warn = { fg = "#e5c890" } +title_error = { fg = "#e78284" } + +# : }}} + + +# : File-specific styles {{{ + +[filetype] + +rules = [ + # Image + { mime = "image/*", fg = "#81c8be" }, + # Media + { mime = "{audio,video}/*", fg = "#e5c890" }, + # Archive + { mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#f4b8e4" }, + # Document + { mime = "application/{pdf,doc,rtf}", fg = "#a6d189" }, + # Virtual file system + { mime = "vfs/{absent,stale}", fg = "#949cbb" }, + # Fallback + { url = "*", fg = "#c6d0f5" }, + { url = "*/", fg = "#8caaee" }, +] + +# : }}} + +[icon] + +dirs = [ + { name = ".config", text = "", fg = "#f4b8e4" }, + { name = ".git", text = "", fg = "#81c8be" }, + { name = ".github", text = "", fg = "#8caaee" }, + { name = ".npm", text = "", fg = "#8caaee" }, + { name = "Desktop", text = "", fg = "#81c8be" }, + { name = "Development", text = "", fg = "#81c8be" }, + { name = "Documents", text = "", fg = "#81c8be" }, + { name = "Downloads", text = "", fg = "#81c8be" }, + { name = "Library", text = "", fg = "#81c8be" }, + { name = "Movies", text = "", fg = "#81c8be" }, + { name = "Music", text = "", fg = "#81c8be" }, + { name = "Pictures", text = "", fg = "#81c8be" }, + { name = "Public", text = "", fg = "#81c8be" }, + { name = "Videos", text = "", fg = "#81c8be" }, +] +conds = [ + # Special files + { if = "orphan", text = "", fg = "#c6d0f5" }, + { if = "link", text = "", fg = "#838ba7" }, + { if = "block", text = "", fg = "#eebebe" }, + { if = "char", text = "", fg = "#eebebe" }, + { if = "fifo", text = "", fg = "#eebebe" }, + { if = "sock", text = "", fg = "#eebebe" }, + { if = "sticky", text = "", fg = "#eebebe" }, + { if = "dummy", text = "", fg = "#e78284" }, + + # Fallback + { if = "dir & hovered", text = "", fg = "#8caaee" }, + { if = "dir", text = "", fg = "#8caaee" }, + { if = "exec", text = "", fg = "#a6d189" }, + { if = "!dir", text = "", fg = "#c6d0f5" }, +] diff --git a/config/yazi/flavors/catppuccin-frappe.yazi/preview.png b/config/yazi/flavors/catppuccin-frappe.yazi/preview.png new file mode 100644 index 0000000..03203c9 Binary files /dev/null and b/config/yazi/flavors/catppuccin-frappe.yazi/preview.png differ diff --git a/config/yazi/flavors/catppuccin-frappe.yazi/tmtheme.xml b/config/yazi/flavors/catppuccin-frappe.yazi/tmtheme.xml new file mode 100644 index 0000000..6d0a97f --- /dev/null +++ b/config/yazi/flavors/catppuccin-frappe.yazi/tmtheme.xml @@ -0,0 +1,2112 @@ + + + + + name + Catppuccin Frappé + semanticClass + theme.dark.catppuccin-frappé + uuid + e0ada983-8938-490c-86f0-97a1a0ec58e4 + author + Catppuccin Org + colorSpaceName + sRGB + settings + + + settings + + background + #303446 + foreground + #c6d0f5 + caret + #f2d5cf + lineHighlight + #414559 + misspelling + #e78284 + accent + #ca9ee6 + selection + #949cbb40 + activeGuide + #51576d + findHighlight + #506373 + gutterForeground + #838ba7 + + + + name + Basic text & variable names (incl. leading punctuation) + scope + text, source, variable.other.readwrite, punctuation.definition.variable + settings + + foreground + #c6d0f5 + + + + name + Parentheses, Brackets, Braces + scope + punctuation + settings + + foreground + #949cbb + fontStyle + + + + + name + Comments + scope + comment, punctuation.definition.comment + settings + + foreground + #949cbb + fontStyle + italic + + + + scope + string, punctuation.definition.string + settings + + foreground + #a6d189 + + + + scope + constant.character.escape + settings + + foreground + #f4b8e4 + + + + name + Booleans, constants, numbers + scope + constant.numeric, variable.other.constant, entity.name.constant, constant.language.boolean, constant.language.false, constant.language.true, keyword.other.unit.user-defined, keyword.other.unit.suffix.floating-point + settings + + foreground + #ef9f76 + + + + scope + keyword, keyword.operator.word, keyword.operator.new, variable.language.super, support.type.primitive, storage.type, storage.modifier, punctuation.definition.keyword + settings + + foreground + #ca9ee6 + fontStyle + + + + + scope + entity.name.tag.documentation + settings + + foreground + #ca9ee6 + + + + name + Punctuation + scope + keyword.operator, punctuation.accessor, punctuation.definition.generic, meta.function.closure punctuation.section.parameters, punctuation.definition.tag, punctuation.separator.key-value + settings + + foreground + #81c8be + + + + scope + entity.name.function, meta.function-call.method, support.function, support.function.misc, variable.function + settings + + foreground + #8caaee + fontStyle + italic + + + + name + Classes + scope + entity.name.class, entity.other.inherited-class, support.class, meta.function-call.constructor, entity.name.struct + settings + + foreground + #e5c890 + fontStyle + italic + + + + name + Enum + scope + entity.name.enum + settings + + foreground + #e5c890 + fontStyle + italic + + + + name + Enum member + scope + meta.enum variable.other.readwrite, variable.other.enummember + settings + + foreground + #81c8be + + + + name + Object properties + scope + meta.property.object + settings + + foreground + #81c8be + + + + name + Types + scope + meta.type, meta.type-alias, support.type, entity.name.type + settings + + foreground + #e5c890 + fontStyle + italic + + + + name + Decorators + scope + meta.annotation variable.function, meta.annotation variable.annotation.function, meta.annotation punctuation.definition.annotation, meta.decorator, punctuation.decorator + settings + + foreground + #ef9f76 + + + + scope + variable.parameter, meta.function.parameters + settings + + foreground + #ea999c + fontStyle + italic + + + + name + Built-ins + scope + constant.language, support.function.builtin + settings + + foreground + #e78284 + + + + scope + entity.other.attribute-name.documentation + settings + + foreground + #e78284 + + + + name + Preprocessor directives + scope + keyword.control.directive, punctuation.definition.directive + settings + + foreground + #e5c890 + + + + name + Type parameters + scope + punctuation.definition.typeparameters + settings + + foreground + #99d1db + + + + name + Namespaces + scope + entity.name.namespace + settings + + foreground + #e5c890 + + + + name + Property names (left hand assignments in json/yaml/css) + scope + support.type.property-name.css + settings + + foreground + #8caaee + fontStyle + + + + + name + This/Self keyword + scope + variable.language.this, variable.language.this punctuation.definition.variable + settings + + foreground + #e78284 + + + + name + Object properties + scope + variable.object.property + settings + + foreground + #c6d0f5 + + + + name + String template interpolation + scope + string.template variable, string variable + settings + + foreground + #c6d0f5 + + + + name + `new` as bold + scope + keyword.operator.new + settings + + fontStyle + bold + + + + name + C++ extern keyword + scope + storage.modifier.specifier.extern.cpp + settings + + foreground + #ca9ee6 + + + + name + C++ scope resolution + scope + entity.name.scope-resolution.template.call.cpp, entity.name.scope-resolution.parameter.cpp, entity.name.scope-resolution.cpp, entity.name.scope-resolution.function.definition.cpp + settings + + foreground + #e5c890 + + + + name + C++ doc keywords + scope + storage.type.class.doxygen + settings + + fontStyle + + + + + name + C++ operators + scope + storage.modifier.reference.cpp + settings + + foreground + #81c8be + + + + name + C# Interpolated Strings + scope + meta.interpolation.cs + settings + + foreground + #c6d0f5 + + + + name + C# xml-style docs + scope + comment.block.documentation.cs + settings + + foreground + #c6d0f5 + + + + name + Classes, reflecting the className color in JSX + scope + source.css entity.other.attribute-name.class.css, entity.other.attribute-name.parent-selector.css punctuation.definition.entity.css + settings + + foreground + #e5c890 + + + + name + Operators + scope + punctuation.separator.operator.css + settings + + foreground + #81c8be + + + + name + Pseudo classes + scope + source.css entity.other.attribute-name.pseudo-class + settings + + foreground + #81c8be + + + + scope + source.css constant.other.unicode-range + settings + + foreground + #ef9f76 + + + + scope + source.css variable.parameter.url + settings + + foreground + #a6d189 + fontStyle + + + + + name + CSS vendored property names + scope + support.type.vendored.property-name + settings + + foreground + #99d1db + + + + name + Less/SCSS right-hand variables (@/$-prefixed) + scope + source.css meta.property-value variable, source.css meta.property-value variable.other.less, source.css meta.property-value variable.other.less punctuation.definition.variable.less, meta.definition.variable.scss + settings + + foreground + #ea999c + + + + name + CSS variables (--prefixed) + scope + source.css meta.property-list variable, meta.property-list variable.other.less, meta.property-list variable.other.less punctuation.definition.variable.less + settings + + foreground + #8caaee + + + + name + CSS Percentage values, styled the same as numbers + scope + keyword.other.unit.percentage.css + settings + + foreground + #ef9f76 + + + + name + CSS Attribute selectors, styled the same as strings + scope + source.css meta.attribute-selector + settings + + foreground + #a6d189 + + + + name + JSON/YAML keys, other left-hand assignments + scope + keyword.other.definition.ini, punctuation.support.type.property-name.json, support.type.property-name.json, punctuation.support.type.property-name.toml, support.type.property-name.toml, entity.name.tag.yaml, punctuation.support.type.property-name.yaml, support.type.property-name.yaml + settings + + foreground + #8caaee + fontStyle + + + + + name + JSON/YAML constants + scope + constant.language.json, constant.language.yaml + settings + + foreground + #ef9f76 + + + + name + YAML anchors + scope + entity.name.type.anchor.yaml, variable.other.alias.yaml + settings + + foreground + #e5c890 + fontStyle + + + + + name + TOML tables / ini groups + scope + support.type.property-name.table, entity.name.section.group-title.ini + settings + + foreground + #e5c890 + + + + name + TOML dates + scope + constant.other.time.datetime.offset.toml + settings + + foreground + #f4b8e4 + + + + name + YAML anchor puctuation + scope + punctuation.definition.anchor.yaml, punctuation.definition.alias.yaml + settings + + foreground + #f4b8e4 + + + + name + YAML triple dashes + scope + entity.other.document.begin.yaml + settings + + foreground + #f4b8e4 + + + + name + Markup Diff + scope + markup.changed.diff + settings + + foreground + #ef9f76 + + + + name + Diff + scope + meta.diff.header.from-file, meta.diff.header.to-file, punctuation.definition.from-file.diff, punctuation.definition.to-file.diff + settings + + foreground + #8caaee + + + + name + Diff Inserted + scope + markup.inserted.diff + settings + + foreground + #a6d189 + + + + name + Diff Deleted + scope + markup.deleted.diff + settings + + foreground + #e78284 + + + + name + dotenv left-hand side assignments + scope + variable.other.env + settings + + foreground + #8caaee + + + + name + dotenv reference to existing env variable + scope + string.quoted variable.other.env + settings + + foreground + #c6d0f5 + + + + name + GDScript functions + scope + support.function.builtin.gdscript + settings + + foreground + #8caaee + + + + name + GDScript constants + scope + constant.language.gdscript + settings + + foreground + #ef9f76 + + + + name + Comment keywords + scope + comment meta.annotation.go + settings + + foreground + #ea999c + + + + name + go:embed, go:build, etc. + scope + comment meta.annotation.parameters.go + settings + + foreground + #ef9f76 + + + + name + Go constants (nil, true, false) + scope + constant.language.go + settings + + foreground + #ef9f76 + + + + name + GraphQL variables + scope + variable.graphql + settings + + foreground + #c6d0f5 + + + + name + GraphQL aliases + scope + string.unquoted.alias.graphql + settings + + foreground + #eebebe + + + + name + GraphQL enum members + scope + constant.character.enum.graphql + settings + + foreground + #81c8be + + + + name + GraphQL field in types + scope + meta.objectvalues.graphql constant.object.key.graphql string.unquoted.graphql + settings + + foreground + #eebebe + + + + name + HTML/XML DOCTYPE as keyword + scope + keyword.other.doctype, meta.tag.sgml.doctype punctuation.definition.tag, meta.tag.metadata.doctype entity.name.tag, meta.tag.metadata.doctype punctuation.definition.tag + settings + + foreground + #ca9ee6 + + + + name + HTML/XML-like <tags/> + scope + entity.name.tag + settings + + foreground + #8caaee + fontStyle + + + + + name + Special characters like &amp; + scope + text.html constant.character.entity, text.html constant.character.entity punctuation, constant.character.entity.xml, constant.character.entity.xml punctuation, constant.character.entity.js.jsx, constant.charactger.entity.js.jsx punctuation, constant.character.entity.tsx, constant.character.entity.tsx punctuation + settings + + foreground + #e78284 + + + + name + HTML/XML tag attribute values + scope + entity.other.attribute-name + settings + + foreground + #e5c890 + + + + name + Components + scope + support.class.component, support.class.component.jsx, support.class.component.tsx, support.class.component.vue + settings + + foreground + #f4b8e4 + fontStyle + + + + + name + Annotations + scope + punctuation.definition.annotation, storage.type.annotation + settings + + foreground + #ef9f76 + + + + name + Java enums + scope + constant.other.enum.java + settings + + foreground + #81c8be + + + + name + Java imports + scope + storage.modifier.import.java + settings + + foreground + #c6d0f5 + + + + name + Javadoc + scope + comment.block.javadoc.java keyword.other.documentation.javadoc.java + settings + + fontStyle + + + + + name + Exported Variable + scope + meta.export variable.other.readwrite.js + settings + + foreground + #ea999c + + + + name + JS/TS constants & properties + scope + variable.other.constant.js, variable.other.constant.ts, variable.other.property.js, variable.other.property.ts + settings + + foreground + #c6d0f5 + + + + name + JSDoc; these are mainly params, so styled as such + scope + variable.other.jsdoc, comment.block.documentation variable.other + settings + + foreground + #ea999c + fontStyle + + + + + name + JSDoc keywords + scope + storage.type.class.jsdoc + settings + + fontStyle + + + + + scope + support.type.object.console.js + settings + + foreground + #c6d0f5 + + + + name + Node constants as keywords (module, etc.) + scope + support.constant.node, support.type.object.module.js + settings + + foreground + #ca9ee6 + + + + name + implements as keyword + scope + storage.modifier.implements + settings + + foreground + #ca9ee6 + + + + name + Builtin types + scope + constant.language.null.js, constant.language.null.ts, constant.language.undefined.js, constant.language.undefined.ts, support.type.builtin.ts + settings + + foreground + #ca9ee6 + + + + scope + variable.parameter.generic + settings + + foreground + #e5c890 + + + + name + Arrow functions + scope + keyword.declaration.function.arrow.js, storage.type.function.arrow.ts + settings + + foreground + #81c8be + + + + name + Decorator punctuations (decorators inherit from blue functions, instead of styleguide peach) + scope + punctuation.decorator.ts + settings + + foreground + #8caaee + fontStyle + italic + + + + name + Extra JS/TS keywords + scope + keyword.operator.expression.in.js, keyword.operator.expression.in.ts, keyword.operator.expression.infer.ts, keyword.operator.expression.instanceof.js, keyword.operator.expression.instanceof.ts, keyword.operator.expression.is, keyword.operator.expression.keyof.ts, keyword.operator.expression.of.js, keyword.operator.expression.of.ts, keyword.operator.expression.typeof.ts + settings + + foreground + #ca9ee6 + + + + name + Julia macros + scope + support.function.macro.julia + settings + + foreground + #81c8be + fontStyle + italic + + + + name + Julia language constants (true, false) + scope + constant.language.julia + settings + + foreground + #ef9f76 + + + + name + Julia other constants (these seem to be arguments inside arrays) + scope + constant.other.symbol.julia + settings + + foreground + #ea999c + + + + name + LaTeX preamble + scope + text.tex keyword.control.preamble + settings + + foreground + #81c8be + + + + name + LaTeX be functions + scope + text.tex support.function.be + settings + + foreground + #99d1db + + + + name + LaTeX math + scope + constant.other.general.math.tex + settings + + foreground + #eebebe + + + + name + Liquid Builtin Objects & User Defined Variables + scope + variable.language.liquid + settings + + foreground + #f4b8e4 + + + + name + Lua docstring keywords + scope + comment.line.double-dash.documentation.lua storage.type.annotation.lua + settings + + foreground + #ca9ee6 + fontStyle + + + + + name + Lua docstring variables + scope + comment.line.double-dash.documentation.lua entity.name.variable.lua, comment.line.double-dash.documentation.lua variable.lua + settings + + foreground + #c6d0f5 + + + + scope + heading.1.markdown punctuation.definition.heading.markdown, heading.1.markdown, heading.1.quarto punctuation.definition.heading.quarto, heading.1.quarto, markup.heading.atx.1.mdx, markup.heading.atx.1.mdx punctuation.definition.heading.mdx, markup.heading.setext.1.markdown, markup.heading.heading-0.asciidoc + settings + + foreground + #e78284 + + + + scope + heading.2.markdown punctuation.definition.heading.markdown, heading.2.markdown, heading.2.quarto punctuation.definition.heading.quarto, heading.2.quarto, markup.heading.atx.2.mdx, markup.heading.atx.2.mdx punctuation.definition.heading.mdx, markup.heading.setext.2.markdown, markup.heading.heading-1.asciidoc + settings + + foreground + #ef9f76 + + + + scope + heading.3.markdown punctuation.definition.heading.markdown, heading.3.markdown, heading.3.quarto punctuation.definition.heading.quarto, heading.3.quarto, markup.heading.atx.3.mdx, markup.heading.atx.3.mdx punctuation.definition.heading.mdx, markup.heading.heading-2.asciidoc + settings + + foreground + #e5c890 + + + + scope + heading.4.markdown punctuation.definition.heading.markdown, heading.4.markdown, heading.4.quarto punctuation.definition.heading.quarto, heading.4.quarto, markup.heading.atx.4.mdx, markup.heading.atx.4.mdx punctuation.definition.heading.mdx, markup.heading.heading-3.asciidoc + settings + + foreground + #a6d189 + + + + scope + heading.5.markdown punctuation.definition.heading.markdown, heading.5.markdown, heading.5.quarto punctuation.definition.heading.quarto, heading.5.quarto, markup.heading.atx.5.mdx, markup.heading.atx.5.mdx punctuation.definition.heading.mdx, markup.heading.heading-4.asciidoc + settings + + foreground + #85c1dc + + + + scope + heading.6.markdown punctuation.definition.heading.markdown, heading.6.markdown, heading.6.quarto punctuation.definition.heading.quarto, heading.6.quarto, markup.heading.atx.6.mdx, markup.heading.atx.6.mdx punctuation.definition.heading.mdx, markup.heading.heading-5.asciidoc + settings + + foreground + #babbf1 + + + + scope + markup.bold + settings + + foreground + #e78284 + fontStyle + bold + + + + scope + markup.italic + settings + + foreground + #e78284 + fontStyle + italic + + + + scope + markup.strikethrough + settings + + foreground + #a5adce + fontStyle + strikethrough + + + + name + Markdown auto links + scope + punctuation.definition.link, markup.underline.link + settings + + foreground + #8caaee + + + + name + Markdown links + scope + text.html.markdown punctuation.definition.link.title, text.html.quarto punctuation.definition.link.title, string.other.link.title.markdown, string.other.link.title.quarto, markup.link, punctuation.definition.constant.markdown, punctuation.definition.constant.quarto, constant.other.reference.link.markdown, constant.other.reference.link.quarto, markup.substitution.attribute-reference + settings + + foreground + #babbf1 + + + + name + Markdown code spans + scope + punctuation.definition.raw.markdown, punctuation.definition.raw.quarto, markup.inline.raw.string.markdown, markup.inline.raw.string.quarto, markup.raw.block.markdown, markup.raw.block.quarto + settings + + foreground + #a6d189 + + + + name + Markdown triple backtick language identifier + scope + fenced_code.block.language + settings + + foreground + #99d1db + + + + name + Markdown triple backticks + scope + markup.fenced_code.block punctuation.definition, markup.raw support.asciidoc + settings + + foreground + #949cbb + + + + name + Markdown quotes + scope + markup.quote, punctuation.definition.quote.begin + settings + + foreground + #f4b8e4 + + + + name + Markdown separators + scope + meta.separator.markdown + settings + + foreground + #81c8be + + + + name + Markdown list bullets + scope + punctuation.definition.list.begin.markdown, punctuation.definition.list.begin.quarto, markup.list.bullet + settings + + foreground + #81c8be + + + + name + Quarto headings + scope + markup.heading.quarto + settings + + fontStyle + bold + + + + name + Nix attribute names + scope + entity.other.attribute-name.multipart.nix, entity.other.attribute-name.single.nix + settings + + foreground + #8caaee + + + + name + Nix parameter names + scope + variable.parameter.name.nix + settings + + foreground + #c6d0f5 + fontStyle + + + + + name + Nix interpolated parameter names + scope + meta.embedded variable.parameter.name.nix + settings + + foreground + #babbf1 + fontStyle + + + + + name + Nix paths + scope + string.unquoted.path.nix + settings + + foreground + #f4b8e4 + fontStyle + + + + + name + PHP Attributes + scope + support.attribute.builtin, meta.attribute.php + settings + + foreground + #e5c890 + + + + name + PHP Parameters (needed for the leading dollar sign) + scope + meta.function.parameters.php punctuation.definition.variable.php + settings + + foreground + #ea999c + + + + name + PHP Constants (null, __FILE__, etc.) + scope + constant.language.php + settings + + foreground + #ca9ee6 + + + + name + PHP functions + scope + text.html.php support.function + settings + + foreground + #99d1db + + + + name + PHPdoc keywords + scope + keyword.other.phpdoc.php + settings + + fontStyle + + + + + name + Python argument functions reset to text, otherwise they inherit blue from function-call + scope + support.variable.magic.python, meta.function-call.arguments.python + settings + + foreground + #c6d0f5 + + + + name + Python double underscore functions + scope + support.function.magic.python + settings + + foreground + #99d1db + fontStyle + italic + + + + name + Python `self` keyword + scope + variable.parameter.function.language.special.self.python, variable.language.special.self.python + settings + + foreground + #e78284 + fontStyle + italic + + + + name + python keyword flow/logical (for ... in) + scope + keyword.control.flow.python, keyword.operator.logical.python + settings + + foreground + #ca9ee6 + + + + name + python storage type + scope + storage.type.function.python + settings + + foreground + #ca9ee6 + + + + name + python function support + scope + support.token.decorator.python, meta.function.decorator.identifier.python + settings + + foreground + #99d1db + + + + name + python function calls + scope + meta.function-call.python + settings + + foreground + #8caaee + + + + name + python function decorators + scope + entity.name.function.decorator.python, punctuation.definition.decorator.python + settings + + foreground + #ef9f76 + fontStyle + italic + + + + name + python placeholder reset to normal string + scope + constant.character.format.placeholder.other.python + settings + + foreground + #f4b8e4 + + + + name + Python exception & builtins such as exit() + scope + support.type.exception.python, support.function.builtin.python + settings + + foreground + #ef9f76 + + + + name + entity.name.type + scope + support.type.python + settings + + foreground + #ca9ee6 + + + + name + python constants (True/False) + scope + constant.language.python + settings + + foreground + #ef9f76 + + + + name + Arguments accessed later in the function body + scope + meta.indexed-name.python, meta.item-access.python + settings + + foreground + #ea999c + fontStyle + italic + + + + name + Python f-strings/binary/unicode storage types + scope + storage.type.string.python + settings + + foreground + #a6d189 + fontStyle + italic + + + + name + Python type hints + scope + meta.function.parameters.python + settings + + fontStyle + + + + + name + Regex string begin/end in JS/TS + scope + string.regexp punctuation.definition.string.begin, string.regexp punctuation.definition.string.end + settings + + foreground + #f4b8e4 + + + + name + Regex anchors (^, $) + scope + keyword.control.anchor.regexp + settings + + foreground + #ca9ee6 + + + + name + Regex regular string match + scope + string.regexp.ts + settings + + foreground + #c6d0f5 + + + + name + Regex group parenthesis & backreference (\1, \2, \3, ...) + scope + punctuation.definition.group.regexp, keyword.other.back-reference.regexp + settings + + foreground + #a6d189 + + + + name + Regex character class [] + scope + punctuation.definition.character-class.regexp + settings + + foreground + #e5c890 + + + + name + Regex character classes (\d, \w, \s) + scope + constant.other.character-class.regexp + settings + + foreground + #f4b8e4 + + + + name + Regex range + scope + constant.other.character-class.range.regexp + settings + + foreground + #f2d5cf + + + + name + Regex quantifier + scope + keyword.operator.quantifier.regexp + settings + + foreground + #81c8be + + + + name + Regex constant/numeric + scope + constant.character.numeric.regexp + settings + + foreground + #ef9f76 + + + + name + Regex lookaheads, negative lookaheads, lookbehinds, negative lookbehinds + scope + punctuation.definition.group.no-capture.regexp, meta.assertion.look-ahead.regexp, meta.assertion.negative-look-ahead.regexp + settings + + foreground + #8caaee + + + + name + Rust attribute + scope + meta.annotation.rust, meta.annotation.rust punctuation, meta.attribute.rust, punctuation.definition.attribute.rust + settings + + foreground + #e5c890 + fontStyle + italic + + + + name + Rust attribute strings + scope + meta.attribute.rust string.quoted.double.rust, meta.attribute.rust string.quoted.single.char.rust + settings + + fontStyle + + + + + name + Rust keyword + scope + entity.name.function.macro.rules.rust, storage.type.module.rust, storage.modifier.rust, storage.type.struct.rust, storage.type.enum.rust, storage.type.trait.rust, storage.type.union.rust, storage.type.impl.rust, storage.type.rust, storage.type.function.rust, storage.type.type.rust + settings + + foreground + #ca9ee6 + fontStyle + + + + + name + Rust u/i32, u/i64, etc. + scope + entity.name.type.numeric.rust + settings + + foreground + #ca9ee6 + fontStyle + + + + + name + Rust generic + scope + meta.generic.rust + settings + + foreground + #ef9f76 + + + + name + Rust impl + scope + entity.name.impl.rust + settings + + foreground + #e5c890 + fontStyle + italic + + + + name + Rust module + scope + entity.name.module.rust + settings + + foreground + #ef9f76 + + + + name + Rust trait + scope + entity.name.trait.rust + settings + + foreground + #e5c890 + fontStyle + italic + + + + name + Rust struct + scope + storage.type.source.rust + settings + + foreground + #e5c890 + + + + name + Rust union + scope + entity.name.union.rust + settings + + foreground + #e5c890 + + + + name + Rust enum member + scope + meta.enum.rust storage.type.source.rust + settings + + foreground + #81c8be + + + + name + Rust macro + scope + support.macro.rust, meta.macro.rust support.function.rust, entity.name.function.macro.rust + settings + + foreground + #8caaee + fontStyle + italic + + + + name + Rust lifetime + scope + storage.modifier.lifetime.rust, entity.name.type.lifetime + settings + + foreground + #8caaee + fontStyle + italic + + + + name + Rust string formatting + scope + string.quoted.double.rust constant.other.placeholder.rust + settings + + foreground + #f4b8e4 + + + + name + Rust return type generic + scope + meta.function.return-type.rust meta.generic.rust storage.type.rust + settings + + foreground + #c6d0f5 + + + + name + Rust functions + scope + meta.function.call.rust + settings + + foreground + #8caaee + + + + name + Rust angle brackets + scope + punctuation.brackets.angle.rust + settings + + foreground + #99d1db + + + + name + Rust constants + scope + constant.other.caps.rust + settings + + foreground + #ef9f76 + + + + name + Rust function parameters + scope + meta.function.definition.rust variable.other.rust + settings + + foreground + #ea999c + + + + name + Rust closure variables + scope + meta.function.call.rust variable.other.rust + settings + + foreground + #c6d0f5 + + + + name + Rust self + scope + variable.language.self.rust + settings + + foreground + #e78284 + + + + name + Rust metavariable names + scope + variable.other.metavariable.name.rust, meta.macro.metavariable.rust keyword.operator.macro.dollar.rust + settings + + foreground + #f4b8e4 + + + + name + Shell shebang + scope + comment.line.shebang, comment.line.shebang punctuation.definition.comment, comment.line.shebang, punctuation.definition.comment.shebang.shell, meta.shebang.shell + settings + + foreground + #f4b8e4 + fontStyle + italic + + + + name + Shell shebang command + scope + comment.line.shebang constant.language + settings + + foreground + #81c8be + fontStyle + italic + + + + name + Shell interpolated command + scope + meta.function-call.arguments.shell punctuation.definition.variable.shell, meta.function-call.arguments.shell punctuation.section.interpolation, meta.function-call.arguments.shell punctuation.definition.variable.shell, meta.function-call.arguments.shell punctuation.section.interpolation + settings + + foreground + #e78284 + + + + name + Shell interpolated command variable + scope + meta.string meta.interpolation.parameter.shell variable.other.readwrite + settings + + foreground + #ef9f76 + fontStyle + italic + + + + scope + source.shell punctuation.section.interpolation, punctuation.definition.evaluation.backticks.shell + settings + + foreground + #81c8be + + + + name + Shell EOF + scope + entity.name.tag.heredoc.shell + settings + + foreground + #ca9ee6 + + + + name + Shell quoted variable + scope + string.quoted.double.shell variable.other.normal.shell + settings + + foreground + #c6d0f5 + + + + scope + markup.heading.typst + settings + + foreground + #e78284 + + + + name + JSON Keys + scope + source.json meta.mapping.key string + settings + + foreground + #8caaee + + + + name + JSON key surrounding quotes + scope + source.json meta.mapping.key punctuation.definition.string.begin, source.json meta.mapping.key punctuation.definition.string.end + settings + + foreground + #949cbb + + + + scope + markup.heading.synopsis.man, markup.heading.title.man, markup.heading.other.man, markup.heading.env.man + settings + + foreground + #ca9ee6 + + + + scope + markup.heading.commands.man + settings + + foreground + #8caaee + + + + scope + markup.heading.env.man + settings + + foreground + #f4b8e4 + + + + name + Man page options + scope + entity.name + settings + + foreground + #81c8be + + + + scope + markup.heading.1.markdown + settings + + foreground + #e78284 + + + + scope + markup.heading.2.markdown + settings + + foreground + #ef9f76 + + + + scope + markup.heading.markdown + settings + + foreground + #e5c890 + + + + + \ No newline at end of file diff --git a/config/yazi/flavors/flexoki-light.yazi/LICENSE b/config/yazi/flavors/flexoki-light.yazi/LICENSE new file mode 100644 index 0000000..69f9d59 --- /dev/null +++ b/config/yazi/flavors/flexoki-light.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Steph Ango + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/yazi/flavors/flexoki-light.yazi/LICENSE-tmtheme b/config/yazi/flavors/flexoki-light.yazi/LICENSE-tmtheme new file mode 100644 index 0000000..69f9d59 --- /dev/null +++ b/config/yazi/flavors/flexoki-light.yazi/LICENSE-tmtheme @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Steph Ango + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/config/yazi/flavors/flexoki-light.yazi/README.md b/config/yazi/flavors/flexoki-light.yazi/README.md new file mode 100644 index 0000000..43cc48b --- /dev/null +++ b/config/yazi/flavors/flexoki-light.yazi/README.md @@ -0,0 +1,36 @@ +
+ Yazi logo +
+ +

+ Flexoki Light Flavor for Yazi +

+ +## 👀 Preview + + + +## 🎨 Installation + +```sh +ya pkg add gosxrgxx/flexoki-light +``` + +## ⚙️ Usage + +To set it as your light flavor, change the content of your `theme.toml` to: + +```toml +[flavor] +light = "flexoki-light" +``` + +Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor. + +See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details. + +## 📜 License + +The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed. + +Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details. diff --git a/config/yazi/flavors/flexoki-light.yazi/flavor.toml b/config/yazi/flavors/flexoki-light.yazi/flavor.toml new file mode 100644 index 0000000..8cf951d --- /dev/null +++ b/config/yazi/flavors/flexoki-light.yazi/flavor.toml @@ -0,0 +1,201 @@ +# Сolor palette: https://stephango.com/flexoki +# --- +# paper "#FFFCF0" bg +# base-50 "#F2F0E5" bg-2 +# base-100 "#E6E4D9" ui +# base-150 "#DAD8CE" ui-2 +# base-200 "#CECDC3" ui-3 +# base-300 "#B7B5AC" tx-3 +# base-600 "#6F6E69" tx-2 +# black "#100F0F" tx +# red-600 "#AF3029" re +# orange-600 "#BC5215" or +# yellow-600 "#AD8301" ye +# yellow-400 "#D0A215" ye-2 +# green-600 "#66800B" gr +# cyan-600 "#24837B" cy +# cyan-400 "#3AA99F" cy-2 +# cyan-100 "#BFE8D9" cy-100 +# cyan-300 "#5ABDAC" cy-300 +# blue-600 "#205EA6" bl +# purple-600 "#5E409D" pu +# magenta-600 "#A02F6F" ma + +[app] +overall = { bg = "#FFFCF0" } # bg + +[mgr] +cwd = { fg = "#100F0F", bold = true } # tx + +# Find +find_keyword = { fg = "#24837B", reversed = true } # cy +find_position = { fg = "#24837B", bold = true, italic = true } # cy + +# Marker +marker_copied = { fg = "#66800B", bg = "#66800B" } # gr, gr +marker_cut = { fg = "#AF3029", bg = "#AF3029" } # re, re +marker_marked = { fg = "#5ABDAC", bg = "#5ABDAC" } # cy-300, cy-300 +marker_selected = { fg = "#24837B", bg = "#24837B" } # cy, cy + +# Count +count_copied = { fg = "#66800B", bold = true, reversed = true } # gr +count_cut = { fg = "#AF3029", bold = true, reversed = true } # re +count_selected = { fg = "#24837B", bold = true, reversed = true } # cy + +# Border +border_symbol = "│" +border_style = { fg = "#E6E4D9" } # ui + +[indicator] +parent = { underline = true } +current = { fg = "#100F0F", bg = "#E6E4D9" } # tx, ui +preview = { underline = true } +padding = { open = "█", close = "█" } + +[tabs] +active = { fg = "#100F0F", bg = "#CECDC3", bold = true } # tx, ui-3 +inactive = { fg = "#6F6E69", bg = "#E6E4D9" } # tx-2, ui +sep_inner = { open = "", close = "" } +sep_outer = { open = "", close = "" } + +[mode] +# Normal mode +normal_main = { fg = "#100F0F", bg = "#CECDC3", bold = true } # tx, ui-3 +normal_alt = { fg = "#6F6E69", bg = "#E6E4D9" } # tx-2, ui + +# Select mode +select_main = { fg = "#FFFCF0", bg = "#24837B", bold = true } # bg, cy +select_alt = { fg = "#24837B", bg = "#BFE8D9" } # cy, cy-100 + +# Unset mode +unset_main = { fg = "#FFFCF0", bg = "#24837B", bold = true } # bg, cy +unset_alt = { fg = "#24837B", bg = "#BFE8D9" } # cy, cy-100 + +[status] +overall = { fg = "#100F0F" } # tx + +# Permissions +perm_type = { fg = "#205EA6" } # bl +perm_read = { fg = "#AD8301" } # ye +perm_write = { fg = "#AF3029" } # re +perm_exec = { fg = "#66800B" } # gr +perm_sep = { fg = "#6F6E69" } # tx-2 + +# Progress +progress_label = { fg = "#FFFCF0" } # bg +progress_normal = { fg = "#24837B", bg = "#5ABDAC" } # cy, cy-300 +progress_error = { bg = "#AF3029" } # re + +[which] +cols = 3 +mask = { bg = "#F2F0E5" } # bg-2 +cand = { fg = "#24837B", bold = true } # cy +rest = { fg = "#24837B", italic = true } # cy +desc = { fg = "#B7B5AC" } # tx-3 +separator = " " +separator_style = { } + +[confirm] +border = { fg = "#CECDC3" } # ui-3 +title = { fg = "#B7B5AC", bold = true } # tx-3 +body = { fg = "#100F0F", bold = true } # tx +list = { fg = "#100F0F" } # tx +btn_yes = { fg = "#100F0F", bg = "#CECDC3", bold = true } # tx, ui-3 +btn_no = { fg = "#6F6E69", bg = "#E6E4D9" } # tx-2, ui + +[spot] +border = { fg = "#CECDC3" } # ui-3 +title = { fg = "#B7B5AC", bold = true } # tx-3 +tbl_col = { fg = "#6F6E69" } # tx-2 +tbl_cell = { fg = "#100F0F", bg = "#E6E4D9" } # tx, ui + +[notify] +# Notification title +title_info = { fg = "#205EA6" } # bl +title_warn = { fg = "#BC5215" } # or +title_error = { fg = "#AF3029" } # re + +[pick] +border = { fg = "#CECDC3", bold = true } # ui-3 +active = { fg = "#100F0F" } # tx +inactive = { fg = "#6F6E69" } # tx-2 + +[input] +border = { fg = "#CECDC3" } # ui-3 +title = { fg = "#B7B5AC", bold = true } # tx-3 +value = { fg = "#100F0F" } # tx +selected = { bg = "#F2F0E5" } # bg-2 + +[cmp] +border = { fg = "#CECDC3", bold = true } # ui-3 +active = { fg = "#100F0F", bg = "#E6E4D9" } # tx, ui +inactive = { fg = "#6F6E69" } # tx-2 + +[tasks] +border = { fg = "#CECDC3" } # ui-3 +title = { fg = "#B7B5AC", bold = true } # tx-3 +hovered = { fg = "#100F0F", bg = "#E6E4D9" } # tx, ui + +[help] +on = { fg = "#205EA6" } # bl +run = { fg = "#24837B" } # cy +desc = { fg = "#B7B5AC", italic = true } # tx-3 +hovered = { bg = "#E6E4D9" } # ui +footer = { fg = "#FFFCF0", bg = "#24837B", bold = true } # bg, cy + +[filetype] +rules = [ + # Empty files + { mime = "inode/empty", fg = "#B7B5AC" }, # tx-3 + + # Special files + { url = "*", is = "orphan", fg = "#B7B5AC" }, # tx-3 + { url = "*/", is = "orphan", fg = "#B7B5AC" }, # tx-3 + { url = "*", is = "link", fg = "#24837B" }, # cy + { url = "*/", is = "link", fg = "#24837B" }, # cy + { url = "*", is = "block", fg = "#100F0F" }, # tx + { url = "*", is = "char", fg = "#100F0F" }, # tx + { url = "*", is = "fifo", fg = "#A02F6F" }, # ma + { url = "*", is = "sock", fg = "#A02F6F" }, # ma + { url = "*", is = "sticky", fg = "#100F0F" }, # tx + { url = "*", is = "dummy", fg = "#B7B5AC" }, # tx-3 + + # Fallback + { url = "*/", fg = "#100F0F" }, # tx + { url = "*", is = "exec", fg = "#66800B" }, # gr + { url = "*", fg = "#6F6E69" } # tx-2 +] + +[icon] +dirs = [ + { name = ".config", text = "", fg = "#24837B" }, # cy + { name = ".git", text = "", fg = "#24837B" }, # cy + { name = ".github", text = "", fg = "#24837B" }, # cy + { name = ".npm", text = "", fg = "#24837B" }, # cy + { name = "Desktop", text = "", fg = "#24837B" }, # cy + { name = "Development", text = "", fg = "#24837B" }, # cy + { name = "Documents", text = "", fg = "#24837B" }, # cy + { name = "Downloads", text = "", fg = "#24837B" }, # cy + { name = "Library", text = "", fg = "#24837B" }, # cy + { name = "Movies", text = "", fg = "#24837B" }, # cy + { name = "Music", text = "", fg = "#24837B" }, # cy + { name = "Pictures", text = "", fg = "#24837B" }, # cy + { name = "Public", text = "", fg = "#24837B" }, # cy + { name = "Videos", text = "", fg = "#24837B" } # cy +] +conds = [ + # Special files + { if = "orphan", text = "", fg = "#B7B5AC" }, # tx-3 + { if = "link", text = "", fg = "#24837B" }, # cy + { if = "block", text = "", fg = "#100F0F" }, # tx + { if = "char", text = "", fg = "#100F0F" }, # tx + { if = "fifo", text = "", fg = "#A02F6F" }, # ma + { if = "sock", text = "", fg = "#A02F6F" }, # ma + { if = "sticky", text = "", fg = "#100F0F" }, # tx + { if = "dummy", text = "", fg = "#B7B5AC" }, # tx-3 + + # Fallback + { if = "dir", text = "", fg = "#24837B" }, # cy + { if = "exec", text = "", fg = "#66800B" }, # gr + { if = "!dir", text = "", fg = "#6F6E69" } # tx-2 +] \ No newline at end of file diff --git a/config/yazi/flavors/flexoki-light.yazi/preview.png b/config/yazi/flavors/flexoki-light.yazi/preview.png new file mode 100644 index 0000000..4a227ea Binary files /dev/null and b/config/yazi/flavors/flexoki-light.yazi/preview.png differ diff --git a/config/yazi/flavors/flexoki-light.yazi/tmtheme.xml b/config/yazi/flavors/flexoki-light.yazi/tmtheme.xml new file mode 100644 index 0000000..89df0ee --- /dev/null +++ b/config/yazi/flavors/flexoki-light.yazi/tmtheme.xml @@ -0,0 +1,1149 @@ + + + + + + name + Flexoki Light + originalAuthor + kepano + colorSpaceName + sRGB + settings + + + settings + + background + #FFFCF0 + foreground + #100F0F + lineHighlight + #F2F0E5 + gutter + #FFFCF0 + gutterForeground + #B7B5AC + gutterForegroundHighlight + #6F6E69 + minimapBorder + #DAD8CE + caret + #100F0F + blockCaret + #100F0F + invisibles + #B7B5AC + misspelling + #AF3029 + highlight + #B7B5AC + findHighlight + #F2F0E5 + findHighlightForeground + #100F0F + accent + #205EA6 + foldMarker + #AD8301 + guide + #E6E4D9 + activeGuide + #B7B5AC + stackGuide + #E6E4D9 + selection + #F2F0E5 + selectionBorder + #DAD8CE + inactiveSelection + #FFFCF0 + inactiveSelectionBorder + #DAD8CE + bracketsOptions + underline + bracketsForeground + #66800B + bracketContentsOptions + stippled_underline + bracketContentsForeground + #66800B + tagsOptions + stippled_underline + tagsForeground + #66800B + shadow + #FFFCF0 + shadowWidth + 4 + lineDiffAdded + #66800B + lineDiffModified + #AD8301 + + + + name + Comment + scope + comment, meta.documentation + settings + + foreground + #B7B5AC + + + + name + String + scope + string + settings + + foreground + #24837B + + + + name + Regexp + scope + string.regexp + settings + + foreground + #24837B + + + + name + Escape \ char + scope + constant.character.escape + settings + + foreground + #AF3029 + + + + name + Number + scope + constant.numeric + settings + + foreground + #5E409D + + + + name + Number Units + scope + constant.numeric.suffix + settings + + foreground + #66800B + + + + name + Variable + scope + variable + settings + + foreground + #205EA6 + + + + name + Variable Function + scope + variable.function + settings + + foreground + #BC5215 + + + + name + Variable Language + scope + variable.language + settings + + foreground + #A02F6F + + + + name + Keyword + scope + keyword + settings + + foreground + #66800B + + + + name + Import + scope + meta.import keyword, keyword.control.import, keyword.control.import.from, keyword.other.import, keyword.control.at-rule.include, keyword.control.at-rule.import + settings + + foreground + #AF3029 + + + + name + Assignment, Comparision Operators + scope + keyword.operator.comparison, keyword.operator.assignment + settings + + foreground + #6F6E69 + + + + name + Arithmetical Operators + scope + keyword.operator.arithmetic + settings + + foreground + #AF3029 + + + + name + Storage + scope + storage + settings + + foreground + #66800B + + + + name + Storage modifier + scope + storage.modifier + settings + + foreground + #100F0F + + + + name + Class + scope + keyword.control.class, entity.name, entity.name.class, entity.name.type.class + settings + + foreground + #BC5215 + + + + name + Inherited Class + scope + entity.other.inherited-class + settings + + foreground + #205EA6 + + + + name + Attribute + scope + entity.other.attribute-name + settings + + foreground + #BC5215 + + + + name + Library class + scope + support, support.type, support.class + settings + + foreground + #66800B + + + + name + Function name + scope + entity.name.function + settings + + foreground + #BC5215 + + + + name + Variable start + scope + punctuation.definition.variable + settings + + foreground + #66800B + + + + name + Built-in constant + scope + constant, constant.language, meta.preprocessor + settings + + foreground + #AD8301 + + + + scope + entity.name.section + settings + + foreground + #BC5215 + + + + name + Support.construct + scope + support.function.construct, keyword.other.new + settings + + foreground + #AF3029 + + + + name + User-defined constant + scope + constant.character, constant.other + settings + + foreground + #BC5215 + + + + name + Tag name + scope + entity.name.tag + settings + + foreground + #205EA6 + + + + name + Tag start/end + scope + punctuation.definition.tag.html, punctuation.definition.tag.begin, punctuation.definition.tag.end + settings + + foreground + #6F6E69 + + + + name + Library function + scope + support.function + settings + + foreground + #66800B + + + + name + Continuation + scope + punctuation.separator.continuation + settings + + foreground + #AF3029 + + + + name + Storage Type + scope + storage.type + settings + + foreground + #205EA6 + + + + name + Exception + scope + support.type.exception + settings + + foreground + #BC5215 + + + + name + Special + scope + keyword.other.special-method + settings + + foreground + #BC5215 + + + + name + Invalid + scope + invalid + settings + + background + #AF3029 + foreground + #AF3029 + + + + name + Quoted String + scope + string.quoted.double, string.quoted.single + settings + + foreground + #24837B + + + + name + Quotes + scope + punctuation.definition.string + settings + + foreground + #6F6E69 + + + + name + [] + scope + meta.brace.square, punctuation.section.brackets + settings + + foreground + #205EA6 + + + + name + (),{} + scope + meta.block, meta.brace.round, meta.brace.curly, punctuation.section, punctuation.section.block, punctuation.definition.parameters, punctuation.section.group + settings + + foreground + #6F6E69 + + + + name + , + scope + punctuation.separator, punctuation.terminator, punctuation.accessor + settings + + foreground + #6F6E69 + + + + name + CSS: Standard color value + scope + support.constant.color, invalid.deprecated.color.w3c-non-standard-color-name.scss + settings + + foreground + #AD8301 + + + + name + CSS: Selector > [] and non-spec tags + scope + meta.selector.css + settings + + foreground + #6F6E69 + + + + name + CSS: Tag + scope + entity.name.tag.css, entity.name.tag.scss, source.less keyword.control.html.elements, source.sass keyword.control.untitled + settings + + foreground + #BC5215 + + + + name + CSS .class + scope + entity.other.attribute-name.class + settings + + foreground + #BC5215 + + + + name + CSS: #id + scope + entity.other.attribute-name.id + settings + + foreground + #BC5215 + + + + name + CSS :pseudo + scope + entity.other.attribute-name.pseudo-element, entity.other.attribute-name.tag.pseudo-element, entity.other.attribute-name.pseudo-class, entity.other.attribute-name.tag.pseudo-class + settings + + foreground + #205EA6 + + + + name + CSS: @-rule + scope + keyword.control.at-rule + settings + + foreground + #BC5215 + + + + name + Haskell: Variable + scope + source.haskell variable + settings + + foreground + #BC5215 + + + + name + HTML: = + scope + text.html.basic meta.tag.other.html, text.html.basic meta.tag.any.html, text.html.basic meta.tag.block.any, text.html.basic meta.tag.inline.any, text.html.basic meta.tag.structure.any.html, text.html.basic source.js.embedded.html, punctuation.separator.key-value.html + settings + + foreground + #6F6E69 + + + + name + HTML: something= + scope + text.html.basic entity.other.attribute-name.html, meta.tag.xml entity.other.attribute-name + settings + + foreground + #BC5215 + + + + name + Ruby: Special Method + scope + keyword.other.special-method.ruby + settings + + foreground + #66800B + + + + name + Ruby: Constant Other + scope + variable.other.constant.ruby + settings + + foreground + #AD8301 + + + + name + Ruby: :symbol + scope + constant.other.symbol.ruby + settings + + foreground + #24837B + + + + name + Ruby: Special Method + scope + keyword.other.special-method.ruby + settings + + foreground + #BC5215 + + + + name + PHP: Array() + scope + meta.array support.function.construct.php + settings + + foreground + #AD8301 + + + + name + C: Preprocessor + scope + entity.name.function.preprocessor.c, meta.preprocessor.c.include, meta.preprocessor.macro.c + settings + + foreground + #BC5215 + + + + name + C: include + scope + meta.preprocessor.c.include string.quoted.other.lt-gt.include.c, meta.preprocessor.c.include punctuation.definition.string.begin.c, meta.preprocessor.c.include punctuation.definition.string.end.c + settings + + foreground + #24837B + + + + name + Other: Removal + scope + other.package.exclude, other.remove + settings + + foreground + #AF3029 + + + + name + Other: Add + scope + other.add + settings + + foreground + #24837B + + + + name + Tex: {} + scope + punctuation.section.group.tex , punctuation.definition.arguments.begin.latex, punctuation.definition.arguments.end.latex, punctuation.definition.arguments.latex + settings + + foreground + #AF3029 + + + + name + Tex: {text} + scope + meta.group.braces.tex + settings + + foreground + #AD8301 + + + + name + Tex: Other Math + scope + string.other.math.tex + settings + + foreground + #AD8301 + + + + name + Tex: {var} + scope + variable.parameter.function.latex + settings + + foreground + #BC5215 + + + + name + Tex: Math \\ + scope + punctuation.definition.constant.math.tex + settings + + foreground + #AF3029 + + + + name + Tex: Constant Math + scope + text.tex.latex constant.other.math.tex, constant.other.general.math.tex, constant.other.general.math.tex, constant.character.math.tex + settings + + foreground + #24837B + + + + name + Tex: Other Math String + scope + string.other.math.tex + settings + + foreground + #AD8301 + + + + name + Tex: $ + scope + punctuation.definition.string.begin.tex, punctuation.definition.string.end.tex + settings + + foreground + #AF3029 + + + + name + Tex: \label + scope + keyword.control.label.latex, text.tex.latex constant.other.general.math.tex + settings + + foreground + #24837B + + + + name + Tex: \label { } + scope + variable.parameter.definition.label.latex + settings + + foreground + #AF3029 + + + + name + Tex: Function + scope + support.function.be.latex + settings + + foreground + #66800B + + + + name + Tex: Support Function Section + scope + support.function.section.latex + settings + + foreground + #BC5215 + + + + name + Tex: Support Function + scope + support.function.general.tex + settings + + foreground + #24837B + + + + name + Tex: Reference Label + scope + keyword.control.ref.latex + settings + + foreground + #24837B + + + + name + Python: storage + scope + storage.type.class.python, storage.type.function.python, storage.modifier.global.python + settings + + foreground + #66800B + + + + name + Python: Support.exception + scope + support.type.exception.python + settings + + foreground + #AD8301 + + + + name + Shell: meta scope in loop + scope + meta.scope.for-in-loop.shell, variable.other.loop.shell + settings + + foreground + #100F0F + + + + name + Shell: Meta Block + scope + meta.scope.case-block.shell, meta.scope.case-body.shell + settings + + foreground + #100F0F + + + + name + Shell: [] + scope + punctuation.definition.logical-expression.shell + settings + + foreground + #AF3029 + + + + name + Storage + scope + storage.modifier.c++ + settings + + foreground + #66800B + + + + name + Perl: functions + scope + support.function.perl + settings + + foreground + #205EA6 + + + + name + diff: header + scope + meta.diff, meta.diff.header + settings + + foreground + #B7B5AC + + + + name + diff: range + scope + meta.diff.range + settings + + foreground + #205EA6 + + + + name + diff: deleted + scope + markup.deleted + settings + + foreground + #AF3029 + + + + name + diff: changed + scope + markup.changed + settings + + foreground + #AD8301 + + + + name + diff: inserted + scope + markup.inserted + settings + + foreground + #66800B + + + + name + Warning + scope + markup.warning + settings + + foreground + #AD8301 + + + + name + Error + scope + markup.error + settings + + foreground + #AF3029 + + + + scope + markup.heading, punctuation.definition.heading.markdown + settings + + foreground + #B7B5AC + fontStyle + bold + + + + name + Markdown quote + scope + markup.quote + settings + + foreground + #66800B + + + + name + Markdown em + scope + markup.italic + settings + + fontStyle + italic + + + + scope + markup.bold + settings + + fontStyle + bold + + + + scope + markup.underline.link.markdown, meta.link.reference constant.other.reference.link.markdown + settings + + foreground + #24837B + + + + scope + constant.other.reference.link.markdown + settings + + foreground + #5E409D + + + + scope + meta.paragraph.markdown meta.dummy.line-break + settings + + background + #B7B5AC + + + + name + SublimeBracketHighlighter + scope + brackethighlighter.all + settings + + foreground + #B7B5AC + + + + name + Find In Files: File Name + scope + entity.name.filename.find-in-files + settings + + foreground + #24837B + + + + name + Find In Files: Line numbers + scope + constant.numeric.line-number.find-in-files + settings + + foreground + #B7B5AC + + + + name + JavaScript Variables + scope + variable.other.readwrite.js, variable.other.object.js, variable.other.constant.js + settings + + foreground + #100F0F + + + + name + Go Variables + scope + variable.other.go, variable.other.member.go, variable.other.member.declaration.go, variable.other.constant.declaration.go + settings + + foreground + #100F0F + + + + + diff --git a/config/yazi/package.toml b/config/yazi/package.toml new file mode 100644 index 0000000..9628ad7 --- /dev/null +++ b/config/yazi/package.toml @@ -0,0 +1,12 @@ +[plugin] +deps = [] + +[[flavor.deps]] +use = "gosxrgxx/flexoki-light" +rev = "1b1e677" +hash = "a80630a255909a511aba8a98d115bc15" + +[[flavor.deps]] +use = "yazi-rs/flavors:catppuccin-frappe" +rev = "0f9204b" +hash = "1844f850b0c5d1af511c84399c95e3d7" diff --git a/config/yazi/theme.toml b/config/yazi/theme.toml new file mode 100644 index 0000000..bb971ad --- /dev/null +++ b/config/yazi/theme.toml @@ -0,0 +1,4 @@ +[flavor] +light = "catppuccin-frappe" +dark = "catppuccin-frappe" + diff --git a/config/yazi/yazi.toml b/config/yazi/yazi.toml new file mode 100644 index 0000000..ba050db --- /dev/null +++ b/config/yazi/yazi.toml @@ -0,0 +1,14 @@ +# yazi.toml +[mgr] +show_hidden = true + +[opener] +edit = [ + { run = "$EDITOR %s", block = true, for = "unix" } +] + +[open] +prepend_rules = [ + { url = "*.md", use = "edit" }, +] + diff --git a/tmux.conf b/tmux.conf index 62884f4..b616b16 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,7 +1,7 @@ # statusbar set -g status-position top -set -g status-style bg=green -set -g window-active-style bg=blue +set -g status-style bg="#248378" +set -g window-active-style bg="#222435" set -g pane-active-border fg=yellow # battery