Tuesday, July 4, 2023

Re: vim9 Equivalence of __FILE__, __LINE__, and __FUNCTION__ usage in C++

Hi Life,

My Main goal is to add prefix of vim9script current '__FUNCTION__' to my debug message.

Thank you for help
Nicolas

Le mardi 4 juillet 2023 à 22:11:31 UTC+2, Lifepillar a écrit :
On 2023-07-04, Nicolas <niva...@gmail.com> wrote:
> Hi,
>
> Is there an equivalence in vim9 of __FILE__, __LINE__, and __FUNCTION__
> usage in C++
><https://stackoverflow.com/questions/597078/file-line-and-function-usage-in-c>

The closest to __FILE__ is likely <sfile> (`:help <sfile>`). I use this
snippet to get the path of the current script:

const PATH = resolve(expand('<sfile>:p'))

Or to source a file in the same directory as the current script:

source <sfile>:h/some_other_script.vim

For __LINE__ and __FUNCTION__, I don't know what "equivalent"
alternative to suggest, but if you elaborate on what your goal is, it
will be easier to help.

Life.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/d1d2044e-f81e-43e5-90b1-453ba95130c7n%40googlegroups.com.

No comments: