christoomey / vim-tmux-runner

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

Using VtrSendFile overrides the custom command saved with VtrSendCommandToRunner #111

Closed francescoboc closed 6 months ago

francescoboc commented 7 months ago

Hi! I am facing a little problem with the VtrSendCommandToRunner command. The problem is as follows:

  1. Open a python script in vim and an ipython session in a split pane
  2. Call VtrSendCommandToRunner to define my custom command, for example plt.clf(), which is a python command to clear the current figure
  3. Call VtrSendFile tu execute the whole python script (and plot some stuff in a figure). Note that I have defined my custom run command as:
    let g:vtr_filetype_runner_overrides = {
    \ 'python': 'run {file}',
    \ } 
  4. Now whenever the VtrSendCommandToRunner command is called, the whole python script is run (same effect as calling VtrSendFile), instead of the custom command (plt.clf()) defined earlier

Am I doing something wrong or is this a bug?

On a side note, is it possible to define a custom command in my .vimrc, so that it is executed automatically whenever I call VtrSendCommandToRunner (or another equivalent command), without having to re-define it from scratch everytime?

Thank you very much!

christoomey commented 6 months ago

Hey @francescoboc. Some notes on the various questions:


On a side note, is it possible to define a custom command in my .vimrc, so that it is executed automatically whenever I call VtrSendCommandToRunner (or another equivalent command), without having to re-define it from scratch everytime?

I'm sure I 100% understand your intended use case, but you definitely can define an alternative command to run that wraps VtrSendCommandToRunner, e.g.

command! MyVtrCommand VtrSendCommandToRunner plt.clf()

Hope that all helps. I'm going to close this now as I don't think there is an issue here, but feel free to comment back if you think I missed something.

francescoboc commented 6 months ago

Got it! VtrSendCommandToRunner plt.clf() is what I needed :) Thanks for the quick response and for this great vim plugin!