christoomey / vim-tmux-runner

Vim and tmux, sittin' in a tree...
MIT License
291 stars 37 forks source link

Sending custom commands using VtrSendCommandToRunner method #102

Closed yuujay closed 3 years ago

yuujay commented 3 years ago

I am trying to write some custom methods that would send some commands to the runner pane. I am making use of the VtrSendCommandToRunner command to send.

The issue that I am seeing is I am unable to send interpolated/concatenated strings as an argument to the runner.

function! ExecuteCurrentSpecFile()
   let fileName = @%
   VtrSendCommandToRunner 'bundle exec rspec '.l:fileName
endfunction

The function above sends bundle exec rspec .l:fileName as a string instead of something like bundle exec rspec spec/unit/model/controller.rb

Is there a different way to approach this?

christoomey commented 3 years ago

VtrSendCommandToRunner is a vim command and thus a little tricky to work with as you're trying, but there's also a function version provide for this sort of usage:

function! ExecuteCurrentSpecFile()
  call VtrSendCommand('bundle exec rspec ' . @%)
endfunction

Hope that helps! I'm going to close this issue now as I think that should cover your usage, but feel free to comment or reopen if you think I missed anything.

yuujay commented 3 years ago

This fits my need. Thanks Chris!