Q:

How can I call an editor command from a vimscript?

I want to remove an unwanted scrollbar from taglist. I created a function and a command like this:
function s:TlistWaToggle()
    normal :TlistToggle<cr> " <- this does not work
    set guioptions-=r
endfunction

command! -nargs=0 -bar TlistWaToggle call s:TlistWaToggle()

I want to wrap the call to :TlistToggle together with the command to remove the right scrollbar (I have that setting of course, but it always reappears, so this is a workaround). Currently my :TlistWaToggle doesn't do anything. How can I make it work?

A:

Vim script uses ex commands, and apparently :TlistToggle is an ex command…
function! s:TlistWaToggle()
    TlistToggle
    set guioptions-=r
endfunction

A:

In addition to @sidyll's answer: :normal is not a :*map, it accepts only raw character strings. Correct command will be execute "normal! :TlistToggle\<CR>" (or execute "normal! :TlistToggle\n"). Note that you should not use non-banged version in your scripts.
I don't think you will ever use :normal! to execute an ex command, but my answer would be useful when you want to pass any other special character. It also applies to feedkeys() call.
By the way, comments and other commands will be considered part of string passed to :normal command.

