In a VIM script file, you have access to <sfile>
as demonstrated in this question and answers.. A few examples from this answer:
" Absolute path of script file: let s:path = expand('<sfile>:p') " Absolute path of script file with symbolic links resolved: let s:path = resolve(expand('<sfile>:p')) " Folder in which script resides: (not safe for symlinks) let s:path = expand('<sfile>:p:h')
TMUX supports the ability to source additional using source-file
(see this StackOverflow question and answer regarding for splitting TMUX configuration files).
Now, to my queston. Let's say in my example in my ~/.tmux.conf
I have a line like below
source-file ~/some-workspace-dir/my-tmux.conf
I'd like to be able to refer to files relative to my-tmux.conf
inside of my-tmux.conf
.
If I add a run-shell "pwd"
, it just points out the home directory at ~/.tmux.confrather than
~/some-workspace-dir, the directory containing
my-tmux.conf`.
My question is how do you get the current path of a file being sourced by TMUX source-file
(without parsing the sourced file)?