-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.plugins-which-key.vim
39 lines (34 loc) · 1.46 KB
/
init.plugins-which-key.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" which-key {{{1
" TODO: add commands that are hard to remember
"set timeoutlen=500
"nnoremap <silent> <Leader> <Cmd>WhichKey '\\'<CR>
"vnoremap <silent> <Leader> <Cmd>WhichKey '\\'<CR>
"nnoremap <silent> g <Cmd>WhichKey 'g'<CR>
" for letter in ['c', 'f', 'g', 'm', 'o', 'r', 's', 'x']
for letter in ['c']
exe "call MapKey('<M-" . letter . ">', '<Cmd>WhichKey " . '"M_' . letter . '" ' . "<CR>')"
endfor
function! WhichKeyRegister()
" for letter in ['c', 'f', 'g', 'm', 'o', 'r', 's', 'x']
for letter in ['c']
exe " call which_key#register('M_" . letter . "', " . '"g:which_key_map_M_' . letter . '")'
endfor
endfunction
autocmd! User vim-which-key call WhichKeyRegister()
" FIXME: 'T' doesn't work; probably need to create a function.
let g:which_key_map_M_c = {
\ 'C': ['CamelB', 'Transform to camelCase'],
\ 'D': ['cr.', 'Transform to dot.case'],
\ 'K': ['Kebab', 'Transform to kebab-case'],
\ 'P': ['Camel', 'Transform to PascalCase'],
\ 'T': ["viW:\<C-u>exe 'normal \\\\<Plug>Titlecase'\<CR>", 'Transform to Title Case'],
\ 'S': ['Snek', 'Transform to snake_case'],
\ '_': ['Screm', 'Transform to SCREAM_CASE'],
\ }
let g:which_key_map_M_x = {
\ '<M-x>': 'swap words',
\ }
let g:which_key_map_M_m = {
\ 't': 'enable table mode',
\ }