Skip to content

Commit 8f14df5

Browse files
committed
Implements different modes for list items editing (#2)
This commit adds additional mappings for list editing modes switching. In item editing mode the navigation keys are mapped for item navigation while in normal mode navigation mappings are disabled.
1 parent 6c01802 commit 8f14df5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

plugin/vim-todo-lists.vim

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,29 @@ function! VimTodoListsInit()
2828
setlocal shiftwidth=2 expandtab
2929
setlocal cursorline
3030
setlocal noautoindent
31+
call VimTodoListsSetItemMode()
32+
endfunction
33+
34+
35+
" Sets mapping for normal navigation and editing mode
36+
function! VimTodoListsSetNormalMode()
37+
nunmap <buffer> o
38+
nunmap <buffer> O
39+
nunmap <buffer> j
40+
nunmap <buffer> k
41+
nnoremap <buffer> <Space> :silent call VimTodoListsToggleItem()<CR>
42+
noremap <buffer> <leader>e :silent call VimTodoListsSetItemMode()<CR>
43+
endfunction
44+
45+
46+
" Sets mappings for faster item navigation and editing
47+
function! VimTodoListsSetItemMode()
3148
nnoremap <buffer> o o [ ]
3249
nnoremap <buffer> O O [ ]
3350
nnoremap <buffer> j $/^ \[.\]<CR>:noh<CR> f f
3451
nnoremap <buffer> k 0?^ \[.\]<CR>:noh<CR> f f
3552
nnoremap <buffer> <Space> :silent call VimTodoListsToggleItem()<CR>
53+
noremap <buffer> <leader>e :silent call VimTodoListsSetNormalMode()<CR>
3654
inoremap <buffer> <CR> <CR> [ ]
3755
endfunction
3856

0 commit comments

Comments
 (0)