Skip to content

Instantly share code, notes, and snippets.

@towc
Created April 7, 2019 09:01
Show Gist options
  • Save towc/fa346b8725530d1e8e7bba2d4b76b25c to your computer and use it in GitHub Desktop.
Save towc/fa346b8725530d1e8e7bba2d4b76b25c to your computer and use it in GitHub Desktop.
function! UseBookMode()
LivedownPreview
Goyo
IndentLinesDisable
Limelight
g:saving_at_every_edit = 0
call ToggleSaveEveryEdit()
set linebreak
set wrap
nnoremap j gj
nnoremap k gk
" add a note
let @i = '?note-index 2f-lyt"a<a name="note-content-pyiwA" href="#note-index-pA"><sup>pA</sup></a>Go</p><a name="note-index-pA" href="#note-content-pA">pa</a>: </p>Bi'
endfunction
nnoremap <leader>nb :call UseBookMode()<cr>
let g:saving_at_every_edit = 0
function! ToggleSaveEveryEdit()
if g:saving_at_every_edit == 0
let g:saving_at_every_edit = 1
augroup SaveAtEveryEdit
au TextChanged,TextChangedI <buffer> silent write
augroup END
else
let g:saving_at_every_edit = 0
" delete group
au! SaveAtEveryEdit
endif
endfunction
nnoremap <leader>ss :call ToggleSaveEveryEdit()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment