Is there any shortcut for CodeBlocks to format the code? - codeblocks

Is there any shortcut for CodeBlocks to format the code?
I haven't find any tip in google.
I found only "format use AStyle", but it come up with right mouse button only...

probably not by default but you should be able to assign it there:
Settings -> Editor -> Keyboard shortcuts -> Plugins -> Source code formatter (AStyle)

My favourite = Ctrl + A then Ctrl + Shift + F.
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).

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

Whats the visual studio equivalent to eclipse alt + arrow Left

From Eclipse i'm confortable with
F3 to enter a method and ALT + <-
In visual studio (2010) its F12 to enter the method, but how do i get back to the call, where i jumped in?
You can use Shift + F12 to list all references, and the original method will be listed.
Ctrl + - will navigate backward, whilst Ctrl + Shift + - will navigate forward (in the context of where you were working in your code).
Ctrl + , will allow you to search for a method to navigate to.
In my VS Code V 1.20.1 the shortcut is:
Ctrl + Alt + - for backward.
For going forward is Ctrl + Shift + -.
We can change these shortcuts just like in Eclipse by selecting the menu File -> Preferences -> Keyboard shortcuts, and type on the search field for Go Back or Go Forward.
To do this on MacOS VS Code
^+- to go backward.
^ + shift + - to go forward.
Note that^ is control on your keyboard.
Full list of other mac keyboard shortcuts here: https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf

Shorten code automatically in Xcode

I was wondering if it was possible to shorten code automatically in the last version of xcode. You know, when you press on the side of a void method for example and the (...) appear, and you have a shorter page. Is there a command to do it?
Click on the Editor>Code Folding menu and you'll see all your options for this, along with the keyboard shortcuts.
The shortcut is cmnd + shift + option + left arrow key. This will collapse all functions.
You can press command + alt + left cursor key on your keyboard to fold your codes or press command + alt + right cursor key to unfold. Make sure your pointer is inside of the curly brackets.

VS2010 formatting hotkey?

Is there a hot key to force VS to format the current line/block in C#? (Similar to what happens when you add a semicolon to the end of a line or add a closing brace)
You can see the shortcuts (they are dependent on your settings) in the Edit/Advanced menu, where you have Format Document and Format Selection.
Place the cursor on one brace, then press Ctrl+Shift+{, then Ctrl+E, F.
You can also format the entire document by pressing Ctrl+E, D.
There are:
Ctrl + K + D - it formats the whole document.
Ctrl + K + f - it formats the current selection.
These also appear under the Edit -> Advanced menu.
See this document on MSDN, these appear under Edit.FormatDocument and Edit.FormatSelection.

Is there a way to delete a line in Visual Studio without cutting it?

I want to delete a line just like hitting Ctrl + X without anything selected, but without saving the line to the copy stack. Is this possible?
I'm using Visual Studio 2010.
Edit.LineDelete is the name of the command. By default it's bound to Ctrl + Shift + L, but you can give it whatever you like in Tools | Options | Keyboard.
Edit: Corrected default shortcut info.
Ctrl + Shift + L will delete the line and not copy to the clipboard.
I mapped Ctrl + L (Global) to Edit.LineDelete. Otherwise, the shortcut key is Ctrl + Shift + L, which is awkward. Go to Tools > Options > Environment > Keyboard as shown below.
Correction in my answer
Ubuntu 16 &
Visual studio Version: 1.30.1
To cut line
Shift + del
To delete line Shift + Ctrl + k
CTRL + L (Visual Studio 2019 Windows)
Its Cmd + Shift + K on mac by default.
But it can be modified according to user needs from the settings (Preferences -> Keyboard Shortcuts) -> search for Delete Line key value.
Valid Answer By 2022 for VS Code (with image)
All the above answers regarding Ctrl + Shift + L are now deprecated.
The correct default behavior is Ctrl + Shift + K
(⌘ + Shift + K if you're a MAC user).
To change this default behavior:
1- Go to File > Preferences > Keyboard Shortcuts (OR click Ctr+K Ctrl+S)
2- Type in the search bar delete line
Here you will find the corresponding behavior. You can change it just by double-clicking on it and pressing any desired combination of keys on your keyboard (pay attention of conflicting shortcuts).
By default, if you are using the C# default profile, you can delete a line using Ctrl + Shift + L.
You can customize this using Tools->Customize. Select "Keyboard". Look for the command Edit.LineDelete to assign it to whichever keyboard shortcut you like.
Source
If you got here looking for an answer for Visual Studio Code the default shortcut is:
ctrl + shift + K for Windows
⌘ + shift + K for MacOS
However, you can change on File > Preferences > Keyboard shortcuts
{
"key": "ctrl+shift+delete",
"command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
}
Source
none of the above answers worked for me. to delete a line in visual studio code use :shift+del
All the answers were helpful but didn't seem to work for me.
So I found the solution --> for Visual Studio 2017 (and certainly 2019):
Tools > Options > Environment > Keyboard > on the right pane select Edit.LineEdit.
Below there is a ComboBox Use new shortcut in: with Global written --> Change it to Text Editor.
On the right there is a Text input Press shortcut keys:, so use the shortcut of your choice.
Then click on Assign PushButton on the right (otherwise it won't be applied).
Finally > OK.
You can now open a .CPP file and use your shortcut to remove a line.
On Visual Studio 2019 for Mac, it's CTRL + K to cut the whole line by default.
Here is a url for the keyboard short cut reference for windows:
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
For windows: Ctrl + Shift + k
The other answers are specific to Visual Studio, which is what was requested by OP, however if anyone is looking for a more generalized way to do this for most Windows programs, you can also Triple-Click to select any block of text, then just press the Delete key. This works for any Windows text editors or TextBoxes, including password boxes, search boxes, browser web address boxes, etc. For text editors such as Visual Studio, a block of text is typically one line of code. Obviously you can do other things too, such as triple-click to select a line of code, then Ctrl-X, Ctrl-V to cut/paste, etc, or just triple-click and type over it to replace a line.

Resources