Skip to content

Commit 93e041d

Browse files
authored
Merge pull request #27 from vitalk/19-optional-mode-keys
Optional mode keys
2 parents 6574694 + a26cf4e commit 93e041d

File tree

2 files changed

+50
-23
lines changed

2 files changed

+50
-23
lines changed

doc/simple-todo.txt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments
3131
Plugin exposes some <Plug> maps. These maps are available for normal, visual
3232
and insert modes.
3333

34-
To completely disable default key bindings (which is pretty handy) use:
34+
All default key bindings (which is pretty handy) can be completely disabled
3535
>
36-
let g:simple_todo_map_keys = 0
36+
let g:simple_todo_map_keys = 0
37+
<
38+
or disabled separately for each mode
39+
>
40+
let g:simple_todo_map_normal_mode_keys = 0
41+
let g:simple_todo_map_insert_mode_keys = 0
42+
let g:simple_todo_map_visual_mode_keys = 0
3743
<
3844
*<Plug>(simple-todo-new)*
3945
<Plug>(simple-todo-new)
@@ -67,15 +73,13 @@ let g:simple_todo_map_keys = 0
6773
3. Customization *simple-todo-customization*
6874

6975
The default tick symbol `x` can be changed by defining:
70-
7176
>
72-
let g:simple_todo_tick_symbol = 'y'
73-
77+
let g:simple_todo_tick_symbol = 'y'
78+
<
7479
You may also change the list symbol `-` by defining:
75-
76-
let g:simple_todo_list_symbol = '*'
80+
>
81+
let g:simple_todo_list_symbol = '*'
7782
<
78-
7983
==============================================================================
8084
4. Contributing *simple-todo-contrib*
8185

plugin/simple-todo.vim

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ if !exists('g:simple_todo_map_keys')
1818
let g:simple_todo_map_keys = 1
1919
endif
2020

21+
" Do enable normal mode keys? (yes)
22+
if !exists('g:simple_todo_map_normal_mode_keys')
23+
let g:simple_todo_map_normal_mode_keys = 1
24+
endif
25+
26+
" Do enable insert mode keys? (yes)
27+
if !exists('g:simple_todo_map_insert_mode_keys')
28+
let g:simple_todo_map_insert_mode_keys = 1
29+
endif
30+
31+
" Do enable visual mode keys? (yes)
32+
if !exists('g:simple_todo_map_visual_mode_keys')
33+
let g:simple_todo_map_visual_mode_keys = 1
34+
endif
35+
2136
if !exists('g:simple_todo_tick_symbol')
2237
let g:simple_todo_tick_symbol = 'x'
2338
endif
@@ -77,21 +92,29 @@ inore <silent> <Plug>(simple-todo-mark-as-undone) <Esc>:execute 's/^\(\s*[-+*]\?
7792
" Key bindings {{{
7893

7994
if g:simple_todo_map_keys
80-
nmap <Leader>i <Plug>(simple-todo-new)
81-
imap <Leader>i <Plug>(simple-todo-new)
82-
imap <Leader>I <Plug>(simple-todo-new-start-of-line)
83-
nmap <Leader>I <Plug>(simple-todo-new-start-of-line)
84-
vmap <Leader>I <Plug>(simple-todo-new-start-of-line)
85-
nmap <Leader>o <Plug>(simple-todo-below)
86-
imap <Leader>o <Plug>(simple-todo-below)
87-
nmap <Leader>O <Plug>(simple-todo-above)
88-
imap <Leader>O <Plug>(simple-todo-above)
89-
nmap <Leader>x <Plug>(simple-todo-mark-as-done)
90-
vmap <Leader>x <Plug>(simple-todo-mark-as-done)
91-
imap <Leader>x <Plug>(simple-todo-mark-as-done)
92-
nmap <Leader>X <Plug>(simple-todo-mark-as-undone)
93-
vmap <Leader>X <Plug>(simple-todo-mark-as-undone)
94-
imap <Leader>X <Plug>(simple-todo-mark-as-undone)
95+
if g:simple_todo_map_normal_mode_keys
96+
nmap <Leader>i <Plug>(simple-todo-new)
97+
nmap <Leader>I <Plug>(simple-todo-new-start-of-line)
98+
nmap <Leader>o <Plug>(simple-todo-below)
99+
nmap <Leader>O <Plug>(simple-todo-above)
100+
nmap <Leader>x <Plug>(simple-todo-mark-as-done)
101+
nmap <Leader>X <Plug>(simple-todo-mark-as-undone)
102+
endif
103+
104+
if g:simple_todo_map_insert_mode_keys
105+
imap <Leader>i <Plug>(simple-todo-new)
106+
imap <Leader>I <Plug>(simple-todo-new-start-of-line)
107+
imap <Leader>o <Plug>(simple-todo-below)
108+
imap <Leader>O <Plug>(simple-todo-above)
109+
imap <Leader>X <Plug>(simple-todo-mark-as-undone)
110+
imap <Leader>x <Plug>(simple-todo-mark-as-done)
111+
endif
112+
113+
if g:simple_todo_map_visual_mode_keys
114+
vmap <Leader>I <Plug>(simple-todo-new-start-of-line)
115+
vmap <Leader>X <Plug>(simple-todo-mark-as-undone)
116+
vmap <Leader>x <Plug>(simple-todo-mark-as-done)
117+
endif
95118
endif
96119

97120
" }}}

0 commit comments

Comments
 (0)