I'm trying to get the Pencil plugin to run with the noautoindent and nobreakindent settings. This is what I've tried in my init.vim:

+ 201 function! s:pencil_enter()
+ 202     set nobreakindent
+ 203     set noautoindent
+ 204 endfunction
+ 209 autocmd! User PencilEnter nested call <SID>pencil_enter()

It doesn't work though. Whenever I do :Pencil, all the indenting in my text file continues to get messed up (breakindent).

What might be wrong with the function? If I do it manually with the file open :set nobreakindent, it works fine.

  • You probably want setlocal; what is the output (after :Pencil) of :verbose setlocal breakindent?
    – D. Ben Knoble
    Commented Oct 16, 2020 at 17:50
  • It didn't produce any output when I did the verbose option. I also tried setlocal in the function and that didn't make a difference either.
    – aris
    Commented Oct 16, 2020 at 17:54
  • There should be output---note the question mark was part of the command, not part of my asking a question
    – D. Ben Knoble
    Commented Oct 16, 2020 at 18:10
  • Ah! With the question mark, the output indicates "breakindent" and it was Last set from ~/.config/nvim/plugged/vim-pencil/autoload/pencil.vim line 283
    – aris
    Commented Oct 16, 2020 at 20:39
  • Ok, so either your autocommand isnt running, or they’re overriding it. Why is there a bang on autocmd?
    – D. Ben Knoble
    Commented Oct 16, 2020 at 21:02


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.