preservim / vim-pencil

Rethinking Vim as a tool for writing
Other
1.58k stars 39 forks source link

Hard wrapping not working for ft=mail #41

Open niklaas opened 8 years ago

niklaas commented 8 years ago

I don't know what I'm doing wrong here. Maybe I misunderstand the readme. I have the following in my .vimrc

augroup pencil
    autocmd!
    autocmd FileType text     call pencil#init()
    autocmd FileType mail     call pencil#init({'wrap': 'hard', 'textwidth': '72'})
    autocmd FileType markdown call pencil#init()
augroup END

Nonetheless, if I start writing an email with ft=mail textwidth remains 0. As I got it from the readme, even without enforcing both wrap and textwidth I should get textwidth set -- doesn't work either.

If I verbose set tw? it says that it got loaded from pencil but it 0. On the contrary, if I do :HardPencil everything works as expected.

Any help appreciated.

reedes commented 8 years ago

Sorry for the delay. Try the 'textwidth':'72' without the quotes around 72.

niklaas commented 8 years ago

No problem! I tried it without the quotes but I still get tw=0. My workaround is to start vim with vim -c 'set tw=72' from mutt.

So I assume that vim-pencil should auto-detect hard wrapping automatically now. If you want to you can close this, but I'm also open for more suggestions/debugging. :-)

niklaas commented 8 years ago

Well, I just realised that pencil isn't loaded at all. It only loads if I invoke it with :Pencil. Some ideas why that's the case?

niklaas commented 8 years ago

It will work if I invoke vim the following way:

vim -c "set ft=mail tw=72"
reedes commented 8 years ago

If the filetype is 'mail', the autocmd statement should be firing, but isn't. I'm not sure why.

Is it initializing via the autocmd for markdown?

rvodden commented 6 years ago

I realise this is an old issue, but I seem to be having the same problem (only for md, not for mail). @niklaas did you solve it?

niklaas commented 6 years ago

@rvodden I'm sorry but I stopped using vim-pencil. I switched to vim-pandoc some months ago.