Is there anything like eval(is_recording())that I can call in my vimscript to find out if I am currently recording a macro? I would have thought this works:eval(mode(1))but that just returns n.Not sure if it matters, but I am using neovim, so if it's exclusive to neovim, that is okay.
Is there a way to detect if I'm recording in vimscript?
vimscript;neovim;macro
Firstly, I think that your problem is mainly a XY problem. You should give us more information about what you are trying to do in the end and I think we could find another solution.Now here is a workaround, it is probably not ideal and certainly not very robust but you could add these lines to your .vimrc:let g:isRecording = 0nnoremap Q :call ToggleRecording()<CR>qfunction! ToggleRecording()    let g:isRecording = !g:isRecording    echo is recording  . g:isRecordingendfunctionThe idea is that the recording mode is toggled exclusively when you press q in normal mode.Based on that you create a variable g:isRecording which will be toggled each time you start or stop a recording. This way when you start recording g:isRecording will be set to 1 and to 0 when you stop recording. You can then access the recording state via the value of the variable.The drawback is that to avoid recursive mapping, you'll have to use Shit-q  to start and stop recording instead of q. (Note that it is not such a big problem: I've been using shift-q to toggle record mode for some time because I don't like the original shift-q behavior)The main problem of this solution is that if you forgot about it and use q the variable will not be toggled but you can't disable q (e.g. with nnoremap q <nop>) because if you do the shift-q won't' work anymore.