Skip to content

Commit 4f15e39

Browse files
committed
Sugar on the glyphs
1 parent bad8fe8 commit 4f15e39

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

after/syntax/markdown.vim

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ vim9script
33
# Other possible options: 0x2B1C (white empty box)
44
# 0x2705 Green checkbox
55
# 0x2714 Only checkbox
6+
# 0x25A2 Big large empty square
67
var use_nerd_fonts = true
78

89
if exists('g:markdown_extras_config') != 0
@@ -12,9 +13,22 @@ if exists('g:markdown_extras_config') != 0
1213
endif
1314

1415
if use_nerd_fonts
16+
var empty_checkbox = 0x25A2
17+
var marked_checkbox = 0x2714
18+
19+
if exists('g:markdown_extras_config') != 0
20+
&& has_key(g:markdown_extras_config, 'empty_checkbox')
21+
empty_checkbox = g:markdown_extras_config[ 'empty_checkbox']
22+
endif
23+
24+
if exists('g:markdown_extras_config') != 0
25+
&& has_key(g:markdown_extras_config, 'marked_checkbox')
26+
marked_checkbox = g:markdown_extras_config[ 'marked_checkbox']
27+
endif
28+
1529
exe 'syntax match todoCheckbox ''\v\s*-\s\[\s*\]''hs=e-4 conceal cchar='
16-
.. nr2char(0x25A1)
30+
.. nr2char(empty_checkbox)
1731
exe 'syntax match todoCheckbox ''\v\s*-\s\[x\]''hs=e-4 conceal cchar='
18-
.. nr2char(0x2714)
32+
.. nr2char(marked_checkbox)
1933
hi def link todoCheckbox Todo
2034
endif

doc/markdown_extras.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,11 @@ filling it with he various keys.
4949
Default `true`.
5050
"use_nerd_fonts" To set eye-candy check-boxes. Require some nerd-font
5151
installed. Default false.
52+
"smart_textstyle" Whenever possible, text styles are kept
53+
consistent. Default `true`
54+
"empty_checkbox" Glyphs to display for empty checkboxes. Requires
55+
"use_nerdfonts" set to `true` and 'concealevel'
56+
greater than 0.
57+
"marked_checkbox" Glyphs to display for marked checkboxes. Requires
58+
"use_nerdfonts" set to `true` and 'concealevel'
59+
greater than 0.

lib/utils.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ enddef
547547
# TODO
548548
export var Surround = SurroundSmart
549549
if exists('g:markdown_extras_config')
550-
&& has_key(g:markdown_extras_config, 'smart_delimiters')
551-
&& g:markdown_extras_config['smart_delimiters']
550+
&& has_key(g:markdown_extras_config, 'smart_textstyle')
551+
&& g:markdown_extras_config['smart_textstyle']
552552
Surround = SurroundSimple
553553
endif

0 commit comments

Comments
 (0)