Skip to content

Vim plugin for toggling checkboxes.

Notifications You must be signed in to change notification settings

klooj/vim-checkbox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 

Repository files navigation

Vim Checkbox

Description

Simple plugin that toggles text checkboxes in Vim. Works great if you're using a markdown file for notes and todo lists.

Installation

Using vim-plug: Plug kludgeon/vim-checkbox, { 'for': 'markdown' }`

Usage

Press <leader>x to toggle the (first) checkbox on the current line, if any. That means, [ ] will be replaced with [x] and [x] with [ ]. If you want more or different checkbox states, you can override the contents of g:checkbox_states with an array of characters, which the plugin will cycle through. The default is:

let g:checkbox_states = [' ', 'x']

When there's no checkbox on the current line, <leader>x will insert one at the pattern defined in g:insert_checkbox. The new checkbox's state will be the first element of g:checkbox_states. The default for g:insert_checkbox is '\<', which will insert the checkbox in front of the first word of the line (not necessarily at the beginning of the line, '^'), which is particularly useful when working in markdown-formatted lists. Other useful patterns would be '^' (insert at the very beginning of the line) and '$' (end of line). When inserting a new checkbox, g:insert_checkbox_prefix and g:insert_checkbox_suffix are prepended/appended, respectively. This is mostly useful for adding a space behind or in front of the checkbox:

let g:insert_checkbox_prefix = ''
let g:insert_checkbox_suffix = ' '

Inserting a checkbox can be disabled by setting g:insert_checkbox to an empty string ('').

About

Vim plugin for toggling checkboxes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%