As I have mentioned earlier in the blog, I really don’t like GUI based Integrated Development Environments. The reasons I find them pointless are,
- I work with a lot of programming languages and environments simultaneously with no intention of being an expert in any one of them. For example, I program in java-android, java-processing, latex, R, javascript-node, javascript-general, shell scripting, sql-postgres all in one day. I cannot gain expertise with all of them and I don’t find investing time in just one of them worthwhile.
- Since I never deal with anything bigger than a one person project, I almost never use any advanced IDE features like debugging etc. The only things I find useful in a GUI based IDE are syntax highlighting and some of the WYSWYG stuff.
- I work with headless systems where I don’t have the permissions to install my favourite GUI systems, so irrespective of how good an IDE is I cannot use them in the most powerful machines I have at my disposal. I need my workflow to be portable to the least common denominator.
Because of this I had to give up on one of the best GUI IDEs I have ever seen – R Studio. Though I could get by with most of the stuff with vim and screen the biggest feature in R studio I missed was the ability to execute commands from the script into the console. Today I figured out how to implement the same in my vim+screen+R setup.
map <C-L> "kyy:echo system("screen -S $STY -p R -X stuff ".escape(shellescape(@k),"$"))<CR>j vmap <C-L> "xy:echo system("screen -S $STY -p R -X stuff ".escape(shellescape(@x."\n"),"$"))<CR>j
Having these two lines in the .vimrc adds mapping to Ctrl-L in normal mode and in visual mode to transfer commands from the current file to the window with R console opened under the current screen session. In normal mode the entire line is sent to R and in visual mode what ever that is selected is sent to R. A demo of these mappings is shown below.
Did you try https://github.com/jalvesaq/Nvim-R ?
Yes! Nvim-R is awesome… Thank you very much ! I just have these simple ones in my vimrc for working on remote servers where I cannot install new stuff.