I have a little function I'm trying to fix. I'd like to change my terminal Vim window size using the ASCII escape sequence \e[8;40;130t so that my writing window size stays the same when I use a plugin like Tagbar.

The command printf '\e[8;40;130t' works within the terminal (iTerm2 with Disable session-initiated window resizing unchecked in the profile preference). But the same command, issued through Vim using exec system("printf '\e[8;40;130t'") doesn't work.

Here's the full function:

" 'F8' toggle Tagbar side-window tag browser
let g:is_tagbar=0
function AdjustWindowWidth()

    exec 'TagbarToggle'

    if (g:is_tagbar==0)
      let g:is_tagbar=1
      call system("printf '\e[8;40;130t'")
      let g:is_tagbar=0
      call system("printf '\e[8;40;100t'")

noremap <F8> :exec AdjustWindowWidth()<CR>

Does anyone have a suggestion on how to fix the issue?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.