Comments (8)
It's not that easy. StartR() and RQuit() do more than start and quit R. The functions also set environment variables, create and close Tmux panes etc. I added the option "restart" to the "how" argument of RQuit(). I didn't test it carefully, but it should work with GVim and with Vim if Tmux is started before Vim (please, see the tip about tvim in the plugin's documentation). To restart R, do the following in Vim:
:call RQuit("restart")
We still have to create a user interface to this command. One option is to create yet another shortcut, but I don't know what it could be because <LocalLeader>rr and <LocalLeader>re are already in use. Other option is to create a vimrplugin_ option to turn <LocalLeader>rm into “restart R” instead of just “remove all objects from workspace”. Another option is to create a command, like :RestartR
from vim-r-plugin.
Did you test the RQuit("restart")?
from vim-r-plugin.
Just now.
Works if vim is started inside a tmux session. Otherwise strange behavior: First only the error message "Cannot restart R" popped up, then (after one successful try inside tmux) a new console window is opened instead of vim restarting (?) in a tmux split. And this is permanent across sessions: now even a normal R start (\rf) is opening a new window. Restarting works though. Haven't tested it with gvim.
I'm using vim-7.4.5, tmux-1.8 and KDE's konsole as terminal emulator on Gentoo.
Maybe some other plugins are conflicting. If you cannot reproduce, i'll try it with a clean vimrc.
from vim-r-plugin.
In my last commit I removed the integration with screen plugin. Now, it's necessary to be in a Tmux session to split the terminal in two regions: 4226112
Please, look for the "tvim" tip on the plugin's documentation.
from vim-r-plugin.
Missed that. Than the restart works as intended. But I think RQuit("restart") should start a new R session if none is running. I think I would then remap \rf to start/restart then, although it is a little risky.
Also, with the last commit you can start multiple R sessions (unsure if bug or feature) but only quit the last one started.
from vim-r-plugin.
I will create the option vimrplugin_restart. When vimrplugin_restart = 1, \rf and \rv will mean "Restart R if it's already running and start it if not running yet".
Vim can only quit the last R session: The plugin creates the variable $VIMINSTANCEID whose value is the name of the first buffer opened + local time at startup. This prevents Vim sending code to the wrong R Console in circumstances like the following:
- Start Vim as: vim script_1.R
- Open script_2.R
- Start R.
- Close the first tab (script_1.R)
- Start a new instance of Vim as: vim script_1.R
If you close Vim without quitting R with \rq the R session gets "abandoned".
from vim-r-plugin.
I added the option vimrplugin_restart for Linux/Unix only. If its value is 1, \rf, \rv or \rc will restart R if it's already running.
The function RQuit() no longer deals with the argument "restart".
from vim-r-plugin.
Thanks!
from vim-r-plugin.
Related Issues (20)
- \aa \ae and echo HOT 4
- Sporadic failures to send code chunks to R HOT 6
- vim-r & vim-markdown Rmd syntax highlighting no longer working HOT 13
- omnicompletion not working in .Rmd, .rnw HOT 11
- E364: Library call failed for "SendToRConsole()" HOT 7
- Rhelp is not working with vimpager HOT 4
- tmux settings have changed HOT 12
- \o not working for some cases. HOT 2
- Clear R console input before send R code from vim HOT 4
- ReplaceUnderS() not compatible with vim macros or repeat insert. HOT 4
- Sending command starting with a - (minus) sign HOT 3
- Ignoring Environment Variables on Windows HOT 9
- Running R code in Roxygen example sections does not work for visual selections HOT 12
- To remove extra spaces in vimrplugin_assign_map HOT 2
- tmux -V not available on OpenBSD HOT 2
- Issue with clipboard HOT 2
- [Regression] StartR fails with vim-r 1.2.9 HOT 2
- Vim-R-plugin was replaced by Nvim-R HOT 3
- Start 'tmux' before Vim. The X Window system is required to run R in an external terminal. HOT 1
- Can't see R documentation and plots HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-r-plugin.