I've been experimenting quite a bit with the increasingly popular %>% operator from the magrittr package.
I've used it enough that I've set a keyboard shortcut to save me typing:
shift+command+. instead of space, shift+5, shift+., shift+5, space.
This is great in SublimeTetxt2 but Rstudio does not allow services it does not work if I'm working within Rstudio projects.
So my question is:
Can you define text-inserting key-bindings or shortcuts within Rstudio?
This would be exactly synonymous with the alt+- binding for the assignment <- operator that is oxygen to the otter.
If someone could point me to where the shortcuts are coded in the github repo so I could "hack" my own, I suppose this would be a useful start.
https://github.com/rstudio/rstudio
Just noticed that RStudio v0.98.1079 has shift+command+M mapped for the %>% operator. You can check out the other keyboard shortcuts within RStudio by clicking at the Help tab or by entering alt+shift+K.
I think the answer to your question is "Not currently, but it's on RStudio's to-do list" (see: this and this).
If you want to hack it yourself, it looks like this is where you'd do it (GitHub: rstudio / src / gwt / src / org / rstudio / core / rebind / command / ShortcutsEmitter.java).
Also, it looks like shortcuts are managed here (GitHub: rstudio / src / gwt / src / org / rstudio / core / client / command).
For stuff like that you can use autohotkey. it is an external windows program but can do pretty much anything including hotkeys that type stuff and acronyms that are replaced by stuff you want
R studio Preview (v0.99.671) now supports keybuindings customization. It also has a bunch of other nice improvements, give it a try:
https://www.rstudio.com/products/rstudio/download/preview/
For people now, the best way to do something like this in RStudio if it's not already built in is to add a "snippet":
https://appsilon.com/rstudio-shortcuts-and-tips/#custom-snippets
It's in your global options and can be used to save pieces of code you often repeat to quickly insert it.
Related
Similar to Rstudio, Atom allowed you to run code segments on interactively rather than the entire script all at once. Is there a suitable Julia language IDE that is comparable to rstudio or Atom (juno) and allows for on-the-fly execution of code blocks because Atom is being phased out?
note: Thanks for answers in vs code to obtain interactive feature hold ctrl + return will run code.
Did you try the Microsoft Visual Studio Code ? You can check how to download and setup for Julia notebook in link below.
https://github.com/julia-vscode/julia-vscode#installing-juliavs-codevs-code-julia-extension
The Best, Wr
In Microsoft VS Code you can define code cells using magic comments (## or # %% or #- can play this role - the choice is yours):
##
(your code goes here)
##
A code cell is executed by pressing Alt + Enter while the cursor is inside the cell.
At the code below I pressed Alt + Enter while being in line 10.
The keyboard shortcut can be configured by selecting in the main menu View->Command Palette or pressing Ctrl + Shift + P:
VSCode. The Julia team was working on a Julia IDE called Juno but the website now says "Juno will receive no more feature updates. Development focus has shifted to the Julia extension for VSCode", and VSCode seems to be the recommended way to develop in julia.
The Julia extension for VSCode let's you run code block by just pressing shift+enter and it uses Revise.jl to make interactive sessions better. You can see plots and other outputs right in the editor, and recenty they have even added performance monitoring/benchmarking tools.
However, if you prefer notebook-style workflows, you can use Jupyter with Julia (and the IJulia kernel) but even better imo is Pluto, which is specifically made for Julia and has some nice features such as no hidden state.
I'm using VS Code and i miss RStudio's ctrl+i to indent lines.
I've read stuff online about LSP and other extensions and formatting with shift+alt+F but all i get is linter.
So, whats the equivalent if is there at all?
Found a solution but there a few things to take note.
First, VSCode notive options are language-agnostic, meaning it can't indent R code 'cause it doesn't understand it. You got to download extensions to make i work.
Extensions required are
Yuki Ueda's R for language support
REditorSupport's R LSP Client
Also, in order to R LSP Client to work, CRAN package {languageserver} is required.
Then, usage. If you're working functions, differently from RStudio in which one can hit ctrl+i and that'd indent that specifically line or selection, this solution works only if one selects the entire function. If you have functions inside another, you gotta indent everything (won't work for just a foo inside another).
I am using the Vim-R-plugin to edit files containing markdown and R-code blocks such that the files can be complied using knitr. The filetype is: RMD. I have enabled spell checking. How can I disable the spell checking within the code blocks?
Spell checking is attached to certain syntax groups. Find the :syn region that covers the R code blocks, and append / edit in contains=#NoSpell.
Instead of trying to get the #NoSpell working by region, my approach is to toggle between languages.
I work in three languages which are set up to toggle with a function key where I include "nospell". This makes turning spellchecking on and off as easy as pressingt F7. When coding and writing nospell is turned on, when finalizing the edits I toggle to the appropriate language.
In fact, I find spellchecks in my code to be a plus. I make mistakes in the comment sections too, sometimes even in variable names/plot lables etc. This way you have a quick last check of all language items that are going to be visible .
I got this to work on OS X by editing the ~/.vim/syntax/R.vim and doing a search and replace of all instances of #Spell to #NoSpell. Then restarting vim. All the red underscores were gone from the code chunks but were still in the rest of the the rmarkdown.
Interestingly this has not effected the spell checking in pure R documents that have a .R extension, so I having thought I understood what I was doing perhaps I have to admit I don't fully. But at least it has turned off spell checking of the code chunks in rmarkdown (Rmd) documents while leaving it still working elsewhere in the document.
Is is possible to change the "Control + R" shortcut for sending scripts from the R text editor in the Windows GUI to the R console? I'd like to change it to "Control + Enter" to be more like the shortcut on my Mac. I do all my normal work on a Mac but have to use R on a PC to interface with some PC-only computational software.
Additional tidbits:
I'd rather not run an IDE on the PC if I don't have to, though perhaps this is the solution.
I use Rstudio on my Mac, but Rstudio does not get along with the PC software I'm running
The short answer is:
"No, there are no [built-in] ways to alter the menu shortcuts in the R Console"
I'm however gathering here -community wiki style- some of suggestions posted as remarks to this questions.
One approach may be to download the R source, hack it (see circa line 625 of src/gnuwin32/editor.c: ), and build the R binary anew (see the R for Windows FAQ for the tools you need to build from source). This seems to be a rather radical approach for the mere convenience of using an alternate keystroke sequence...
A similar approach may be to create an automatic patcher program which would patch the R executable, by locating the byte patterns surrounding the compiled logic of editor.c mentioned above and replacing it with a byte sequence for the desired keystroke. This solution may be sensitive to changes in the binaries, but also avoids the build process altogether...
An easier way to achieve this is probably by using an external text editor. Most modern editors have macros or configs that can be used, for example, to execute a source command in R for the selected text.
Customizing keyboard shortcuts is made available in Rstudio 0.99.644.
See https://support.rstudio.com/hc/en-us/articles/206382178-Customizing-Keyboard-Shortcuts for more information.
after using sciviews-K for a while, I am about to give the R Eclipse combo another chanced. I updated to Helios on my Mac OS X Snow Leopard. So far everything that used to make trouble with Eclipse works, but somehow I miss the auto-completion of code. Or at least the standard suggestion of paramaters when you use R functions. This is even possible in the standard R GUI.
How can I use some of these enhancements with StatET Eclipse?
Thx in advance for not telling me to use Emacs / ESS !
Looks like you can't have an answer shorter than 15 characters, so here is some elaborate text to pass this silly check. Try pressing Ctrl+Space.