How can I change the keybindings to switch windows in Byobu? - byobu

I'm using Byobu 5.73. The tmux keybindings to switch windows is ALT + Left arrow and ALT + Right arrow. I want to change this keybinding for CTRL + SHIFT + Left arrow and CTRL + SHIFT + Right arrow.
How to do that ?

One way to do it is to edit /usr/share/byobu/keybindings/f-keys.tmux.
You will find these lines :
bind-key -n M-Left previous-window
bind-key -n M-Right next-window
M is for Meta, aka the ALT key. Change the lines for :
bind-key -n C-S-Left previous-window
bind-key -n C-S-Right next-window
C for Ctrl key and S for Shift key.
Save, quit, press F5 to reload profile.
Refs : Bybobu doc, Byobu-and-mc, keybindings-in-byobu-using-tmux-backend, tmux

Related

How can I put cursor on every line in Sublime Text?

I want to be able to edit every line of my data simultaneously, for instance put quotations in front of every line. I am wondering what the key combination is that will enable me to do this.
Four steps:
Select all the text: CTRL A
Activate multi-cursors: CTRL (or CMD on Mac) SHIFT L
Press the Home key to move all cursors to the front of the line
Press the " quote key to insert the quote.
Using the Home End and CTRL + left | right arrow keys is handy when managing multiple cursors.
On a mac, you can highlight the lines you wish to edit and use CMDShiftL, or ctrlShiftL on Windows.
On Mac
cmd+A (Select all)
cmd+shift+L (Split selection into lines)
shift+2 (Surround selection with quotes)
esc (Escape)
On Windows
CTRL+A (Select all Data)
CTRL+Shift+L (Cursor will appear on each line)
Shift+ (right or left key) (move the cursor left or right)
Press ESC to remove the focus.
In case if you want to put cursor at every string as currently selected, use Find All shortcut:
Windows/Linux: Alt+F3
Mac: ⌃+⌘+G
All Multiple Selection shortcuts

Shortcut key for Emmet "wrap with abbreviation" in Sublime 2 on OSX?

I installed Emmet on Sublime2 on OSX. I want to use the "Wrap with Abbreviation" feature. There's a lot of conflicting information about what the shortcut should be, and I've tried every option, but nothing seems to work.
ctrl + w
cmd + w
cmd + shift+ w
shift + cmd + a
shift + ctrl + g
Nothing works. The closest I get is with shift + cmd + a, which wraps a bunch of things with <p> tags in various lines throughout the document. That's cool but it's not what I'm going for. Is there an up to date reference of keybindings for Emmet on Sublime2?
ctrl + shift + w on OSX is what you're after I believe
use this shortcut on windows 10
alt+shift+w = abbreviation
example:
Eu sou lindo >> select this phrase then click in alt+shif+w
result
<p>Eu sou lindo</p>

Sublime Text 2 multiple line edit

I want to edit multiple lines and every "word" within that line. For example:
45 28 42 65
24 87 47 95
01 25 87 98
I want to select every whole number in all lines and put a "0x" before it so it would look like:
0x45 0x28 0x42 0x65
0x24 0x87 0x47 0x95
0x01 0x25 0x87 0x98
I know the Ctrl+shift+L to get cursors on each line, but how can I get the cursors in front of every number to mass edit all at once?
Highlight the lines and use:
Windows: Ctrl+Shift+L
Mac: Cmd ⌘+Shift+L
You can then move the cursor to your heart's content and edit all lines at once.
It's also called "Split into Lines" in the "Selection" menu.
Use multiple cursors and column selection.
In your case you just need to place the cursors at the beginning of each column containing the "words".
Linux and Windows
Click & drag to select column(s): Shift + RightMouseBtn
Add other column(s) to selection by click & drag: Ctrl + Shift + RightMouseBtn
Subtract column(s) from the selection: Alt + Shift + RightMouseBtn
Add individual cursors: Ctrl + LeftMouseBtn
Remove individual cursors: Alt + LeftMouseBtn
Mac
Click & drag to select column(s): Option⌥ + LeftMouseBtn
Add other column(s) to selection by click & drag: Option⌥ + LeftMouseBtn
Subtract column(s) from the selection: Cmd⌘ + Option⌥ + shift + LeftMouseBtn
Add individual cursors: Cmd⌘ + LeftMouseBtn
Remove individual cursors: Cmd⌘ + Option⌥ + shift + LeftMouseBtn
Then edit as needed. In your case, type 0, x.
You could also navigate as needed to the end or beginning of the words, select the words and surround with quotes or parenthesis, and so on.
References:
Column selection
Worked for me on OS X + Sublime build 3083:
OPTION (ALT) + select lines
I'm not sure it's possible "out of the box". And, unfortunately, I don't know an appropriate plugin either.
To solve the problem you suggested you could use regular expressions.
Cmd + F (Find)
Regexp: [^ ]+ (or \d+, or whatever you prefer)
Option + F (Find All)
Edit it
Hotkeys may vary depending on you OS and personal preferences (mine are for OS X).
I was facing the same problem on Linux,
what I did was to select all the content (ctrl-A) and then press ctrl+shift+L,
It gives you a cursor on each line and then you can add similar content to each column.
Also you can perform other operations like cut, copy and paste column wise.
PS :- If you want to select a rectangular set of data from text, you can also press shift and hold Right Mouse button and then select data in a rectangular fashion. Then press CTRL+SHIFT+L to get the cursor on each line.
Windows:
I prefer Alt+F3 to search a string and change all instances of search string at once.
http://www.sublimetext.com/docs/selection
On Windows, I prefer Ctrl + Alt + Down.
It selects the lines one by one and automatically starts the multi-line editor mode. It is a bit faster this way. If you have a lot of lines to edit then selecting the text and Ctrl + Shift + L is a better choice.
ctrl + shift + right-click
it works better that way
If you are looking to select the same word / value in multiple lines to then edit it, you can simply press "COMMAND + D" on the first entry and then keep pressing "D" to select the lines below
It's fine to manually select each number for a small set of numbers like in your example, but for larger collections you can do a regex search which will do the work for you.
Ctrl + F will open the search bar.
Regex searches are enabled by clicking the ".*" button on the far left.
Type in "\d+" to search for all occurrences of 1 or more digits. Clicking the "Find All" button will select each of these numbers separately.
Then you can use Ctrl + Shift + L to convert the selection into multiple cursors. From here you can do as you like.

Fold / Collapse the except code section in sublime text 2

Is there any plugin or shortcut to hide all except code section in sublime text 2?
I need to fold all except section at a time , Not fold one section at a time.
Thanks~
If you'll hover with the mouse over the line numbers you'll see arrows - clicking on any of them will fold/collapse the code
If you want to collapse/expand all - you can do so by going to edit->code folding and choose "fold all" or "unfold all":
In addition to the other answers it is also possible to fold based on level as well. So for example looking at the default key bindings for fold.
Searching for fold key bindings.
So for example a foldall, or folding level 1 would be to hold Ctrl followed by pressing the sequence k and then 1:
Or folding level 2 would be to hold Ctrl followed by pressing the sequence k and then 2:
Or unfolding all would be would be to hold Ctrl followed by pressing the sequence k and then 0 or in my defaults I also seem to have it bound to the letter j:
Warning.
Pressing Ctrl+k twice will remove a line or a count of lines.
But not really cause you can put them back one by one by Ctrl+u
One thing you can do is select the Except code bloc using a regular expression, for instance using except(.|\n)*?raise.* in your case. You can then select "Find all" in the search bar, then Edit->Code Folding -> Fold .
Windows shortcut : Ctrl-Shift-[
Mac shortcut: Cmd-Alt-[
All the Except bloc will then be collapsed.
I know this is an old question, but it still comes up high in search results and none of the answers quite do what the OP wanted.
select the code you don't want to be hidden
use "Selection" -> "Invert Selection" to select the code you do want to be hidden instead
use ctrl + shift + [ or Command + Option + ] to collapse the selection(s)
This will leave you with just the code you originally had selected visible.
Fold and UnFold function or class base only for MAC:
* Fold: command + K, command + 1
* UnFold: command + K, command + J

Multiple Cursors in Sublime Text 2 Windows

I have installed Sublime Text 2 in windows and I am trying to use the multiple cursors feature.
Firstly I highlight the selection I am looking for (three lines).
Then I can press CTRL + D to select each re-occurrence, or ALT + F3 to select all. There are four repeats in my situation.
I now want to move the cursors in the middle of the three lines and add some information, to be added to all occurrences.
As soon as I click in the selection, the multiple selection is gone? Is there something I am doing wrong, I am sure it is wrong but as the documentation is so weak I cannot find out how?
It's usually just easier to skip the mouse altogether--or it would be if Sublime didn't mess up multiselect when word wrapping. Here's the official documentation on using the keyboard and mouse for multiple selection. Since it's a bit spread out, I'll summarize it:
Where shortcuts are different in Sublime Text 3, I've made a note. For v3, I always test using the latest dev build; if you're using the beta build, your experience may be different.
If you lose your selection when switching tabs or windows (particularly on Linux), try using Ctrl + U to restore it.
Mouse
Windows/Linux
Building blocks:
Positive/negative:
Add to selection: Ctrl
Subtract from selection: Alt In early builds of v3, this didn't work for linear selection.
Selection type:
Linear selection: Left Click
Block selection: Middle Click or Shift + Right Click On Linux, middle click pastes instead by default.
Combine as you see fit. For example:
Add to selection: Ctrl + Left Click (and optionally drag)
Subtract from selection: Alt + Left Click This didn't work in early builds of v3.
Add block selection: Ctrl + Shift + Right Click (and drag)
Subtract block selection: Alt + Shift + Right Click (and drag)
Mac OS X
Building blocks:
Positive/negative:
Add to selection: ⌘
Subtract from selection: ⇧⌘ (only works with block selection in v3; presumably bug)
Selection type:
Linear selection: Left Click
Block selection: Middle Click or ⌥ + Left Click
Combine as you see fit. For example:
Add to selection: ⌘ + Left Click (and optionally drag)
Subtract from selection: ⇧⌘ + Left Click (and drag--this combination doesn't work in Sublime Text 3, but supposedly it works in 2)
Add block selection: ⌥⌘ + Left Click (and drag)
Subtract block selection: ⌥⇧⌘ + Left Click (and drag)
Keyboard
Windows
Return to single selection mode: Esc
Extend selection upward/downward at all carets: Ctrl + Alt + Up/Down
Extend selection leftward/rightward at all carets: Shift + Left/Right
Move all carets up/down/left/right, and clear selection: Up/Down/Left/Right
Undo the last selection motion: Ctrl + U
Add next occurrence of selected text to selection: Ctrl + D
Add all occurrences of the selected text to the selection: Alt + F3
Rotate between occurrences of selected text (single selection): Ctrl + F3 (reverse: Ctrl + Shift + F3)
Turn a single linear selection into a block selection, with a caret at the end of the selected text in each line: Ctrl + Shift + L
Linux
Return to single selection mode: Esc
Extend selection upward/downward at all carets: Alt + Up/Down Note that you may be able to hold Ctrl as well to get the same shortcuts as Windows, but Linux tends to use Ctrl + Alt combinations for global shortcuts.
Extend selection leftward/rightward at all carets: Shift + Left/Right
Move all carets up/down/left/right, and clear selection: Up/Down/Left/Right
Undo the last selection motion: Ctrl + U
Add next occurrence of selected text to selection: Ctrl + D
Add all occurrences of the selected text to the selection: Alt + F3
Rotate between occurrences of selected text (single selection): Ctrl + F3 (reverse: Ctrl + Shift + F3)
Turn a single linear selection into a block selection, with a caret at the end of the selected text in each line: Ctrl + Shift + L
Mac OS X
Return to single selection mode: ⎋ (that's the Mac symbol for Escape)
Extend selection upward/downward at all carets: ⌃⇧⇡, ⌃⇧⇣ (See note)
Extend selection leftward/rightward at all carets: ⇧⇠/⇧⇢
Move all carets up/down/left/right and clear selection: ⇠, ⇡, ⇣, ⇢
Undo the last selection motion: ⌘U
Add next occurrence of selected text to selection: ⌘D
Add all occurrences of the selected text to the selection: ⌃⌘G
Rotate between occurrences of selected text (single selection): ⌥⌘G (reverse: ⌥⇧⌘G)
Turn a single linear selection into a block selection, with a caret at the end of the selected text in each line: ⇧⌘L
Notes for Mac users
On Yosemite and El Capitan, ⌃⇧⇡ and ⌃⇧⇣ are system keyboard shortcuts by default. If you want them to work in Sublime Text, you will need to change them:
Open System Preferences.
Select the Shortcuts tab.
Select Mission Control in the left listbox.
Change the keyboard shortcuts for Mission Control and Application windows (or disable them). I use ⌃⌥⇡ and ⌃⌥⇣. They defaults are ⌃⇡ and ⌃⇣; adding ⌃ to those shortcuts triggers the same actions, but slows the animations.
In case you're not familiar with Mac's keyboard symbols:
⎋ is the escape key
⌃ is the control key
⌥ is the option key
⇧ is the shift key
⌘ is the command key
⇡ et al are the arrow keys, as depicted
In Sublime Text, after you select multiple regions of text, a click is considered a way to exit the multi-select mode. Move the cursor with the keyboard keys (arrows, Ctrl+arrows, etc.) instead, and you'll be fine
Try using Ctrl-click on the multiple places you want the cursors. Ctrl-D is for multiple incremental finds.
I find using vintage mode works really well with sublime multiselect.
My most used keys would be "w" for jumping a word, "^" and "$" to move to first/last character of the line. Combinations like "2dw" (delete the next two words after the cursor) make using multiselect really powerful.
This sounds obvious but has really sped up my workflow, especially when editing HTML.
Mac Users, let me save you the time:
Cmd+a: select the lines you want a cursor
Cmd+Shift+l: to create the cursor