Home  >  Q&A  >  body text

vim sets the width of a line of code

I don’t want to write too long code in one line. I want to automatically wrap the line after writing a certain width. How should I configure this?

textwidth=90 has been set

But it does not take effect in the editor (vim has been restarted).

天蓬老师天蓬老师2712 days ago799

reply all(4)I'll reply

  • 阿神

    阿神2017-05-16 16:40:11

    It feels bad to have automatic line wrapping. I used a vertical bar to set the line width, which is equivalent to a reminder. https://github.com/ruanyl/bigvim/blob/master/vimrc#L106

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 16:40:11

    set columns=40

    reply
    0
  • 阿神

    阿神2017-05-16 16:40:11

    :set tw?

    What does it show?

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 16:40:11

    :help wrap

    reply
    0
  • Cancelreply