If I set columns=X, how can I get back to "normal"? Saving the original value might be one way to go, but if I resize the terminal between saving and reverting I'll be ending up with the wrong columns again.

  • Resizing the window seems to reset the &columns value, at least for me. I think saving it is your only option. You can hook in to the VimResized autocmd to get the new &columns default. Aug 17, 2022 at 11:38
  • 1
    Try :!tput cols
    – D. Ben Knoble
    Aug 17, 2022 at 13:48
  • 1
    That'll return whatever you set &columns to @D.BenKnoble (on my system, anyway) Aug 18, 2022 at 0:30
  • The :!tput cols works for me on Ubuntu 22.04.
    – fbence
    Aug 18, 2022 at 6:32
  • Although actually my problem is starting to be the other way around. So vim actually resets the columns whenever the terminal is resized, which is obviously great in general, but that means passing vim -c "set columns=X" actually get overrided by the time vim actually fires up.
    – fbence
    Aug 18, 2022 at 6:39


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.