I'm trying to get terminal size from within Vim, but calling :!tput cols  always returns 80 no matter actual size of the terminal. Running the command from terminal returns correct value.
Is there a way to get number of columns in terminal from within Vim? Why is the command above yielding incorrect value? I guess it has something to do with how Vim runs external command.
There's also $COLUMNS shell variable but it looks these are not exported to child process (vim) as stated here: LINES and COLUMNS environmental variables lost in a script