2

winwidth(0) returns the width of the current window. However, if vim has multiple vertical splits, forming multiple windows, winwidth(0) would only return the width of the current window.

For example, let say the terminal has 80 columns across. Without, any vertical splits, echo winwidth(0) would return 80. If <C-W>v is used however, echo winwidth(0) would return a number less than 80, equal to the width of one of the split windows.

How can I get the full terminal width without forcing the cursor to jump through all vertical splits (for example, with windcmd l)?

1 Answer 1

3

The solution is the use &columns instead of winwidth(0) to get the width of the terminal window.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.