annotate runtime/ftplugin/liquid.vim @ 33083:79b2eb83f2df v9.0.1827

patch 9.0.1827: xxd: no color support Commit: https://github.com/vim/vim/commit/e2528ae11134cdf35c312754b124aba4963d8054 Author: Aapo Rantalainen <aapo.rantalainen@gmail.com> Date: Thu Aug 31 17:58:13 2023 +0200 patch 9.0.1827: xxd: no color support Problem: xxd: no color support Solution: Add color support using xxd -R Add some basic color support for xxd The hex-value and value are both colored with the same color depending on the hex-value, e.g.: 0x00 = white 0xff = blue printable = green non-printable = red tabs and linebreaks = yellow Each character needs 11 more bytes to contain color. (Same color in a row could contain only one overhead but the logic how xxd creates colums must be then changed.) Size of colored output is increased by factor of ~6. Also grepping the output will break when colors is used. Flag for color is "-R", because less uses "-R". Color uses parameters auto,always,never same as less and grep (among others). E.g. xxd -R always $FILE | less -R Add some screen-tests (that currently on work on linux) to verify the feature works as expected. closes: #12131 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Aapo Rantalainen <aapo.rantalainen@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 31 Aug 2023 18:15:03 +0200
parents dce918af0c00
children 7c7432a53a6c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: Liquid
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 2202
diff changeset
4 " Last Change: 2022 Mar 15
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 if exists('b:did_ftplugin')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 finish
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 if !exists('g:liquid_default_subtype')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 let g:liquid_default_subtype = 'html'
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 if !exists('b:liquid_subtype')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 if b:liquid_subtype == ''
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 if b:liquid_subtype == ''
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 if b:liquid_subtype == ''
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 let b:liquid_subtype = g:liquid_default_subtype
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 if exists('b:liquid_subtype') && b:liquid_subtype != ''
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 exe 'runtime! ftplugin/'.b:liquid_subtype.'.vim ftplugin/'.b:liquid_subtype.'_*.vim ftplugin/'.b:liquid_subtype.'/*.vim'
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 else
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 let b:did_ftplugin = 1
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 if exists('b:undo_ftplugin')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 let b:undo_ftplugin .= '|'
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 else
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 let b:undo_ftplugin = ''
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 if exists('b:browsefilter')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 let b:browsefilter = "\n".b:browsefilter
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 else
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 let b:browsefilter = ''
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 if exists('b:match_words')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 let b:match_words .= ','
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 elseif exists('loaded_matchit')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 let b:match_words = ''
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 if has('gui_win32')
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 let b:browsefilter="Liquid Files (*.liquid)\t*.liquid" . b:browsefilter
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 if exists('loaded_matchit')
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 2202
diff changeset
56 let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,\<\(capture\|comment\|highlight\)\>:\<end\1\>'
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 endif
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %}
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words'