Is there a keyboard shortcut to select a column for editing in Atom editor? - keyboard-shortcuts

Scenario
When editing a file in Atom Editor how do I select multiple lines where the same edit needs to be performed?
For example:
this.name = name;
this.age = age;
this.sound = sound;
needs to be transformed into:
that.name = name;
that.age = age;
that.sound = sound;
Imagine there are many of these lines, but we do not want to use a find-and-replace because it will change more than we need.
Question - Is there a Keyboard Shortcut for Column Selection?
Is there a sequence of keyboard shortcuts (preferably Mac) which we can use to:
a) select the initial word
b) select the "column" (that word on several lines)
then apply the change to several lines at once (in bulk)
I know how to do this in SublimeText:
http://sublime-text-unofficial-documentation.readthedocs.org/en/latest/editing/editing.html#column-selection but have tried many different key combinations without any luck in Atom and googling has proved fruitless...

There are several ways to achieve this:
Keyboard
You can enable column selection mode using Ctrl+Shift+↑/↓. This will allow you to extend the cursor to multiple rows. Once you have selected all rows, release the keys, and use the Delete key to remove the text you want to replace. Once you're done, press the Esc key to release the cursors.
Note: You will have to disable the Mission Control (key bindings) in OS X to use this key combo.
How to Disable Mission Control (conflicting) Key Bindings (Mac)
To do this open System Preferences > Mission Control
Locate the key bindings for Mission Control and Applications windows:
Disable the key bindings for these two:
More details here.
Mouse
If you install the Sublime Style Column Selection package, you can use Alt+Mouse to select the columns in question.
More details here.

Here is a plugin for Atom, just hold alt and be happy.
sublime-style-column-selection

With the cursor somewhere on the first "this", do Ctrl+D (OS X: command+D) three times. Then type "that".
Another option is to select the rows you want to edit. Then select "Split into Lines" from the "selection" menu. Then hit the home-key and start editing away in multi-cursor mode.

For me on Atom 1.7.4 it worked by adding below lines to my /Users/username/.atom/keymap.cson. Ofcourse I am using alt-shift-down as shortcuts.
'atom-workspace atom-text-editor:not([mini])':
'alt-shift-down': 'editor:add-selection-below'
Update: I could not configure both alt+shift+down and alt+shift+up at the same time. For now I am okay with alt+shift+down

On Windows 10, follow the following steps:
Press ctrl + alt together and use up/down arrow keys to expand the height of your now vertical cursor
Now use shift to select the columns to be deleted
press delete key to remove selected columns
click anywhere on document (without pressing ctrl/alt keys) to bring cursor back to normal 1 column height

I came by this thread, and the feature I was personally looking for was the multi-cursor extension.

I've tried all of the following potential solutions:
sublime-style-column-selection
multi-cursor
multi-cursor-plus
Adding the following text to /Users/$(whoami)/.atom/leymap.cson
'atom-workspace atom-text-editor:not([mini])':
'alt-down': 'editor:add-selection-below'
'alt-up': 'editor:add-selection-above'
The last solution is the one that worked best without interfering with any of my other normal workflows.

Related

IntelliJ IDEA shortcut to switch 2 words

Is there a shortut (or a way to define one) in IntelliJ to switch 2 words?
Eg.
final static
Shortcut to switch to static final?
Under the "Edit" menu look for the "String Manipulation" flyout and there should be an entry called "Swap Characters/Selections/Lines/Tokens".
Selecting both words and then using this command will present you with a dialog. Typing space into the dialog and hitting return will swap two words.
Ctrl+Shift+A will get you a shortcut to this command if you type "swap" after its dialog comes up.
If the same pattern of words occurs multiple times it would be more effective to perform a replace with Ctrl+R.
I found it under "Code" menu : CTRL + ALT + SHIFT + ← or →
If your only issue is final static (and other) modifiers order, you can enable Missorted Modifiers inspection: Preferences | Editor | Inspections.
After that all missorted modifiers will be automatically highlighted, and you'll be able to fix it simply by either hitting Alt + Enter or doing Cleanup Code (also available to do via hotkey).

webmatrix list of keyboard shortcuts

List of keyboard shortcuts supported by Microsoft webmatrix.
Official list from Microsoft here:
http://www.microsoft.com/web/post/webmatrix-keyboard-shortcut-guide
Also, you can use the Alt key to display top level key tips. The top level key tips are show below:
Then, press Alt plus a top level key (such as H for Home as shown above) to show all of the keys that can be used on that tab. Use the displayed key value to access the related functionality.
For instance, Alt + H then T will allow you to print.
Just for those who happen upon this post, please check out the up to date list here:
http://www.microsoft.com/web/post/webmatrix-keyboard-shortcut-guide
Here are some additional ones that work inside the editor. Mind these are in an internal format that maps hotkeys to command codes. Its fairly readable though.
If you save this file in the WebMatrix config folder (typically c:\program files (x86)\Microsoft WebMatrix\Config), the editor will pick up modifications you make to this file. * Use at your own risk *
None;Right;RIGHT
None;Left;LEFT
None;Up;UP
None;Down;DOWN
None;PageUp;PAGEUP
None;Next;PAGEDN
None;Home;HOME
None;End;END
None;Escape;CANCEL
None;Delete;DELETE
None;Back;BACKSPACE
None;Insert;INSERT
None;Return;RETURN
None;Tab;TAB
Shift;Back;BACKSPACE
Shift;Right;RIGHT_EXT
Shift;Left;LEFT_EXT
Shift;Up;UP_EXT
Shift;Down;DOWN_EXT
Shift;Home;HOME_EXT
Shift;End;END_EXT
Shift;PageUp;PAGEUP_EXT
Shift;Next;PAGEDN_EXT
Shift;Tab;BACKTAB
Shift;Return;RETURN
Alt, Shift;Right;RIGHT_EXT
Alt, Shift;Left;LEFT_EXT
Alt, Shift;Up;UP_EXT
Alt, Shift;Down;DOWN_EXT
Alt, Shift;Home;HOME_EXT
Alt, Shift;End;END_EXT
Control, Shift;Right;CTLMOVERIGHT
Control, Shift;Left;CTLMOVELEFT
Control, Shift;Home;TOPLINE_EXT
Control, Shift;End;BOTTOMLINE_EXT
Control, Shift;L;DELETELINE
Control, Shift;Oem6;GOTOBRACE_EXT
Control, Shift;Space;PARAMINFO
Control, Shift;P;SELUPCASE
Control, Shift;W;SELLOWCASE
Control;Space;COMPLETEWORD
Control;J;SHOWMEMBERLIST
Control;Back;DELETEWORDLEFT
Control;Delete;DELETEWORDRIGHT
Control;A;SELECTALL
Control;Right;WORDNEXT
Control;Left;WORDPREV
Control;Home;TOPLINE
Control;End;BOTTOMLINE
Control;Up;SCROLLUP
Control;Down;SCROLLDN
Control;C;COPY
Control;X;CUT
Control;V;PASTE
Control;Z;UNDO
Control;Y;REDO
Control;OemPlus;ZOOMIN
Control;Add;ZOOMIN
Control;OemMinus;ZOOMOUT
Control;Subtract;ZOOMOUT
Control;D0;ZOOM1X
Control;NumPad0;ZOOM1X
Control;Oem6;GOTOBRACE
Control;L;CUTLINE
Control;T;TRANSPOSECHAR
Control,Control;K,D;FORMATDOCUMENT
Control,Control;K,F;FORMATSELECTION
Control,Control;K,I;QUICKINFO
Control,Control;K,C;COMMENT_BLOCK
Control,Control;K,U;UNCOMMENT_BLOCK
Control,Control;M,M;OUTLN_TOGGLE_ALL
Control,Control;M,U;OUTLN_TOGGLE_CURRENT
Control,Control;M,O;OUTLN_COLLAPSE_TO_DEF
Control,Control;M,P;OUTLN_STOP_HIDING_ALL
Control,Control;M,S;OUTLN_START_AUTOHIDING
CTRL-C
CTRL-V
CTRL-O
CTRL-S
CTRL-A
CTRL-W
CTRL-T moves a letter one step to the left?
CTRL-Z
CTRL-U
CTRL-I search in file (direction down)
CTRL-F find
CTRL-G go to line
CTRL-H replace
CTRL-X
CTRL-N new file
To view the current file in the browser instead of the site root.
CTRL+F12
As the Webmatrix 2 'Run' button opens the root index html file.

Simulate TAB keypress event in Selenium RC

I need to simulate a tab keypress in Selenium RC, using the Java API.
I do this after having entered some text using:
selenium.type(input, "mytext");
I've tried 3 alternatives to get the tab working:
selenium.keyPress(input, "\\9");
and:
selenium.focus(input);
selenium.keyPressNative("09");
and even:
selenium.getEval("var evt = window.document.createEvent('KeyboardEvent');evt.initKeyEvent ('keypress', true, true, window,0, 0, 0, 0,0, 9,0);window.document.getElementsByTagName('input')[2].dispatchEvent(evt);")
The best I can get is a "tab space" to be inserted after my text so I end up with this in the input field:
"mytext "
What I actually want is to tab to the next control. Any clues? Thanks!
(Note: I have to use tab and can not use focus or select to chose the element I want to go to, for various reasons, so no suggestions along these lines please!)
selenium.keyPressNative(java.awt.event.KeyEvent.VK_TAB + "");
I don't use the Java API, but this post from google groups suggests it is your solution. I can't imagine that "9" is different from "09" in your question, but give it a try?
Try the official TAB char: \t or \u0009
Some functions may used Onblur. It will trigger the function when the field lose the key focus. here we can use fireEvent with "blur" or "focus" command as follows:
command: fireEvent
target: id=your_field_identification
value: blur
Reference: http://qaselenium.blogspot.com/2011/01/how-to-triger-tab-key-in-selenium.html
Improvising Ryley's answer, we can use
selenium.keyDownNative(java.awt.event.KeyEvent.VK_TAB + "");
selenium.keyUpNative(java.awt.event.KeyEvent.VK_TAB + "");
I tried this method for VK_CONTROL in IE and it worked good.
Use typeKeys():
Quoting the above link:
Unlike the simple "type" command, which forces the specified value into the page directly, this command may or may not have any visible effect, even in cases where typing keys would normally have a visible effect. For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in the field.
In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed.

haml editing on gEdit, any way to auto indent?

I'm using gEdit to edit haml files and the auto indenting feature seems to work when i'm writing one line after another, but when I go and clear out a exisiting element (a div or a class) the rest of the code below doesn't adjust itself. Suppose this is my code
.rightside
.container
%ul
%li hello
%li world
Now is there any way (using some plugin) through which when I delete .rightside, the rest of the code moves to left by two spaces? I now have to manually erase the space on every line. Thanks for your input.
You can select the block underneath the tag in question and use Shift-Tab or Ctrl-Shift-T to un-indent the text, assuming you have gedit set to use 2 spaces for tabs.
I have also installed the multi-edit plugin. This gives me multiple carets at which points any edits i make will be duplicated. In this case, I can just position the cursor at the top of that block, use the Ctrl-PgDown key shortcut to select the whole block, and then hit delete a couple times.

How to disable region collapsing or expand ALL regions in Visual Studio VB.NET?

In Visual Studio C# (2008), Ctrl+M+L expand all the regions.
There's also a setting in menu:
Tools -> Options -> Text Editor -> C# -> Advanced
to not collapse during file open. I see no equivalents in VB.NET.
Is there a way to expand all the regions, not just the one which has focus in VB.NET?
Or a macro or add-in that does it? I just hate not being able to see all the code.
In Visual Studio 2012 and 2013 there is an option for deactivating collapsing (called 'outlining mode').
You can find it under:
Text-Editor->Basic->VB Specific
and then uncheck "Enable outlining mode".
But you will then lose the feature for collapse/expand at all.
If you are willing to remove regions you can try this:
Ctrl+F
Quick Replace
Find Options
Use: Regular Expressions
Find What:
^\s*#(end)?region.*$
Replace with:
[leave replace box empty]
Explanation:
^ - Match the start of a line
\s* - Match zero or more whitespace characters
# - Match one # character
(end)? - Optionally match the string end
region - Match the string region
.* - Match zero or more of any other characters
$ - Match the end of the line
This will effectively find all #region or #endregion lines, whether they are indented or not, and whether they have description text after them or not.
In the Edit Menu, the Outlining submenu, you have all the options. Including Toggle All Outlining (Ctrl+M+L by default).
Maybe your key mappings were altered.
If you so desire, you can even select menu:
Edit -> Outlining -> Stop Outlining
In VB.Net, do a Search and Replace and select Use Hidden and Use Regex:
Replace:
^.*\#(end)*(:Wh)*region.*\n
With:
I wrote an extension to do this (and more), and it works for VB and C#. See this answer for more info:
Hiding the regions in Visual Studio
Once I changed:
#Region Form Level Events
#End Region
To (note the addition of quotes):
#Region "Form Level Events"
#End Region
The minus signed appeared and I was able to collapse/expand Regions.
That's pretty odd. The default profile settings for VB.Net and C# should bind the outlining functions to Ctrl+M, Ctrl+L combos.
It's possible that your profile is in a weird state. Try resetting your profile to VB.Net settings and see if that fixes the problem.
Tools → Import / Export Settings → Reset All Settings → VB.Net Profile
I came up with this trick:
Ctrl+F
Quick Replace
Find:
#Region
Search in: current document (or entire project or wherever you need to expand regions)
Search in hidden text
Then press Return and keep it pressed until VS notify the search is endend.
As a result all your '#region's have been expanded in very few seconds.