1

Sometimes I want to reformat a paragraph using gq but with a different value than the one set in my configuration for this filetype. Since this happens only occasionally within a buffer of such type (pandoc markdown) I also do not want to change the default value of 80 characters.

Thus, how do I reformat a paragraph using a different value for textwidth than the default one?

  • A slightly-but-not-entirely facetious answer: :nnoremap <leader>gqap :set textwidth=20<cr> <bar> gqap <bar> :set textwidth=80<cr> – Rich Mar 29 '17 at 13:48
  • thx. I have to admit that I came about this idea too. But for obvious reasons I wanted to look out if a more elegant and native solution exist. Still thx. – Cutú Chiqueño Mar 29 '17 at 14:06
  • You could make it more elegant by preserving the actual textwidth setting and tidying it up to work properly with visual mode/motions, etc. But essentially you'd still be doing this, and unless I'm mistaken, this is your only option (which is why my comment was "not entirely" facetious.) – Rich Mar 29 '17 at 14:52
  • 1
    OK. Since it seems the only option would you like to post it as a real answer to get the ward? – Cutú Chiqueño Mar 30 '17 at 6:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.