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?
You can always execute Vimscript by running each command in command mode (the one you prefix with : ), or by executing the file with commands using a :source command. Historically, Vim scripts have a . vim extension. Here, :so is a short version of :source , and % refers to the currently open file.
:call is for calling functions, e.g.: function! s:foo(id) execute 'buffer' a:id endfunction let target_id = 1 call foo(target_id) :execute is used for two things: Construct a string and evaluate it. This is often used to pass arguments to commands: execute 'source' fnameescape('l:path')
Vim script (also called Vimscript or VimL) is the scripting language built into Vim. Based on the ex editor language of the original vi editor, early versions of Vim added commands for control flow and function definitions.
Vim script uses ex commands, and apparently :TlistToggle
is an ex command…
function! s:TlistWaToggle()
TlistToggle
set guioptions-=r
endfunction
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With