blob: 9e7b6894cd4443a62af39c97c2e79c408196aa7d (
plain)
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
|
" lib.vim - Miscelaneous functions
"
" Author: Silvio Rhatto <rhatto@riseup.net>
"
" Checkbox handling
"
" This is commented out because vitalk/vim-simple-todo is being used instead.
"
" Thanks https://www.reddit.com/r/vim/comments/slqsao/readymade_solution_for_handling_markdown/
"function! ToggleCheckbox()
" let line = getline('.')
"
" if line =~ '- \[ \]'
" call setline('.', substitute(line, '- \[ \]', '- \[x\]', ''))
" elseif line =~ '- \[x\]'
" call setline('.', substitute(line, '- \[x\]', '- \[ \]', ''))
" elseif line =~ '- '
" call setline('.', substitute(line, '- ', '- \[ \] ', ''))
" endif
"endf
" Remove trailing spaces
"
" Thanks https://vi.stackexchange.com/a/456
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
command! TrimWhitespace call TrimWhitespace()
|