how to use arrow keys to edit command in gdb command window? - debugging

While using gdb in 'layout src' window mode (command at the bottom and source at the top), often I want to go back some characters to modify the current command I'm editing in the gdb command window. But pressing left or right key just moves the source window. How can do it?

You need to change the input focus, see here for details:
https://sourceware.org/gdb/current/onlinedocs/gdb/TUI-Commands.html#index-focus
Specifically, you want focus cmd. After this you should be able to use the arrow keys to scroll through the GDB history.

Related

Is there R code for moving the focus to the RStudio console?

I am constantly typing into the edit window of RStudio after my code completes execution, when my intention is to provide some input in the console window. Is there R code that could be executed that would automatically move the focus to the console window of RStudio?
In RStudio, go to the menu: Tools > Global Settings. In Global Settings, choose "Code" on the left and check the box that says "Focus console after executing from source."
If you don't want to change this global option, these keyboard shortcuts can make switching between the console and editor in RStudio much faster:
Ctrl+1 moves focus to the source editor
Ctrl+2 moves focus to the console
In addition, Alt+Shift+k brings up a list of most keyboard shortcuts
If you not look for a shortcut but for code, RStudio has the following command
rstudioapi::executeCommand('activateConsole')
See also RStudio IDE Commands

Keyboard shortcut to jump to previous command in iTerm2?

In Terminal, I can simply to cmd+up arrow. How can I do this in iTerm2? I've tried the cmd+shift+up arrow option, but it doesn't work reliably, especially when there is a currently running process.
You can do this with Shell Integration! By default, iTerm2 is not fully integrated with the shell (e.g. Bash) itself. It doesn't really know which lines are prompt and which are output, so it wouldn't know what line to jump you back to as the previous prompt. If you install shell integration, it'll automatically add a mark at each prompt line and you'll be able to cycle up and down with Command-Shift-Up Arrow and Command-Shift-Down Arrow respectively. On my machine this worked even while a process was running.
In Preferences > Keys you can change the default keybindings back to what you're used to. Double click on Command-Up Arrow, change the Action to Select Menu Item..., and set the menu item to Edit > Marks and Annotations > Previous Mark/Annotation. Repeat with Next Mark/Annotation for Command-Down Arrow.
EDITED 2020-03-30: It appears Mark and Annotation were separated into different menu items in a recent update. You should now use Next Mark instead.

How to increase RStudio editor size?

In Eclipse, I am able to do Ctrl+M while I am typing in the editor to full-screen the editor and temporarily hide all the side-windows. Is there a way to achieve this in RStudio? The code editor portion of the window is very small and yet I don't feel like manually fiddling with the mouse to resize my console/plots/workspace windows.
The view menu doesn't offer much else than zooming in/out.
All shortcuts Alt+Shift+K
You can make the editor fill up the entire rstudio window with Ctrl+Shift+1. Also to restore.
To move between the panes, the shortcut is CTRL + number.
1 - source
2 - console
Adding shift to the shortcut makes that pane fill up the spaces.
The best solution I've found is to use a "source window", i.e. pop out the editor into a separate window temporarily:
This window can then be expanded to fill the whole screen:
Only way I know how is to click on the right hand side of the title bar of the source code section where it has 2 windows symbols. The right-most one expands the code window to the entire left hand side.
Instructions and documentation below from the R studio manual:
http://www.rstudio.com/ide/docs/using/console
If you're running on Linux, you can install RStudio Server, just for use on the same computer. It's almost exactly like the regular RStudio, but inside a browser. I prefer it because I can full screen, and can use the browser's Find in the console.

Copy to clipboard from IPython using Windows 7

I am running IPython on Windows 7 and can use the %paste magic command to paste from the clipboard. However, I cannot copy from IPython to the clipboard. I want to copy code snippets from IPython and paste them back to a text editor.
Anyone know a fix for this?
Found this gist to add a %copy magic command, my fork adds supports osx/linux/windows platforms.
I have yet to test it on windows, so please tell me if you encounter any issues.
As mentioned by #AdrianRatnapala, you can right-click in the terminal window and select Mark, mark the code snippets you want to copy, and then right-click (the marked content is copied to the clipboard when you right-click).
A more "permanent way" to use this feature is to right-click on the title bar of the terminal window and choose Properties. Under the Options tab, tick the box next to QuickEdit Mode and save this setting.
A third option is to use IPython's Qt Console. You can use this by entering ipython qtconsole in the command prompt.
A real permanent mode is to do what sodd has told, but a little bit different:
Right click in the top of the shell window, but use default instead properties option, also select options and Quick edit mode. Now this setting will survive in the next shell activations.
So it's very easy to copy and paste
Drag and drop to draw a rectangle inside shell screen and press Enter. The content is is in Clipboard. After, if you can paste this in the shell it's just press Right key or outside, use the usual Ctrl+V.
The cool thing is that you can now omit the number of commands in the copy.

How to mouse scroll with Git Bash?

Using Git Bash or MinGW Shell, if I put in a command with much output,
for example env, I cannot mouse scroll. A regular old Command Prompt (cmd.exe) window will do this however.
Enable Quick Edit mode
Open Properties: AltSpace, then P (for properties)
Under Options tab > Edit Options > Check Quick Edit > Hit OK
Now you will be able to scroll with mouse.
In the latest version of the git bash you don't have any property such as Quick Edit but then too your scroll might not work as it was my case..
press alt + space then click options and go to window then
Simply change your scrollbar location from right to left or vice versa then it will work, at least worked for me.

Resources