preservim / vimux

easily interact with tmux from vim
MIT License
2.19k stars 159 forks source link

Not expanding directory to open buffer #144

Closed tommyc38 closed 3 years ago

tommyc38 commented 7 years ago

I read your documentation and the command below works...

nmap <F4> :call VimuxRunCommand("clear;python " . bufname("%"))

However, I am trying to run my code in iPython and it seems like I need two commands. One to initiate ipython

nmap <F5> :call VimuxRunCommand("clear;ipython")

and another to run my buffer. The problem is that it only sees the name of my file/buffer and not the path to it.

nmap <F6> :call VimuxRunCommand("run " . bufname("%"))

I have also tried VimuxSendKeys and VimuxSendText but only get the name of the file and not the path to it. Am I doing something wrong?

alerque commented 3 years ago

Expanding the value of % should do the trick. If you are getting only a name without a path my guess (from experience with a similar issue in other plugins) is that you have some plugin that is resetting the CWD in vim to the location of the buffer. I had trouble with a number of TeX and Pandoc related plugins that were doing this. Once I got them cleaned up so they didn't mess with VIM's current working directory my buffer paths were usable again. I suspect you have a similar issue.

If that isn't it feel free to comment and I'll reopen this for tracking whatever real fix is needed.