diff --git a/CHANGELOG.md b/CHANGELOG.md index 986e8a09..c67fb827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ ## Bugfixes - Bring back pre-processing of ANSI escape characters to so that some common `bat` use cases starts working again. See #2308 (@Enselic) +- Improve Manpage.sublime-syntax. See #2364 (@Freed-Wu) # v0.22.0 diff --git a/assets/syntaxes/02_Extra/Manpage.sublime-syntax b/assets/syntaxes/02_Extra/Manpage.sublime-syntax index b50dc19d..00a9bc73 100644 --- a/assets/syntaxes/02_Extra/Manpage.sublime-syntax +++ b/assets/syntaxes/02_Extra/Manpage.sublime-syntax @@ -75,7 +75,7 @@ contexts: options: # command-line options like --option=value, --some-flag, or -x - - match: '^[ ]{7}(?=-)' + - match: '^[ ]{7}(?=-|\+)' push: expect-command-line-option - match: '(?:[^a-zA-Z0-9_-]|^|\s){{command_line_option}}' captures: @@ -96,7 +96,7 @@ contexts: - include: env-var expect-command-line-option: - - match: '[A-Za-z0-9-]+' + - match: '[A-Za-z0-9-\.\?:#\$\+]+' scope: entity.name.command-line-option.man - match: '(\[)(=)' captures: @@ -122,7 +122,7 @@ contexts: pop: true expect-parameter: - - match: '[A-Za-z0-9-]+' + - match: '[A-Za-z0-9-_]+' scope: variable.parameter.man - match: (?=\s+\|) pop: true diff --git a/tests/syntax-tests/highlighted/Manpage/fzf-0.33.0.man b/tests/syntax-tests/highlighted/Manpage/fzf-0.33.0.man new file mode 100644 index 00000000..cf259ec9 --- /dev/null +++ b/tests/syntax-tests/highlighted/Manpage/fzf-0.33.0.man @@ -0,0 +1,773 @@ +fzf(1) fzf - a command-line fuzzy finder fzf(1) + +NAME + fzf - a command-line fuzzy finder + +SYNOPSIS + fzf [options] + +DESCRIPTION + fzf is a general-purpose command-line fuzzy finder. + +OPTIONS + Search mode + -x, --extended + Extended-search mode. Since 0.10.9, this is enabled by default. You can disable it with +x or --no-extended. + + -e, --exact + Enable exact-match + + -i Case-insensitive match (default: smart-case match) + + +i Case-sensitive match + + --literal + Do not normalize latin script letters for matching. + + --scheme=SCHEME + Choose scoring scheme tailored for different types of input. + + default Generic scoring scheme designed to work well with any type of input + path Scoring scheme for paths (additional bonus point only after path separator) + history Scoring scheme for command history (no additional bonus points). + Sets --tiebreak=index as well. + + --algo=TYPE + Fuzzy matching algorithm (default: v2) + + v2 Optimal scoring algorithm (quality) + v1 Faster but not guaranteed to find the optimal result (performance) + + -n, --nth=N[,..] + Comma-separated list of field index expressions for limiting search scope. See FIELD INDEX EXPRESSION for the details. + + --with-nth=N[,..] + Transform the presentation of each line using field index expressions + + -d, --delimiter=STR + Field delimiter regex for --nth and --with-nth (default: AWK-style) + + --disabled + Do not perform search. With this option, fzf becomes a simple selector interface rather than a "fuzzy finder". You can later enable the search using enable-search or toggle- + search action. + + Search result + +s, --no-sort + Do not sort the result + + --tac Reverse the order of the input + + e.g. + history | fzf --tac --no-sort + + --tiebreak=CRI[,..] + Comma-separated list of sort criteria to apply when the scores are tied. + + length Prefers line with shorter length + chunk Prefers line with shorter matched chunk (delimited by whitespaces) + begin Prefers line with matched substring closer to the beginning + end Prefers line with matched substring closer to the end + index Prefers line that appeared earlier in the input stream + + - Each criterion should appear only once in the list + - index is only allowed at the end of the list + - index is implicitly appended to the list when not specified + - Default is length (or equivalently length,index) + - If end is found in the list, fzf will scan each line backwards + + Interface + -m, --multi + Enable multi-select with tab/shift-tab. It optionally takes an integer argument which denotes the maximum number of items that can be selected. + + +m, --no-multi + Disable multi-select + + --no-mouse + Disable mouse + + --bind=KEYBINDS + Comma-separated list of custom key bindings. See KEY/EVENT BINDINGS for the details. + + --cycle + Enable cyclic scroll + + --keep-right + Keep the right end of the line visible when it's too long. Effective only when the query string is empty. + + --scroll-off=LINES + Number of screen lines to keep above or below when scrolling to the top or to the bottom (default: 0). + + --no-hscroll + Disable horizontal scroll + + --hscroll-off=COLS + Number of screen columns to keep to the right of the highlighted substring (default: 10). Setting it to a large value will cause the text to be positioned on the center of the + screen. + + --filepath-word + Make word-wise movements and actions respect path separators. The following actions are affected: + + backward-kill-word + backward-word + forward-word + kill-word + + --jump-labels=CHARS + Label characters for jump and jump-accept + + Layout + --height=HEIGHT[%] + Display fzf window below the cursor with the given height instead of using the full screen. + + --min-height=HEIGHT + Minimum height when --height is given in percent (default: 10). Ignored when --height is not specified. + + --layout=LAYOUT + Choose the layout (default: default) + + default Display from the bottom of the screen + reverse Display from the top of the screen + reverse-list Display from the top of the screen, prompt at the bottom + + --reverse + A synonym for --layout=reverse + + --border[=BORDER_OPT] + Draw border around the finder + + rounded Border with rounded corners (default) + sharp Border with sharp corners + horizontal Horizontal lines above and below the finder + vertical Vertical lines on each side of the finder + top (up) + bottom (down) + left + right + none + + --no-unicode + Use ASCII characters instead of Unicode box drawing characters to draw border + + --margin=MARGIN + Comma-separated expression for margins around the finder. + + TRBL Same margin for top, right, bottom, and left + TB,RL Vertical, horizontal margin + T,RL,B Top, horizontal, bottom margin + T,R,B,L Top, right, bottom, left margin + + Each part can be given in absolute number or in percentage relative to the terminal size with % suffix. + + e.g. + fzf --margin 10% + fzf --margin 1,5% + + --padding=PADDING + Comma-separated expression for padding inside the border. Padding is distinguishable from margin only when --border option is used. + + e.g. + fzf --margin 5% --padding 5% --border --preview 'cat {}' \ + --color bg:#222222,preview-bg:#333333 + + TRBL Same padding for top, right, bottom, and left + TB,RL Vertical, horizontal padding + T,RL,B Top, horizontal, bottom padding + T,R,B,L Top, right, bottom, left padding + + --info=STYLE + Determines the display style of finder info. + + default Display on the next line to the prompt + inline Display on the same line + hidden Do not display finder info + + --no-info + A synonym for --info=hidden + + --prompt=STR + Input prompt (default: '> ') + + --pointer=STR + Pointer to the current line (default: '>') + + --marker=STR + Multi-select marker (default: '>') + + --header=STR + The given string will be printed as the sticky header. The lines are displayed in the given order from top to bottom regardless of --layout option, and are not affected by + --with-nth. ANSI color codes are processed even when --ansi is not set. + + --header-lines=N + The first N lines of the input are treated as the sticky header. When --with-nth is set, the lines are transformed just like the other lines that follow. + + --header-first + Print header before the prompt line + + --ellipsis=STR + Ellipsis to show when line is truncated (default: '..') + + Display + --ansi Enable processing of ANSI color codes + + --tabstop=SPACES + Number of spaces for a tab character (default: 8) + + --color=[BASE_SCHEME][,COLOR_NAME[:ANSI_COLOR][:ANSI_ATTRIBUTES]]... + Color configuration. The name of the base color scheme is followed by custom color mappings. + + BASE SCHEME: + (default: dark on 256-color terminal, otherwise 16) + + dark Color scheme for dark 256-color terminal + light Color scheme for light 256-color terminal + 16 Color scheme for 16-color terminal + bw No colors (equivalent to --no-color) + + COLOR NAMES: + fg Text + bg Background + preview-fg Preview window text + preview-bg Preview window background + hl Highlighted substrings + fg+ Text (current line) + bg+ Background (current line) + gutter Gutter on the left (defaults to bg+) + hl+ Highlighted substrings (current line) + query Query string + disabled Query string when search is disabled + info Info line (match counters) + border Border around the window (--border and --preview) + prompt Prompt + pointer Pointer to the current line + marker Multi-select marker + spinner Streaming input indicator + header Header + + ANSI COLORS: + -1 Default terminal foreground/background color + (or the original color of the text) + 0 ~ 15 16 base colors + black + red + green + yellow + blue + magenta + cyan + white + bright-black (gray | grey) + bright-red + bright-green + bright-yellow + bright-blue + bright-magenta + bright-cyan + bright-white + 16 ~ 255 ANSI 256 colors + #rrggbb 24-bit colors + + ANSI ATTRIBUTES: (Only applies to foreground colors) + regular Clears previously set attributes; should precede the other ones + bold + underline + reverse + dim + italic + strikethrough + + EXAMPLES: + + # Seoul256 theme with 8-bit colors + # (https://github.com/junegunn/seoul256.vim) + fzf --color='bg:237,bg+:236,info:143,border:240,spinner:108' \ + --color='hl:65,fg:252,header:65,fg+:252' \ + --color='pointer:161,marker:168,prompt:110,hl+:108' + + # Seoul256 theme with 24-bit colors + fzf --color='bg:#4B4B4B,bg+:#3F3F3F,info:#BDBB72,border:#6B6B6B,spinner:#98BC99' \ + --color='hl:#719872,fg:#D9D9D9,header:#719872,fg+:#D9D9D9' \ + --color='pointer:#E12672,marker:#E17899,prompt:#98BEDE,hl+:#98BC99' + + --no-bold + Do not use bold text + + --black + Use black background + + History + --history=HISTORY_FILE + Load search history from the specified file and update the file on completion. When enabled, CTRL-N and CTRL-P are automatically remapped to next-history and previous-history. + + --history-size=N + Maximum number of entries in the history file (default: 1000). The file is automatically truncated when the number of the lines exceeds the value. + + Preview + --preview=COMMAND + Execute the given command for the current line and display the result on the preview window. {} in the command is the placeholder that is replaced to the single-quoted string of + the current line. To transform the replacement string, specify field index expressions between the braces (See FIELD INDEX EXPRESSION for the details). + + e.g. + fzf --preview='head -$LINES {}' + ls -l | fzf --preview="echo user={3} when={-4..-2}; cat {-1}" --header-lines=1 + + fzf exports $FZF_PREVIEW_LINES and $FZF_PREVIEW_COLUMNS so that they represent the exact size of the preview window. (It also overrides $LINES and $COLUMNS with the same values + but they can be reset by the default shell, so prefer to refer to the ones with FZF_PREVIEW_ prefix.) + + A placeholder expression starting with + flag will be replaced to the space-separated list of the selected lines (or the current line if no selection was made) individually + quoted. + + e.g. + fzf --multi --preview='head -10 {+}' + git log --oneline | fzf --multi --preview 'git show {+1}' + + When using a field index expression, leading and trailing whitespace is stripped from the replacement string. To preserve the whitespace, use the s flag. + + Also, {q} is replaced to the current query string, and {n} is replaced to zero-based ordinal index of the line. Use {+n} if you want all index numbers when multiple lines are + selected. + + A placeholder expression with f flag is replaced to the path of a temporary file that holds the evaluated list. This is useful when you multi-select a large number of items and + the length of the evaluated string may exceed ARG_MAX. + + e.g. + # Press CTRL-A to select 100K items and see the sum of all the numbers. + # This won't work properly without 'f' flag due to ARG_MAX limit. + seq 100000 | fzf --multi --bind ctrl-a:select-all \ + --preview "awk '{sum+=\$1} END {print sum}' {+f}" + + Note that you can escape a placeholder pattern by prepending a backslash. + + Preview window will be updated even when there is no match for the current query if any of the placeholder expressions evaluates to a non-empty string. + + Since 0.24.0, fzf can render partial preview content before the preview command completes. ANSI escape sequence for clearing the display (CSI 2 J) is supported, so you can use + it to implement preview window that is constantly updating. + + e.g. + fzf --preview 'for i in $(seq 100000); do + (( i % 200 == 0 )) && printf "\033[2J" + echo "$i" + sleep 0.01 + done' + + --preview-window=[POSITION][,SIZE[%]][,border-BORDER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default][,