Reputation: 1289
I'm using the following function + command to invoke the debugger in Vim:
function! TermDebugArm(executable)
packadd termdebug
let g:termdebugger="arm-none-eabi-gdb"
Termdebug a:executable
endfunction
command! -complete=file -nargs=1 TermDebugArm :call TermDebugArm(<f-args>)
Unfortunately, the Termdebug
command gets the literal argument "a:executable" and not the actual value it should represent (i.e. the filename passed to the command that called the function).
What am I doing wrong?
Upvotes: 0
Views: 278
Reputation: 8898
You need to use the :execute
command to build a command from strings, which will allow you to use the value of a:executable
as a literal:
execute "Termdebug ".a:executable
Or you can use the feature of :execute
that will join multiple arguments with a space, so you don't need an explicit concatenation:
execute "Termdebug" a:executable
See :help :execute
.
Upvotes: 1