John Connor
John Connor

Reputation: 3

vim mapping a plugin and providing argument coming from an external script

I use ConqueGdb plugin on a fairly frequent basis for my debugging needs. I decided to set a mapping for it to make my life a little easier. Below is what my mapping looks like -

map gd :ConqueGdb ./binary_name !script_which_returns_pid_of_binary

OR

map gd: ConqueGdb ./binary_name str2nr(system('~/bin/which_pid.sh'))

I noticed that the script in this case is not getting evaluated but instead being pasted as text. Then I tried again by wrapping this script in a function which returns the pid -

map gd :ConqueGdb ./binary_name call GETPID()

Same issue persisted.

Finally, I created a function and within in, I added the

ConqueGdb ./binary_name pid_variable

But here too the same issue prevails (i.e. pid_variable gets passed as text rather than being evaluated to the value it holds).

What am I doing wrong and how can I get vim to use the value stored in the variable rather than assume it is plain text?

TIA.

Upvotes: 0

Views: 84

Answers (1)

Luc Hermitte
Luc Hermitte

Reputation: 32976

It seems you're looking for :exe

I guess something like:

exe ':ConqueGdb ./binary_name'. str2nr(system('~/bin/which_pid.sh')) 

Instead of ./binary_name you could also use a variable that you assign somewhere else (like a local vimrc that acts as a plugin that defines your project (preferences & more))

Upvotes: 1

Related Questions