commit 261906caebab4a9862e980fc0c40b4188ad0747a
parent 110b11b6af381e11ad1b3e9f1f58e693ad780294
Author: Alex Balgavy <alex@balgavy.eu>
Date: Thu, 24 Jun 2021 21:29:32 +0200
vim: digraphs and conceals
Diffstat:
3 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/vim/after/syntax/markdown.vim b/vim/after/syntax/markdown.vim
@@ -26,3 +26,12 @@ hi def link markdownAbbrev Define
hi def link markdownCite Comment
hi def link markdownCiteInline Comment
hi def link markdownLatex Identifier
+
+if has('conceal')
+ setl conceallevel=2 " Use concealchar and highlight with Conceal group
+ syn match concealOperator "<=" conceal cchar=≤
+ syn match concealOperator ">=" conceal cchar=≥
+ syn keyword concealKeyword lambda conceal cchar=λ
+ hi! link concealOperator Conceal
+ hi! link concealKeyword Conceal
+endif
diff --git a/vim/after/syntax/python.vim b/vim/after/syntax/python.vim
@@ -0,0 +1,8 @@
+if has('conceal')
+ setl conceallevel=2 " Use concealchar and highlight with Conceal group
+ syn match concealOperator "<=" conceal cchar=≤
+ syn match concealOperator ">=" conceal cchar=≥
+ syn keyword concealKeyword lambda conceal cchar=λ
+ hi! link concealOperator Conceal
+ hi! link concealKeyword Conceal
+endif
diff --git a/vim/vimrc b/vim/vimrc
@@ -586,11 +586,11 @@ set grepprg=ag\ --vimgrep
set updatetime=100
" }}}1
" Editor {{{1
-" In general, don't want anything concealed
-if has('conceallevel')
+" In general, don't conceal anything
+if has('conceal')
set conceallevel=0
endif
-"
+
" Change cursor shape between insert and normal mode in iTerm2.app and
" Alacritty
if exists('$TMUX')
@@ -746,18 +746,21 @@ if has('terminal')
endif
" }}}
" Digraphs {{{1
-exe 'digraphs o+ ' .. 0x2295
-exe 'digraphs O+ ' .. 0x2a01
-exe 'digraphs e$ ' .. 0x20ac
-exe 'digraphs \|> ' .. 0x21a6
-exe 'digraphs [[ ' .. 0x27e6
-exe 'digraphs ]] ' .. 0x27e7
-exe 'digraphs xs ' .. 0x2093
-exe 'digraphs js ' .. 0x2c7c
-exe 'digraphs -< ' .. 0x227a
-exe 'digraphs n# ' .. 0x2115
-exe 'digraphs r# ' .. 0x211d
-exe 'digraphs z# ' .. 0x2124
+let digraphs = {
+ \ 'o+': 0x2295, 'O+': 0x2a01,
+ \ 'e$': 0x20ac,
+ \ '\|>': 0x21a6,
+ \ '[[': 0x27e6, ']]': 0x27e7,
+ \ 'aS': 0x1D43, 'bS': 0x1D47, 'cS': 0x1D9C, 'dS': 0x1D48, 'eS': 0x1D49, 'fS': 0x1DA0, 'gS': 0x1D4D, 'hS': 0x02B0, 'iS': 0x2071, 'jS': 0x02B2, 'kS': 0x1D4F, 'lS': 0x02E1, 'mS': 0x1D50, 'nS': 0x207F, 'oS': 0x1D52, 'pS': 0x1D56, 'rS': 0x02B3, 'sS': 0x02E2, 'tS': 0x1D57, 'uS': 0x1D58, 'vS': 0x1D5B, 'wS': 0x02B7, 'xS': 0x02E3, 'yS': 0x02B8, 'zS': 0x1DBB, 'AS': 0x1D2C, 'BS': 0x1D2D, 'DS': 0x1D30, 'ES': 0x1D31, 'GS': 0x1D33, 'HS': 0x1D34, 'IS': 0x1D35, 'JS': 0x1D36, 'KS': 0x1D37, 'LS': 0x1D38, 'MS': 0x1D39, 'NS': 0x1D3A, 'OS': 0x1D3C, 'PS': 0x1D3E, 'RS': 0x1D3F, 'TS': 0x1D40, 'US': 0x1D41, 'VS': 0x2C7D, 'WS': 0x1D42,
+ \ 'as': 0x2090, 'es': 0x2091, 'is': 0x1D62, 'os': 0x2092, 'rs': 0x1D63, 'us': 0x1D64, 'vs': 0x1D65, 'xs': 0x2093, 'ys': 0x1D67,
+ \ '0S': 0x2070, '1S': 0x00B9, '2S': 0x00B2, '3S': 0x00B3, '4S': 0x2074, '5S': 0x2075, '6S': 0x2076, '7S': 0x2077, '8S': 0x2078, '9S': 0x2079, '+S': 0x207A, '-S': 0x207B, '=S': 0x207C, '(S': 0x207D, ')S': 0x207E,
+ \ '0s': 0x2080, '1s': 0x2081, '2s': 0x2082, '3s': 0x2083, '4s': 0x2084, '5s': 0x2085, '6s': 0x2086, '7s': 0x2087, '8s': 0x2088, '9s': 0x2089, '+s': 0x208A, '-s': 0x208B, '=s': 0x208C, '(s': 0x208D, ')s': 0x208E,
+ \ '-<': 0x227a,
+ \ 'n#': 0x2115, 'r#': 0x211d, 'z#': 0x2124 }
+
+for [dg, code] in items(digraphs)
+ exe 'digraphs ' .. dg .. ' ' .. code
+endfor
" Mappings {{{1
" So I don't have to mash shift all the time
nnoremap ; :