Nvim-R icon indicating copy to clipboard operation
Nvim-R copied to clipboard

Open tmp.R files in readonly mode?

Open sebffischer opened this issue 4 years ago • 2 comments

Hallo,

This is a feature request. Sometimes when I am debugging, I unintentionally edit the **R.tmp.R file, which can be annoying if I don't realize this, because then changes can be lost and I have to fix bugs again. Is it possible to enable a flag that allows to open these temporary files in read-only mode?

Thank you for Nvim-R! :)

sebffischer avatar Dec 11 '21 17:12 sebffischer

Actually, the file should be immediately deleted after being sourced. See the source code of nvimcom:::source.and.clean:

function (f, ...)
{
    on.exit(unlink(f))
    source(f, ...)
}

You could write an auto command in your vimrc/init.vim to do something (echo a warning message, turn the buffer read-only...) if the file name ends in ".R.tmp.R", but this will not be necessary if we discover why the temporary file isn't being deleted.

jalvesaq avatar Dec 13 '21 01:12 jalvesaq

But this is only relevant when I send the code to the console, right? I am tallking about the debugging scenario, where the source-files for the debugged functions are opened.

sebffischer avatar Dec 13 '21 11:12 sebffischer