Keyboard shortcut to jump to previous command in iTerm2? - macos

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.

Related

select one from multiple choice is not working in git CLI windows|| arrow key is not working in git cli [duplicate]

I am trying to setup semantic UI in my repository and for some reason I can't use the arrow keys to select menu options in Git Bash.
Press down or up only moves my cursor, it doesnt move the > icon that selects the correct menu option.
You can use Visual Studio Code terminal and it works.
delete the close angle bracket (>) symbol to unselect,
type > to select,
press enter
Git bash doesn't support an interactive terminal.
Use the regular windows terminal or powershell
Hey man its been a while, but I literally just ran into this issue.
the solution for me was to manually delete and type >
or
use gitbash in VSC integrated terminal mode
I chose to do the latter.
Solution for me:
In webstorm console everything is working correctly, after changing eslint.
Try using git bash inside vscode
TO AVOID THESE STEPS OPEN BASH IN VSCODE OR USE DIFFERENT TERMINAL. IF YOU DON'T WISH TO AVOID THE PROBLEM THESE ARE THE FOLLOWING STEPS TO GET IT TO WORK:
When in Git bash and prompted for an answer by arrow key selection. You have to first type '>' and look at what line it typed on(usually the first line).
The goal is to get that greater than symbol on the current line selected. In my case I had to press the down arrow to get it on the 'apps' selection line. If it is on the wrong line just backspace to remove it and arrow up/down and try again. Once on the current selection line to delete the current selection hold backspace and it will delete the '>' symbol you typed and some letters and invisibly should go all the way to the beginning of the line.
Then once you think you've held the backspace long enough, go to the line you wish to select by tapping down arrow key. Then type the greater than symbol on the line you wish to select and press enter.
As you can see my symbol is on the angular line. Then I press enter and it should select that line.
And so it does but not without a weird blank formatting block but I don't mind that.
The select option is working in Windows PowerShill.

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

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.

How to configure Visual studio code to use standard tab switching shortcut for mac?

Most OS X applications with tabbed interface allow using Cmd+Shift+[ and Cmd+Shift+] to switch tabs.
VSCode does not follow this. Is there a way to configure it to use these shortcuts to quickly switch to the next (towards right) and previous (towards left) tab.
This behavior is different from Ctrl+Tab behavior which shows a menu of most recent buffers. Repeatedly pressing Ctrl+Tab will keep alternating between same two recent buffers. But I would expect both Cmd+Shift+[ or Cmd+Shift+] to cycle through all the tabs, in right to left and left to right direction respectively.
You can bind every shortcut yourself if you want. Open you keybindings.json (via command palette or menu Code->Preferences->Keyboard Shortcuts).
Pressing cmd+k cmd+k gives you a little input field that prefills the correct JSON syntax.
The commands for switching tabs are called workbench.action.nextEditor and workbench.action.previousEditor

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