" Prose - Configurations related to those times I write things that aren't code

function! s:PreviewInMarked()
  silent! call system("open -a 'Marked 2' " . expand("%:p"))
endfunction
command! PreviewInMarked call <sid>PreviewInMarked()
nnoremap <leader>md :PreviewInMarked<cr>

function! s:FixLastSpellingError()
  let position = getpos('.')[1:3]
  let current_line_length = len(getline('.'))
  normal! [s1z=
  let new_line_length = len(getline('.'))
  let position[1] += (new_line_length - current_line_length)
  call cursor(position)
  silent! call repeat#set("\<Plug>FixLastSpellingError", 0)
endfunction
command! FixLastSpellingError call <sid>FixLastSpellingError()
nnoremap <Plug>FixLastSpellingError :FixLastSpellingError<cr>
imap <C-j> <C-o>:write<cr><C-o>:FixLastSpellingError<cr>
" map <leader>sp <Plug>FixLastSpellingError
" imap <C-y> <C-o>:w<cr><C-o><leader>sp

" vim:ft=vim