How to Move selected text Left or Right - webstorm

I can't believe I can't find a way in Webstorm that when you highlight code, then move it right or left as a group (tab left or right, moving it over left or right).
Is there a way to do this? I can't find one. I need to shift several lines of code in JSON to tab and make it read better from withing Webstorm as just one example. Most editors have this capability! unless I'm just missing it, this is a huge hole in Webstorm that is fundamental that is simply not there!
On top of this I've also noticed that if you put your cursor at the beginning of a line of code and then do Shift + Home to highlight the empty space before it, typically in most editors you can hit tab and start moving it back from the farthest point left back to right. In webstorm, when you highlight the empty space to the left of a starting line and hit tab, it starts tabbing from the the start of the line, not from the first empty space. I find this bizarre and very frustrating.

select a code region and hit Tab (Edit | Indent Selection) or Shift+Tab (unindent)

Related

How to highlight everything between a set of braces in Visual Studio

I know there is always the old fashioned way of holding down the left mouse button and dragging down, but for instance is there a method similar to (and of course this doesn't actually do it but it should in my opinion) holding down left mouse button and pressing CTRL+]? What I'm trying to do is highlight many lines of code with the press of a button or 1 click.
If you put the cursor on on the left or right had side of a curly brace you can use CTRL+SHIFT+] to select all code in the block. It will also select the curly braces.
This work using the opening or closing curly brace.
I have tested this and it works with MSVS 2013 and MSVS 2015
As an added bonus if you use CTRL+SHIFT+] on an opening or closing parentheses it will select all code between and including the parentheses.
Click at the top of the lines and shift click at the bottom. Its not one click but it is better then holding down the mouse and scrolling.

Moving over tab spaces in ncurses

I am creating a basic text editor using ncurses. It can display text fine, but navigating with arrow keys causes a problem when tabs are encountered. Calling move(y, x) will freely move the cursor onto a tab space, where most text editors will jump to the next character. Is there functionality within ncurses to jump over tab spaces or do I need to find a way to do it myself?
You have to do it yourself: wmove moves to the given coordinates, ignoring the way characters are displayed on the screen.
If a destructive (filling with spaces) tab works for your application, then you could use waddch:
If ch is a tab, newline, carriage return or backspace, the
cursor is moved appropriately within the window:
Tabs are considered to be at every eighth column. The
tab interval may be altered by setting the TABSIZE
variable.
For an editor, you probably do not want that behavior (though it probably would be helpful to use the TABSIZE feature when displaying text).

Proper code indentation for tabs in LibreOffice/OpenOffice and Ms Word

I have some text documents (.doc and .odf) with portions of colored code appearing inside.
This code was copied as RTF from Notepad++, that's how it got colored.
However, in Notepad++ (and in many IDEs as well), the line wrap function works makes the indented code look better when in does not fit and goes to the next line.
In LibreOffice/OpenOffice and Ms Word it's possible to achieve a similar line wrap with the "increase indent" button.
So, what I'd like to do, is to automatically replace the tabs (or 4 spaces, if you like) with proper indents. Or make the tabs behave like I expect them to. Is it possible? Thanks.
Here's a visualization of the problem
I achieved what I want through some (not that many) manual steps.
find out what is the maximum number of tabs (or sets of 4 spaces), say it's 3
open the search and replace window, input 3 tabs (or 12 spaces), and click "Find All"
now all groups of 3 tabs are selected, and you are working on all the lines with maximum indentation
park or close the search and replace window, click 3 times on the "Increase indent" button (or set the left indentation in the paragraph style menu)
delete the selected groups of 3 tabs
open the search and replace window, input 2 tabs (or 8 spaces), and click "Find All"
park or close the search and replace window, click 2 times on the "Increase indent" button
delete the selected groups of 2 tabs
open the search and replace window, input 1 tabs (or 4 spaces), and click "Find All"
park or close the search and replace window, click 1 time on the "Increase indent" button
delete the selected single tabs
Now you have a nice code indentation.
If you are using Microsoft Word, then there's no "find all", but there is a way to apply paragraph styles directly from the search and replace menu. But the steps are a little different.
First decide how wide a single indentation should be (e.g. 0.5 cm)
open the find and replace window, input 3 tabs (or 12 spaces) in the Find bar
leave the Replace bar empty, but click on it
if you don't see the Search options group, click More
click on Format
click on Paragraph
set a left indentation of 3 * the indentation width you want (e.g. 1.5 cm)
click Replace All, the paragraph style will be applied but the tabs/spaces will NOT be removed
click on the empty Replace bar (again)
click No Formatting
click on Replace All (again)
now the tabs/spaces will be deleted
Rinse and repeat until you get a nice indentation.
If you are using Python (or if you want to keep your white spaces) then instead of deleting the tabs (or spaces), you can replace them with a placeholder character you don't use in the rest of the code, say £ and replace them back in one pass when you are done. However, you'll get a skewed indentation.
I guess there's a way to do this with macros, but this was good enough for me.

Adobe brackets: write spaces instead of tabs

I am using brackets with coffeescript, but when I hit Tab, it insert a tabulation whereas i only need 2 spaces. Also, when I create a line break, the indent is tabs, and not spaces. Can I change these 2 setting ?
In the lower-right of the status bar you should see an indicator saying "Tab Size." Click the label to toggle to spaces. To change the amount of indent, click the number next to it and type a new value.
Note: if the indicator already says "Spaces" then Brackets should be using spaces instead of tab characters already. But it might not feel that way because when you move the cursor or press Backspace, there's a "soft tabs" behavior: the cursor will smartly skips over contiguous spaces to line up evenly with the next tab stop. If that bothers you, there will be a preference in the next release of Brackets (Sprint 38) to disable that behavior, making the cursor never move more than one space at a time.
For language specific control, Brackets allows you to provide different tab and space indentation values in the brackets.json file. For example:
"language": {
"html": {
"spaceUnits": 4
},
"javascript": {
"tabSize": 2
}
}
For changing tab spacing you can edit your brackets.json file. you can find it on Debug->Open Preferences File and simple add "spaceUnits": 2 at the end of the file for 2 space. Remember to add a comma on previous line. You can edit that file for customizing your bracket.
Or you can change it more easily at the right-bottom of your bracket interface you saw a option Space: 4 click on the number and change it as your wish...

Sublime Text 2 Lines too Far Right

I opened my laptop to code in Sublime Text 2 today, and every single file has it's starting indent line in the middle of the screen. I'm not sure what to call it, but, for example, this text box for my question starts my cursor for typing at the far left edge of the box.
This morning, that line is in the middle of the Sublime text editor. Instead of every line starting from the far left, their starting line is in the middle of the text editor window. It sounds small, but it bugs me quite a bit.
What setting is this? How can I get my normal indentation back?
Screenshot?
Anyway, what does this setting in your Preferences.sublime-settings say?
// Draws text centered in the window rather than left aligned
"draw_centered": false,
Find your sublime settings (in OSX it's the Sublime text 2- Preferences - Settings (default)) and find the "margin" value (default should be 4). Probably it's changed some how.