Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toggling behavior of checkbox #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions autoload/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,20 @@ function! markdown#SwitchStatus()
return
endif
if match(current_line, '^\s*[*\-+] \[x\]') >= 0
call setline('.', substitute(current_line, '^\(\s*[*\-+]\) \[x\]', '\1', ''))
if g:markdown_list_switch_order == "cycle"
call setline('.', substitute(current_line, '^\(\s*[*\-+]\) \[x\]', '\1', ''))
else
call setline('.', substitute(current_line, '^\(\s*[*\-+]\) \[x\]', '\1 [ ]', ''))
endif
return
endif
if match(current_line, '^\s*[*\-+] \(\[[x ]\]\)\@!') >= 0
call setline('.', substitute(current_line, '^\(\s*[*\-+]\)', '\1 [ ]', ''))
if g:markdown_list_switch_order == "cycle"
call setline('.', substitute(current_line, '^\(\s*[*\-+]\)', '\1 [ ]', ''))
endif
return
endif

if match(current_line, '^\s*#\{1,5}\s') >= 0
call setline('.', substitute(current_line, '^\(\s*#\{1,5}\) \(.*$\)', '\1# \2', ''))
return
Expand Down
4 changes: 4 additions & 0 deletions ftplugin/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ if !exists('g:markdown_mapping_switch_status')
let g:markdown_mapping_switch_status = '<space>'
endif

if !exists('g:markdown_list_switch_order')
let g:markdown_list_switch_order = 'cycle' " or 'toggle'
endif

if !exists('g:markdown_enable_spell_checking')
let g:markdown_enable_spell_checking = 1
endif
Expand Down