preservim / vim-pencil

Rethinking Vim as a tool for writing
Other
1.57k stars 38 forks source link

unable to indent beginning of paragraph #69

Open rebelot opened 6 years ago

rebelot commented 6 years ago

Yeah... that's it. awesome, until I realized I have to toggle Pencil off, indent paragraph and not touch it with pencil on ever again or it will indent the whole block.

Perhaps I am missing something, but the core functionality of this plugin is also preventing something very common such as paragraphs first line indentation.

of course w/ softwrap this behavior is understandable, since what I see as many lines are in fact a single long wrapped line, and indenting it as a block is fair. This makes no sense although with hard wraps set, since every line is a damn standalone line and I wish I was able to modify the beginning of a line with spaces without seeing all the lines after it becoming indented..

EDIT: allow me to rephrase how do I retain this plugin auto formatting functionality with the possibility of adding white spaces at the beginning of a paragraph without indenting the following "hard-wrapped" lines?

EEDIT: your plugin is awesome, I had issues figuring out the problem was the autoindent option...

kimfucious commented 5 years ago

Hey, @rebelot how'd you get that working, anyhow?

rifuso commented 4 years ago

I'm also not able to have indented first lines of a paragraph. I've tried setting each of these in turn but have had no luck:

:setlocal noautoindent :setlocal nocindent :setlocal nosmartindent :setlocal indentexpr=

Any suggestions would be appreciated.

wpwilber commented 4 years ago

I'm having the same issue as the last two comments and have had no luck using correcting it using the autoindent option.

EDIT: For anyone still looking for a solution I've had success with :set nobreakindent

This allows for first line indents in softwrapped text while in vim-pencil.

alerque commented 4 years ago

@wpwilber Is that the solution or is that a hack? Is that setting something vim-pencil should be enabling internally all the time do you think?

wpwilber commented 4 years ago

For my use the only inconvenience was in determining which setting was causing the unwanted formatting, since the breakindent option doesn't seem to be commonly used. If a list of formatting options enabled by vim-pencil was listed somewhere obvious it might have saved me some frustration.

If anyone finds this while trying to configure vim-pencil to allow first line indents with soft wrapped text, you need to set noautoindent as well as nobreakindent together each time pencil starts for best results. I put a function in my .vimrc that starts pencil and sets both options when I enter Goyo.

function! s:goyo_enter()
    Limelight
    Pencil
    set nobreakindent
    set noautoindent
endfunction

function! s:goyo_leave()
    Limelight!
    PencilOff
endfunction

autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()

Might be useful to someone.