On 2018-11-05 10:02, Tim Chase wrote:
> $ mkdir a b
> $ cd a
> $ echo hello > included.txt
> $ echo include included.txt > including.txt
> $ cd ../b
> $ ln -s ../a/including.txt include_in_b.txt
> $ vim include_in_b.txt
I think I've found a workable solution:
:set includeexpr=fnamemodify(resolve(@%),':p:h').'/'.v:fname
The trick was learning about three new (to me) things:
1) resolve() chases links as I needed
2) fnamemodify() is the generic way to transform what I'd previously
done only in expand() calls (e.g. "expand('%:p:h')")
3) 'includeexpr' and its "v:fname" are the trigger/glue holding the
whole thing together
So, despite using vim for about two decades, I'm still learning new
tricks.
Hopefully someone else finds this helpful too.
-tim
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment