Visual Studio - Keyboard-Shortcut: How do I select a line by shortcut - keyboard-shortcuts

How do I select a line by shortcut?
My goal is e.g. to surround a specific code snippet with something like try/catch block:
Select line Key -> Shift+F10 -> s -> s -> t -> r -> y -> enter -> baammm.
I found I could do HOME and then shift+END, but the HOME and END button are far away. According to Visual Studio Shortcut Description (unstated to which version this is referencing to) it says Ctrl + L.
In my case (freshly downloaded VS without any changes made in any settings) Ctrl+L (i.e. Ctrl+Shift+l) is deleting the line, which is NOT selecting it. Ctrl+l is then deleting the line keeping its contents in the cache which is very basically Ctrl+x
According to Mr_Green in that similar question) it is Ctrl+E then U, which doesn't work either.
And then I found this:
Tools -> Options -> Environment -> Keyboard
Here I would think to find something like "Edit.SelectLine", but it's not there.

Related

How to auto-indent code in the Atom editor?

How do you auto-indent your code in the Atom editor? In other editors you can usually select some code and auto-indent it.
Is there a keyboard shortcut as well?
I found the option in the menu, under Edit > Lines > Auto Indent. It doesn't seem to have a default keymap bound.
You could try to add a key mapping (Atom > Open Your Keymap [on Windows: File > Settings > Keybindings > "your keymap file"]) like this one:
'atom-text-editor':
'cmd-alt-l': 'editor:auto-indent'
It worked for me :)
For Windows:
'atom-text-editor':
'ctrl-alt-l': 'editor:auto-indent'
The accepted answer works, but you have to do a "Select All" first -- every time -- and I'm way too lazy for that.
And it turns out, it's not super trivial -- I figured I'd post this here in an attempt to save like-minded individuals the 30 minutes it takes to track all this down. -- Also note: this approach restores the original selection when it's done (and it happens so fast, you don't even notice the selection was ever changed).
1.) First, add a custom command to your init script (File->Open Your Init Script, then paste this at the bottom):
atom.commands.add 'atom-text-editor', 'custom:reformat', ->
editor = atom.workspace.getActiveTextEditor();
oldRanges = editor.getSelectedBufferRanges();
editor.selectAll();
atom.commands.dispatch(atom.views.getView(editor), 'editor:auto-indent')
editor.setSelectedBufferRanges(oldRanges);
2.) Bind "custom:reformat" to a key (File->Open Your Keymap, then paste this at the bottom):
'atom-text-editor':
'ctrl-alt-d': 'custom:reformat'
3.) Restart Atom (the init.coffee script only runs when atom is first launched).
Package auto-indent exists to apply auto-indent to entire file with this shortcuts :
ctrl+shift+i
or
cmd+shift+i
Package url : https://atom.io/packages/auto-indent
I prefer using atom-beautify, CTRL+ALT+B (in linux, may be in windows also) handles better al kind of formats and it is also customizable per file format.
more details here: https://atom.io/packages/atom-beautify
You can just quickly open up the command palette and do it there
Cmd + Shift + p and search for Editor: Auto Indent:
This works for me:
'atom-workspace atom-text-editor':
'ctrl-alt-a': 'editor:auto-indent'
You have to select all with ctrl-a first.
This is the best help that I found:
https://atom.io/packages/atom-beautify
This package can be installed in Atom and then CTRL+ALT+B solve the problem.
On Linux
(tested in Ununtu KDE)
There is the option in the menu, under Edit > Lines > Auto Indent or press Cmd + Shift + p, search for Editor: Auto Indent by entering just "ai"
Note: In KDE ctrl-alt-l is already globally set for "lock screen" so better use ctrl-alt-i instead.
You can add a key mapping in Atom:
Cmd + Shift + p, search for "Settings View: Show Keybindings"
click on "your keymap file"
Add a section there like this one:
'atom-text-editor':
'ctrl-alt-i': 'editor:auto-indent'
If the indention is not working, it can be a reason, that the file-ending is not recognized by Atom. Add the support for your language then, for example for "Lua" install the package "language-lua".
If a File is not recognized for your language:
open the ~/.atom/config.cson file (by CTRL+SHIFT+p: type ``open config'')
add/edit a customFileTypes section under core for example like the following:
core:
customFileTypes:
"source.lua": [
"conf"
]
"text.html.php": [
"thtml"
]
(You find the languages scope names ("source.lua", "text.html.php"...) in the language package settings see here)
If you have troubles with hotkeys, try to open Key Binding Resolver Window with Cmd + .. It will show you keys you're pressing in the realtime.
For example, Cmd + Shift + ' is actually Cmd + "
You could also try to add a key mapping witch auto select all the code in file and indent it:
'atom-text-editor':
'ctrl-alt-l': 'auto-indent:apply'
I was working on some groovy code, which doesn't auto-format on save. What I did was right-click on the code pane, then chose ESLint Fix. That fixed my indents.
If you are used to the Eclipse IDE or the Netbeans, you can use the package eclipse-keybindings (https://atom.io/packages/eclipse-keybindings):
This Atom package provides Eclipse IDE key mappings for Atom. Currently, the Eclipse shortcuts are directly mapped to existing Atom commands.
To format all lines from a file, just use: Ctrl+Shift+F.
Ctrl+Shift+i worked for me in PHP under Windows ... but some files did not react. Not being the brightest it took me a while to work out that it was the include files that were the problem. If you are using echo(' ... PHP ...') then the PHP does not get re-formatted. To get over this, create a temporary PHP file, say t.php, copy the PHP part into that, reindent it (Ctrl+Shift+i ... did I mention that?) and then copy the newly reformatted PHP back into the original file. Whilst this is a pain, it does give you correctly formatted PHP.

How to make phpstorm display line numbers by default?

How to make phpstorm display line numbers by default?
Couldn't find that option. It's kind of annoying to turn them on manually for each page.
Settings (or Preferences if you are on Mac) | Editor | General | Appearance and check Show line numbers.
Just now found where is it on Windows. Its View -> Active Editor -> Show Line Numbers (changes only for current document) and File -> Settings -> Editor -> Appearance -> Show Line Numbers (for all documents)
For Mac Version go to PhpStorm -> Preferences in menu.
In the preference window go to IDE settings -> Editor -> Appearance -> Show Line Numbers (To change setting for all documents)
OR if you want to quickly set show line number PER CURRENT WINDOW even easier - right click on the long white column (where breakpoints are set) then select Show Line Numbers.
Red dot on the screenshot is a place where you have to click
All the guys are right. I am just bringing the the current soultion with the images.
Go to File-> Settings
In the box in the top right corner type in line numbers, just below that choose Editor->Appearance, from the right checkboxes, find Show line numbers and check it.
After that hit Apply and OK
That should do the trick.
My version of PhpStorm is 6.0.3
If you're on a Mac:
PhpStorm -> Preferences... -> Editor -> Appearance -> Show Line Numbers
just double tap 'Shift'
and search for 'Line Numbers'
and there you will see a toggle option on or off
In PHPStorm 8 this setting is no longer under 'Appearance' but now in:
File -> Settings -> Editor -> Appearance -> Show line numbers
Follow the below steps:
Click on File->Settings->
In the Settings dialog box Expand Editor under IDE Settings
Click Apperance - > select Show line numbers.
Click Apply->Ok.
Simplest solution for line numbers in php storm..There are many other solutions but i think A big picture a good from 1000 words.
File -> Settings -> Editor -> General -> Appearance
check "Show Line Numbers"
This is the current location as of phpStorm 8.0.2 on Ubuntu 14.04
Settings -> editor | appearance | Show line numbers
Just right click on left side where line numbers generally show, select "show line numbers"
In PHPStorm 2016: File > Settings > Editor > General > Appearance > check "Show line numbers"
By typing command + shift + A you will get a search prompt and write line numbers . Now you can trigger button on or off
For PhpStorm version 9 on Windows.
File→Settings→Editor→General→Appearence then check Show line numbers
in the top right corner is a search button type show line numbers and you will see a toggle option. this way you never have to do it yourself. :)
File->settings->IDE Settings->Editor->Appearance
And just check the "Show line numbers" works with 8.0.1
On the Mac version 8.0.1 has this setting here:
PhpStorm > Preferences > Editor (this is in the second section on the left - i.e. IDE Settings NOT Project Settings) > Appearance > Show line numbers
You should go to: File -> Settings -> Editor -> General -> Appearance -> Show Line Numbers
As of the latest version:
PhpStorm > Preferences.. > Editor > General > Appearance > Show line numbers

What is the equivalent of option/alt + left/right arrow on debian but on a Mac OS X?

As the title says...
It's been annoying me forever that I can't skip over words when writing in the Mac terminal (it works when im logged into Debian via ssh on the Mac terminal)
I get '[D' on Mac instead of jumping a word left.
Option + B to skip back a word, Option + F to skip forward a word. You also have to use the option key as the meta key.
Ctrl-[ b should jump back a word. You can also use Esc instead of Ctrl-[, and f to go forward.
The same key combos will work on Linux (over SSH, or sitting at the machine) and doesn't require adjusting to different keyboard layouts.
The answers here do not solve the issue in my opinion. To get GNU like word scrolling, you can edit your key bindings for CTRL + -> and CTRL + <- in order to have them skip words.
ITERM(2)
Go to Preferences -> Profiles -> Keys -> + (Under the bindings)
You will have a prompt asking you for a keyboard shortcut, press CTRL and the arrow key you are using.
Set ACTION to SEND ESCAPE SEQUENCE
Set ESC+ to b (for back) or to f (for forward)
TERMINAL
Preferences -> Profiles -> Keyboard -> + (Under the bindings)
Set KEY to <- Cursor left or right
Set MODIFIER to ^ Control
Set ACTION to Send Text
Set the empty input box to either \033f (for forward) or \033b (for backward)
After exiting, you will be able to skip forward and backward by 1 word, exactly like in GNU Linux.
Please note that there will be an issue with vim for cycling forward, as noted here:
https://superuser.com/questions/639992/iterm2-vim-altright-left-arrow
I hope this helps!

Force code formatter in IntelliJ to join lines

I'm trying to force IntelliJ to reformat the code the way Eclipse does it.
When I set a line width to e.g. 120 chars I would like IDE to join line that were broken up to multiple lines (e.g. because the line width was set to 80 chars).
I want to go from here:
int a = 1
+ 2;
To here:
int a = 1 + 2
Is it possible in IntelliJ? I'm looking for the appropriate setting in the formatter but cannot find it. Could someone tell me where I can find it?
This works for me in intellij 8 if i go to:
File -> Settings -> Code Style -> Wrapping -> Binary operations -> set to: 'Wrap if long' or 'Do not wrap'
Then CTRL-ALT-L to reformat the code
Menu -> Edit -> Join Lines (Ctrl+Shift+J)
If your code already contains inappropriate line breaks and you want the formatter to remove them during the reformat,
File -> Settings -> Code Style -> Wrapping and Braces ->
Keep When Formatting -> Line Breaks -> Untick
(at least on IntelliJ 15 based Editors)
For Intellij 2016.2.x I had to deselect this option in the Settings:
Then go back to your code and press CTRL-ALT-L

Show line numbers in Visual SlickEdit

Does anyone know how I can show line numbers in Visual SlickEdit? I can do this on a per file basis by doing View->Line Numbers, but I'd like to just set it as a mode in the editor and not have to do it for every file I open.
Thanks.
Do you want it for a specific file type?
You can do it for each language or all-languages
Tools->Options->Languages
Here you would select either 'All Languages' or a specific language (I just tried the 'all')
then you would select 'Line Numbers' on the right pane.
I've got SlickEdit 2007 (12.x), and AFAIK there's not a way to toggle line numbers for all files at once, but if you're only interested in a few different file types, you can turn on display of line numbers on a per-extension basis in the Display Line Numbers checkbox of the General tab of Tools > Options > File Extension Setup for each extension.
I'm using SlickEdit 2013 (v18.0.1.2 32-bit)
use
Tools -> Options -> Languages -> All Languages -> view
mark the check box line numbers
For SlickEdit Version 12.0.3.0 (Windows)
Tools -> Options -> File Extension Setup -> General (Tab)
You will see, Display line numbers check box
For SlickEdit 2012 (v17.0.2.0 64bit) (Linux)
Tools -> Options -> Languages -> Languages -> View
You will see, Line numbers check box