VIM: Adds autoload function for writing mode

Writing mode is to be used when I am writing prose rather than code, for
example markdown files or emails.

Currently, it enables spellcheck and adds insert mode mappings that add
undo points when certain punctuation is inserted, such as full stops or
commas.

Currently this is used for markdown files, emails and git commits
Jonathan Hodgson 4 years ago
parent b7b2422a3e
commit cf0b27ee26
  1. 12
      nvim/.config/nvim/autoload/mine/functions.vim
  2. 1
      nvim/.config/nvim/ftplugin/gitcommit.vim
  3. 2
      nvim/.config/nvim/ftplugin/mail.vim
  4. 2
      nvim/.config/nvim/ftplugin/markdown.vim

@ -0,0 +1,12 @@
function! mine#functions#text() abort
" set spellchecking
set spell
" Add undo points when this punctuation is added
inoremap <buffer> ! !<C-g>u
inoremap <buffer> , ,<C-g>u
inoremap <buffer> . .<C-g>u
inoremap <buffer> : :<C-g>u
inoremap <buffer> ; ;<C-g>u
inoremap <buffer> ? ?<C-g>u
endfunction

@ -0,0 +1 @@
call mine#functions#text()

@ -1 +1 @@
setlocal spell
call mine#functions#text()

@ -1 +1 @@
setlocal spell
call mine#functions#text()

Loading…
Cancel
Save