Shortcut for moving tabs in Mac Terminal application? - macos

I am looking for a shortcut to move the current tab left and right through the tab list. Note that I don't want to switch to the left or right tab with the Cmd+{, Cmd+} shortcuts, but to move the tab.

try iterm2, http://iterm2.com/#/section/home
command + left or right arrow to switch tabs
command + shift + left or right to move tabs

According to Terminal -> Preference -> General,
Command + Ordinal can be used to switch tabs, (Ordinal between 1 to 9)
e.g.: Command + 1: switch to the first tab (left-most tab).

you can add a shortcut to have command+left/right arrow go to previous/next tab:

No, it is not possible to move tabs using keyboard on Terminal app.
I would need to drag them by cursor or try iTerm2 instead.

I don't think you can, and it doesn't appear on any shortcut list i have seen for any browser or application :/
however there seems to be a plugin of sorts for Chrome which does this:
plugin link that might work.

Related

How to set keybinding to move (rearrange) tabs in Atom?

I'm trying to setup keybinding for physically moving my current tab, either right or left of other tabs (rather than click and drag to rearrange them).
I know user defined keybindings are added to ~/.atom/keymap.cson, I'm just having trouble determining the command as I don't see it present in the default keybindings.
I found that Atom has a native keybinding set for this under as:
ctrl + shift + ←: pane:move-item-left
ctrl + shift + →: pane:move-item-left
The native bindings weren't showing up in Settings > Keybindings. Here they are:
'atom-workspace atom-text-editor:not([mini])':
'ctrl-alt-]': 'window:move-active-item-to-pane-on-right'
'ctrl-alt-[': 'window:move-active-item-to-pane-on-left'
You can take a look at Tab Move Key package. It is simple, you can use alt page up and alt + page down for moving tabs around.
command + [ = to move the block left by 1 tab
command + ] = to move the block right by 1 tab

How to indent my code in codeblocks?

What are the best code blocks short cuts ? Also is there some way we can directly indent all our code ? In addition how can we move through the active tabs in codeblocks ?
Tips about tab identation are helpful when you write your code from begining. But if you paste code in CodeBlocks from some external source, like PDF document, that code often will not have good identation.
In this case, you need to select code, right click on it, and choose Format use AStyle option.
This is a plugin for CodeBlocks for right text formatting.
I hope this will help someone!
You (these are the default settings I believe) can select a block of code and press the Tab key. This will indent the entire block.
So for indenting a whole file: Ctrl + A, then Tab.
In addition, you can use Shift + Tab on a selected block to "unindent"
You can move through the open tabs with Ctrl + Shift + Tab.
As for the best shortcuts:
I like Ctrl + D to duplicate a line and
Ctrl + L to copy it.
Anyway, you can set whatever shortkeys you like in the Editor menu (there you will also be able to find all shortkey currently set).
]2
Add shortcut as you wish from Settings->Editor->Keyboard shortcuts->plugins->Source code formatters(Astyle) or use Plugins->Source code formatters(Astyle)
CTRL+A to select the code and TAB for alignment.
I have not had much luck with the code formatter in C::B. I like my code to look like this...
if (blah..) {
SomeCode();
} else {
DifferentCode();
}
it allows more code to fit on a screen, and is still reasonably readable.
After trying to tweak the settings in Settings->Editor, then Source Formatter tab, when I went to format my code, it removed the if line entirely, and I have not been able to unset my tweaks to make it work.
Fornatually, ctrl-z still works.
The code formatter should never remove code, only play with white space.
Maybe there is a better plugin.
Mark.
In addition in How to switch between tabs in codeblocks.
codebocks 20.03
Linux (KDE Neon)
To switch between tabs.
Activate this with CTRL+SHIFT+TAB, then you can use the know options:
CTRL+TAB , to switch to the right tab.
CTRL+SHIFT+TAB , to switch to the left tab.
Or this other option, but this is not in the keyboard shortcuts, this option doesn't work in a cycle mode, when your get the last right tab, it jump to the bottom tabs:
CTRL+ right-arrow-key , to switch to the right tab.
CTRL+ left-arrow-key , to switch to the left tab.
Remember to activate with CTRL+SHIFT+TAB.
After you land in the desire tab you can type TAB to begin to start writing code.

iTerm2 keyboard shortcut - split pane navigation

I have been a long time user of the standard Mac Terminal. Decided to experiment with iTerm2 after hearing good things about it from my colleagues.
One of the more useful features I am seeing on iTerm2 is its split panes (much like vim split buffers).
In vim, I can move between split buffers using Ctrl+W+arrowkeys. Is there a keyboard shortcut for iTerm2 to move between panes as well?
From the documentation:
Cmd] and Cmd[ navigates among split panes in order of use.
Cmd+opt+←/↑/→/↓ navigate similarly to vim's C-w hjkl.
⌘+⌥+←/↑/→/↓ will let you navigate split panes in the direction of the arrow, i.e. when using ⌘+D to split panes vertically, ⌘+⌥+← and ⌘+⌥+→ will let you switch between the panes.
there is configuration in the following way:
Preferences -> keys -> Navigation shortcuts
the 3rd option: shortcut to choose a split pane is "no shortcut" by default, we can choose one
cheers
I was using Terminator before, so I found it convenient to re-map Alt + arrow-key to switch between the panes. This can be done in Preferences -> Keys -> Key Mappings - press the '+' button to add a mapping. Also, in my case such a mapping was already defined in Profiles, I simply removed it.
Spanish ISO:
⌘+⌥+[ goes left top
⌘+⌥+] goes bottom right

Textmate-like Keyboard Navigation for the Command Line?

How do I better navigate the command line? In TextMate, I can do:
CMD + ALT + ARROW to switch tabs
CMD + SHIFT + ARROW to highlight lines of text
ALT + SHIFT + ARROW to highlight words
ALT + ARROW to jump words, etc.
How do I do this kind of stuff in the terminal?
Here's a slightly more complete mapping from Mac text navigation to the default Readline keys:
I set this up in the Keys pane of my iTerm2 preferences, but you should be able to make the same mappings in Terminal.app (Edit: Everything except the first two. Terminal.app only lets you pick from a few different keys)
In MacOS' Terminal app, you can change your keyboard bindings; go to Terminal Preferences (shortcut Cmd + ,) and navigate to the 'Keyboard' tab:
Key => Action
control cursor left => \033b
control cursor right => \033f
etc. You can do the same thing with other emacs-style bindings. As far as switching tabs, that's a System Preferences > Keyboard > Keyboard Shortcuts setting; click 'Application Shortcuts' on the left side, and then click + on the right to add a new shortcut. Use your desired keyboard combo and pair it with the exact menu name, which in Terminal for moving forward/backward through tabs is 'Select Next Tab' and 'Select Previous Tab' (via the Window menu in Terminal), respectively.
Does that help?
This is a pointer for anyone landing here looking for the equivalent tips for iTerm (as opposed to the default terminal).
To do the same in iTerm, go to menu "Bookmarks", "Manage Profiles", "Keyboard profiles", "Global".
Then add all of the shortcuts you see in the other answers here, but instead of sending text "\033..." when creating a mapping, you simply select the action "send character sequence" and the character for the escape sequence!.
"\033b" becomes b
"\033f" becomes f
and so on.
Escape sequence example
Some things can be done by editing the readline bindings (see bind -p / man bash) but for some of the mac keyboard keys you can (or need to?) set extras up in Terminal.app's preferences.
For word navigation try this:
Terminal preferences -> settings -> keyboard
add the following:
option cursor left \033b (escape b) (backwards word)
option cursor right \033f (escape f) (forward word)
option forward delete \033d (escape d) (kill word)
Word boundaries behave a little differently, but it's better than single character or whole line navigation, and doesn't require trading your option key for a meta key and learning a bunch of new key combos.

Xcode History (back/forward) Keyboard Shortcut?

Back Arrow Broken In Xcode?
Is there keyboard command to go back/forward one file at a time.
Xcode 3.2 changed the behavior of Cmd-Opt <-- and -->. As noted in another question, they do not operate on a file level like in previous versions of Xcode, but on an "edit point", making it cumbersome to flip through a list of files (the quick way to do it, since Xcode does not support Tabs, as in Eclipse).
Rob Keniger found a partial solution that he noted in another post:
"Hold down the option key while you click the forward/backward arrows ..."
But this requires fiddling with the mouse. Is there any way to do it with the keyboard only?
EDIT:
Later versions of Xcode (v7.2+) now have a Navigate menu (and it changes the keyboard shortcuts yet again):
In XCode 4.4 the following sequence works:
Cmd + Ctrl + ←
and it operates on a file level.
On Xcode 8 I use 2 fingers left / right
Beginning in XCode 3.2.3, the following key sequence works:
Cmd + Option + Shift + ←
Without the Shift key, it just goes back to the previous cursor position. Adding Shift jumps to the previous file (next file, in combination with →).
Navigation shortcuts for Xcode

Resources