1

There's a very weird thing that occurs when I type a comment that it inserts a newline after a max-width which I don't want to have done. For example: here is me typing it in: https://gyazo.com/7dd2fccd0d988082abf2e6f8a9be945e.

Why does this occur?

The only (hackish) way I was able to disable it is to set :set paste, but hopefully there's a better way to disable this autowrapping?

    "When in normal mode, treat an enter like insert -- as I continue typing this
    line it automatically adds a new line
    :nmap <leader>&  O
    :nmap <CR> i<CR>
3
  • 1
    Please include output of :set formatoptions? comments? textwidth?, the combination of these three should define the behavior of automatically wrapping lines, in particular comment lines.
    – filbranden
    Apr 24, 2020 at 1:47
  • @filbranden cool! I never knew you could do :set whatever? and it would tell you what the current setting was. Doing that helped me figure it out -- setting textwidth=0 fixed it for me.
    – David542
    Apr 24, 2020 at 2:44
  • But set tw=0 is not necessarily the only or best way to fix this... I tried to reproduce your issue on a *.vim file and while mine wraps the lines, it starts the wrapped line with a comment character... So I was curious why your setup seems to be acting differently...
    – filbranden
    Apr 24, 2020 at 3:26

0

Your Answer

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

Browse other questions tagged or ask your own question.