R.Studio: Lost my code changes while zooming out using "ctrl" + "-" in Rstudio source editor - r

I was using ctrl + - to make the code font smaller (or zooming out) in the R studio source editor and I got the pop up window (picture attached).
I think I pressed OK by mistake and I lost a huge chunk of code. How can I recover that?
Also. it makes me bit skeptical of using Rstudio. Pop out message

ctrl + z is the undo command (Windows)
For other shortcuts:
https://support.rstudio.com/hc/en-us/articles/200711853-Keyboard-Shortcuts
From a beginner standpoint, I find rstudio to be one of the most user friendly dedicated IDE's available for any programming language.

If you are on Windows, a JSON file with your code is available at
C:\Users[your user]\AppData\Local\RStudio-Desktop\sources
Follow instructions as:
https://stackoverflow.com/a/51433764/3142205
This is a terrible bug that RStudio has. I have never seen a code editor that every time you change the zoom level you lose your code! It is a terrible issue that makes me wonder if I should go back to Notepad++. I have never lost a file using Notepad++.
Updated: This issue has been solved in RStudio 1.2.1335 "Allow changing zoom level without reloading (#2125)".

In this case I immediately press ctrl + z. If this is not recovering your code try with history tab -> go to history tab:

Use ctrl with + on the right keyboard, don't use key.

may the shortcut of Zoom Source Editor with Ctrl+Shift+1 is a substitute plan.
It’s a pity that Rstudio doesn't provides a support to ctrl + +/-(mouse scroll)

Related

Issue with Rstudio version (Version 1.3.1073) "Giant goldenrod" when moving R studio window to new monitor doesn't display correctly

This is a basic question that I hope has a simple solution. When I move my Rstudio window to an external monitor display - it no longer rescales properly and instead is rendered completely useless - showing me only the lower portion of the window (see screenshot) and doesn't allow me to resize the window or adjust it in anyway to access the taskbar along the top. Has anyone else experienced this or have options for how this could be fixed?
I frequently need to shift my Rstudio window to different monitors, and I was doing this with no issue prior to installing the latest Rstudio version - so I am wondering if there must just be some setting that got reset when I updated the software, but I can't seem to figure it out. I have tried fixing scaling options in Windows by using the properties options on the Rstudio icon on my desktop - and then clicking on compatibility and High DPI settings, but messing around with that so far hasn't seemed to work. However I haven't tried all possible combinations as i thought I would check here first to see if someone could fast track this process for me. As you can see in the image - this display is impossible to work with. When I move it back - it works as it should. I am using Windows 10, and I update my software regularly. TY!
Update
Ok, I was able to reproduce on a Lenovo with an external Dell monitor and address the problem by applying a fix proposed in another Stack Overflow thread. See below:
Research:
https://support.microsoft.com/en-us/topic/windows-scaling-issues-for-high-dpi-devices-508483cd-7c59-0d08-12b0-960b99aa347d
Resolution:
There is a solution, it comes from the option "Compatibility" of the execute file.
Close all current RStudio windows.
Right-click on the shortcut of RStudio (or the original .exe file) and choose Properties
In the RStudio Properties pop-up windows, choose the tab Compatibility
Select High DPI settings
Tick on option Override hide DPI scaling... and then choose System from the drop-down list.
Apply > OK.
(Re)open Rstudio to see the change
On my test system, this addressed the problem observed where the menu text became super large.
Stackoverflow original reference:
RStudio HiDPI support
This appears to be an issue with the version of QT used by RStudio. RStudio is built on top of the QT engine.
QT tracking Issue:
https://bugreports.qt.io/browse/QTBUG-48242
the issue is marked as fixed in QT version 5.9.0 and above.
Recommendation:
Download RStudio preview and try that:
https://www.rstudio.com/products/rstudio/download/preview/
Why? The preview version of RStudio appears to use QtWebEngine/5.12.8, which implies the issue is addressed. If that does not resolve the issue you could file a bug with RStudio, or install and recompile RStudio from the source with an updated version of QT. You can check your QT version via the help, about box.
Hoping the above points you in the right direction. Stays safe and well.

RStudio keyboard shortcuts of Command+Enter and Option+Enter cannot work

My RStudio keyboard shortcuts of Command+Enter and Option+Enter cannot work, after upgrading RStudio Version 1.0.136 on my Mac BookPro notebook. Any one can help me? Many thanks.
Best,
Gary
You can try to rebind them to something different as a semi-solution. However, why the shortcuts don't work I couldn't tell you.
Go to Tools -> Modify keyboard shortcuts and in the search field type run. You will see the Run current line or selection and the bindings behind it. If they are empty then we have an immediate answer to your problem. If not, you can bind it to something different.

Ctrl+P and Ctrl+N for navigation in jupyter notebooks

I'm used to Emacs navigation, in particular Ctrl+P, N, F, and B, but I'm also used to Jupyter notebooks by now. The general question is: how to enable those shortcuts in a notebook?
What tickles me is the fact that on Mac those keybindings are already in place in a standard Anaconda IPython. But it's perfectly understandable since most system and browser shortcuts are bound to Cmd instead of Ctrl.
Since I spend a lot of time in Ubuntu, I wanted to reproduce the same behaviour here. It soon became apparent that most browsers hold some of the keybindings very dearly, such as Ctrl+P for print or Ctrl+N for New window. Turning these off is a huge matter in itself, so I decided to use another browser solely for the Jupyter Notebook, and Vivaldi seems like a nice choice since all shortcuts are easily customizable there.
I believed that with browser shortcuts being turned off, the IPython syntax would kick in, but none such thing has happened. Next I tried one of many manuals on the Jupyter notebook shortcuts customization (such as this one http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Custom%20Keyboard%20Shortcuts.html) to bind the 4 shortcuts I need. It works only up to some extent and only in the Jupyter inline magic:
%%javascript
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('ctrl-p', 'jupyter-notebook:move-cursor-up')
What it does is that occasionally now the cursor in command mode does indeed move up when I press ctrl-p, but this behaviour is unstable. Moreover, after it moves, it immediately enters the edit mode in the cell above, which isn't happening if I simply press 'Up' arrow. As for the same trick for the edit mode:
%%javascript
Jupyter.keyboard_manager.edit_shortcuts.add_shortcut('ctrl-p', 'jupyter-notebook:move-cursor-up')
alas, it doesn't work at all.
Forgive me for the prolonged intro. The questions I have now are:
What is wrong with the key bindings I use in inline mode? Is it a silly mistake I made or a Jupyter glitch?
When I try to use these byndings through my custom.js file, they do not work. However, the file itself is recognized, e.g. the alert() commands work perfectly fine.
I've stumbled a few times on a emacs-bindings for the CodeMirror, however, as far as I understood, they are mostly used for copy-paste related matters rather than navigation, is it true? Would it help to use this set of bindings instead of pursuing the path with custom.js?
Thank you.
UPD
Installing emacs.js from CodeMirror and adding this code actually solved my problem. Just had to make sure that all conflicting browser keybindings were turned off.
require(["codemirror/keymap/emacs", "notebook/js/cell", "base/js/namespace"],
function(emacs_keymap, cell, IPython) {
cell.Cell.options_default.cm_config.keyMap = 'emacs';
var cells = IPython.notebook.get_cells();
for(var c=0; c< cells.length ; c++){
cells[c].code_mirror.setOption('keyMap', 'emacs');
}
}
);

important hotkeys don't work anymore after RStudio update to 0.99.878

I recently updated RStudio for Windows via download link mainly due to interest in the new features of the most recent version 0.99.878. Unfortunaly after the installation some important hotkeys behave different in the source editor, while they still work in the Console. I.e.
Ctrl+S starts an "isearch"
Ctrl+V jumps to the end of the document
When I enter Ctrl+X+(S or V) the hotkeys work as they should. The hotkeys can be customized, however when I open the Keyboard Shortcuts dialog it shows me the settings for the hotkeys. Also the cursor has turned to a shiny green rectangle (insert isn't activated).
The problems remains after switching the project. Also reinstalling Rstudio 0.99.878 didn't work out. I've seen a similar issue here, but think mine is different as it is installation related. I might have accidentally activated a special editor setting but couldn't find any.
It sounds like you may have (accidentally?) activated Emacs keybindings. If you go to Tools -> Global Options..., you can reset the preference here:

Switching focus between editor and terminal in Kate

When working in Unix with various programming languages I often use Kate as my primary editor.
It has a really nice function of being able to open a built-in terminal window which is quite useful.
The problem is that switching back and forth to the terminal view using a mouse is quite a pain and I can't find any shortcuts for this. The only shortcut I could find is for closing the entire terminal (not just changing the focus). This is a bit annoying as it causes the text in the terminal window to get truncated (I think it's a known Kate bug).
Does anyone know a better shortcut?
Note that the Kate bug has been fixed. The correct answer to this question is now F4.
There's a "Focus Terminal" shortcut in the "Configure shortcuts"
There you can set it up. F4 didn't work by default in my case and Shift+Tab worked only in one direction.
this is a bug in kate. possible workarounds: a) shift back by pressing Shift+Tab, b) try another shortcut (some do work). see also Bug 157496: Alt+[Key] shortcuts for menu items do not work.
Today (Kate v 22.08.2), it's
Settings > Configure Keyboard Shortcuts > Type "terminal" in Search box >
edit shortcut for "Focus Terminal Panel".
For me, the default was Ctrl+Shift+ F4, while F4 hid the terminal.
I swapped them because it's more convenient for me.
The focus shift is only visible by appearance of the cursor changing slightly.

Resources