RubyMine automatically add end after typing do. How do enable this? - rubymine

Currently when I type something like this:
it "returns 8 milk chocolates and 1 sugar free chocolate" do
I have to hit enter twice in order to add the end. This is annoying to me. How do I enable this to just automatically add end and bring my cursor to the correct indented position after I hit enter? What can I do?

This did it for me:
Settings | Editor | General | Smart Keys
... then check "End on blank line"

Related

Netbeans unindent (Shift+Tab) not working when cursor is inside the line (no selection)?

In Neatbeans, unindent works as expected when multiple lines are selected. But consider the following, where the pipe character | symbolizes the cursor position in the editor:
(a) Cursor at start of line (no selection)
|hello world!
(b) Cursor inside of line (no selection)
hell|o world!
In Netbeans, when I hit Shift+Tab on version (a) then the indentation is removed. This is what I expect.
However, when I hit Shift+Tab on version (b) then nothing happens. This is different from the code editors that I am used to. I would expect the indentation to be removed, or that the cursor moves to the start of the line, such that the next Shift+Tab will remove the indentation.
Is there a config in Netbeans that makes unindent via Shift+Tab work when the cursor is inside the line?
To shift the line to the left, regardless of the cursor position you can use the "Shift line left" editor action. In the default NetBeans mapping this is assigned to Alt+Shift+KP_LEFT and Alt+Shift-LEFT
Just open the keymap options page and search for the action "shift line"
It's not exactly what you are asking, but you could try to remap that action to "Shift-Tab" and see if it works.
TLDR: There seems to be a bug in the way NetBeans handles indenting/unindenting.
I would expect the indentation to be removed
I don't see any formal documentation on how unindenting is supposed to work in NetBeans, but it appears to move the text to the right of the cursor to the left, as long as there is only whitespace to the left of the cursor. While that is different to how unindenting works in other code editors such as Intellij IDEA and Eclipse, where the entire line is shifted to the left even when the cursor is poitioned within the text, it's not necessarily incorrect.
If you want to unindent in NetBeans there are two simple alternatives: either position the cursor at the start of the line, or select some text - anything at all! - on that line before unindenting.
Some comments in the NetBeans Bug Report Bug 212353 - Shift+Tab (Delete tab) shortcut does not work in editor may be relevant:
Please note that those actions should be inverse - I mean when you
select a block and you hit <TAB> <TAB> <Shift-TAB> <Shift-TAB> you
should always end up with the same text. The same should be true if
you change the order to <Shift-TAB> <Shift-TAB> <TAB> <TAB> you
should end up with the same text.
That said, NetBeans is not adhering to that standard. Using your second example, pressing <TAB><TAB> works fine, but subsequently pressing <SHIFT><TAB> does nothing, so it is not possible to "end up with the same text". That looks like a bug (in Apache NetBeans 11.2 at least). You can raise a bug report here.
It's also worth noting that <Shift> + <Tab> is actually defined as the keymap for "Delete TAB" rather "unindenting".
Is there a config in Netbeans that makes unindent via Shift+Tab work
when the cursor is inside the line?
I don't think so. All you can do, using Tools > Options > Keymap, is to change the shortcut keys from <Shift> + <Tab> to something else, but that won't change the behavior.

emacs shortcut to insert 4 space and remove 4 space

Noob to emacs. I would like to create a shortcut in emacs to insert 4 space from current cursor position and remove 4 white spaces from current cursor position.
May be map it to C > and C <
Can somebody help me with this ?
Thanks in advance
zer0 0ne
You can replicate any key as many times as you want by adding a numeric prefix:
ESC <number> <key>
so you can do:
ESC 4 SPACE
or
ESC 4 BACKSPACE
if you want to make it permanent, define a macro for each and name it, and then assign it to a keystroke. see this for more details:
http://emacswiki.org/emacs/KeyboardMacros
or you make a function, but for this purpose is an overkill, I feel.
-dmg
You can easily map a key or keys to insert or delete spaces if you really want to, but that's not the Emacs Way. Customize c-mode to indent the way you want it to, and then you'll never have to manually tweak indentation again (and when you are looking at someone else's code and want to reindent it the way you like you just have to mark the whole buffer and type M-x indent-region--oh, the power!).
Emacs manual on customizing C mode
Emacs Wiki

How to Use Autocomplete in Sublime Text

I'm switching from Dreamweaver to Sublime Text, but the way ST handles autocomplete is different from DW. In DW, the tag autocompletes when you start typing the ending tag. But with ST, it autocompletes when you type the opening tag.
My problem is that in ST, you get trapped inside the tag you're typing, and the only way to move on to the next line is to hit the right arrow key a bunch of times. That seems totally ridiculous. Is there some shortcut I'm missing?
This might be what you're looking for:
https://github.com/SublimeText/Tag
In my copy of ST with this plugin installed, beginning to type the end-tag completes the tag and moves the cursor to the character immediately following the end of line.
Ctrl Enter will bring you to the next line and keep the auto complete that shows up. I'm on a mac.

How to move out of auto-completed brackets in IntelliJ IDEA (without using the arrow keys)?

I recently switched from Eclipse to IntelliJ IDEA, and found myself wondering how to move the cursor out of a pair of auto-completed brackets.
In Eclipse after I finished typing in a pair of brackets, pressing tab brings me out of the brackets. How can I do the same thing without using the arrow keys?
Many thanks for your help!
IDEA doesn't have such feature yet. The closest equivalent is the Complete Current Statement editor action (Ctrl+Shift+Enter).
UPDATE
Initial implementation for this feature is available in 2018.2 EAP version - press Tab to jump out.
It works more like in MS Visual Studio - without visual indication of tab 'exit' position. For now, it should work in Java, SQL, Python and some other files. It will take some time for other languages to catch up - some language-specific code changes are required.
The feature is disabled by default, you can enable it in
Settings -> Editor -> General -> Smart Keys -> Jump outside closing
bracket/quote with Tab
Ctrl + Shift + Enter does not seem to work for me in IDEA 12.1.4, but I found the closest feature to what I was looking for was Shift + Enter. This completes the line, creates a new line below the current line and moves the cursor to it.
You can do this by pressing the closing symbol that you would've pressed otherwise, but was auto completed. For example, if you have just typed the f below, you would press shift and 0 (or closing parenthesis), and it will move your cursor outside of the parenthesis.
String asdf = "hello world";
System.out.println(asdf);
I went to preferences->Keymap and set a shortcut for "Move Caret to Line End" to Shift-Space. It takes me to the end of the current line I am on without adding anything, if that's what you want.
Not currently supported by Intellij. There is an open feature request on this at http://youtrack.jetbrains.com/issue/IDEA-74666. Extra votes would be nice.
Intellij supports the ctrl+shift+m shortcut that jumps to the end of the block:
https://www.jetbrains.com/help/idea/2016.2/navigating-to-braces.html
It's not quite what you're looking for, but you can type the character you are trying to move outside of (a closing paren, for example) and that should pop you outside of the auto-completed character.
Not ideal, but functional as far as I've tested it.
I set these setting:
1) I added Semicolon shortcut to Complete Current Statement:
Instead of using for loop command, I using fori command (because for command needs semicolon character):
2) I added Alt+Semicolon shortcut to Move Caret to Code Block End:
So when I inside the loop, by pressing Alt+Semicolon jumping end of the bracket, by pressing Semicolon I jumping out the bracket subsequently.
by adding these shortcuts, the speed of coding will be faster.
Such key is called "End".
You can assign any unused shortcut to "Move Caret to Line End" action in "Settings/Preferences | Keymap".
P.S. You can use Ctrl+Shift+Enter to complete your statement (in your case it will place caret at the end of line and will add ";" there) -- action called "Complete Current Statement" and shortcut can be checked/changed in a same way as described earlier.
If you decide to move back to Eclipse and use PyDev this feature by default is disabled, First Switch to PyDev Perspective and you can enable it by going under Preferences>PyDev>Editor>Typing>Enable link on Automatic parenthesis or literals closing

Eclipse semicolon inserted before cursor when typing full line not using content assist

This behavior is dring me batty.
I type the following:
fileName.append(c.get(Calendar.HOUR_OF_DAY))
Now when I typed that the content assist poped up. I did not pick HOUR_OF_DAY from the content assist nor did I press enter to fill it in automatically. I just typed "HOUR_OF_DAY". I typed both end parens ")" at the end of line too, I did not press tab.
My cursor is now at the end of the line and I type ;
Eclipse inserts the ; AFTER the cursor! So when I press enter, the semicolon moves to the next line!
I've tried everything I can think of in the preferences. I turned on "auto smeicolon" option that is supposed to place semicolons at the end of the line automatically but it doesn't fix this.
One clue: if I press "ENTER" before typing ";" at the end of the line, the content assist window goes away and the ; is inserted properly with the cursor now afte the ;. So content assist is messing with me.
Any help is appreciated.
Go to Window -> Preferences -> Java -> Editor -> Typing and uncheck Semicolons in the Automatically insert at correct position group.
Yeah I just started seeing this exact behavior after changing some of my preferences, I switched them back and the behavior went back to normal.
Preferences > Java > Editor > Content Assist:
These settings are the default and do not produce the bad behavior you describe.
When I was seeing the unwanted behavior, I had the delay set to 50ms and the auto activation triggers set to ".(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"