Sublime Text 2 how to wrap selection with quotes/auto-pairing - autocomplete

I just switched from Textmate 2 to Sublime Text 2. I figured that typing single quotes or brackets would automatically generate a second quote or bracket with the cursor in between ("auto-pairing" is what they call it, Textmate2 does this by default) but this isn't happening.
I see that in the preferences->settings-Default there is some JSON configuration that would seem to be doing what I need but this is not the case. I haven't changed any of this default configuration.
Could someone help me add to my preferences->settings-User the configuration I need to enable auto-pairing for all the common tags, i.e., "'{[(?

Right now I'm working on a client's laptop and running Sublime Text 2 portable version from my flash drive. No additional packages installed, default settings. Everything works as expected:
When I type a single or double quote, brackets, square or curly brackets it adds a closing one and puts cursor in the middle.
When I select smth and press any of mentioned above keys it surrounds selection with pair of appropriate quotes or brackets.
Check your Settings>Default, look for this:
// Controls auto pairing of quotes, brackets etc
"auto_match_enabled": true,
It's near line 89 or so.

Not a direct answer to your question..but I have installed a few plugins in ST2 and auto-pairing works fine.
I am not sure which plugin is responsible for it. Let me know if you would like me to share the list of plugins.

Related

Is there a way to use cursorWordPart*Select command w/o capturing underscore?

I'm a fan of sub-word captures, but I'm used to the sublime way where if you have a word with underscores, it will exclude the underscore from the capture like this:
In VScode, I setup my keyboard shortcuts to use the cursorWordPartLeftSelect and cursorWordPartRightSelect, but they include the underscore like this:
Here are the lines from my config:
Is there a way to change that?
Add the underscore character to the Editor: Word Separators list in the settings (just search for separators).
~!##$%^&*()-=+[{]}\|;:'",.<>/?_ // with the underscore added at the end
I am a little surprised it isn't already there but it isn't. Then your WordPart selectors won't include the underscores.
It looks like v1.44 adds a fix to this so that the cursorwordpartleft/right acts like Sublime Text with respect to underscores. See https://github.com/microsoft/vscode/issues/93239.
I'm experimenting with this extension, and removing underscores and hyphens from VS Code's word separators:
https://github.com/mlewand/vscode-select-part-of-word
Haven't had the time to dig into it and configure it to match Sublime Text yet but I'm praying this will be a part of the puzzle in getting VS Code to work like Sublime Text did!

How to use tabs instead of spaces for other than indenting in Eclipse neon?

I want to use the tab character rather than the set of spaces in every opportunity that presents itself. In Eclipse helios, this was not a problem. Eclipse did not attempt to change anything but the indentation, and that setting was settable. Now, I will go from:
...
(tab)/**
(tab)*(cursor)
...
then I will hit the tab character with my cursor where shown, resulting in:
...
(tab)/**
(tab)*(space)(space)(cursor)
...
Anyone know why this might be and how to prevent it? The single most annoying application of this problem is when I copy a tab character and paste it somewhere else, it shows up as a set of spaces.
Note: I can overcome this via ctrl+f and replace, but that is so annoying to use after the fact. I am looking for something that prevents that from being necessary in the first place

Replacing a string in Rubymine with a string with newlines

I want to use the Search and Replace dialogue in Rubymine, or something similar to replace something like "Scenario:" with "#Desktop\nScenario"
I'm trying to replace every instance of Scenario: in a large Cucumber test suite with
#desktop
Scenario:
Any best ways to do this?
Update:
Thanks to #ryan2johnson9 comment, I realise there's now an easier option (tested on 2017.3).
By clicking on the "New Line" (or using the shortcut Ctrl+Shift+Enter / Alt+Enter), the input becomes multilines.
Original Answer
In the search and replace box, if you tick the "Regex" option you can do:
Search: "Scenario:"
Replace by: "#desktop\nScenario:"
The only trick is to tick the "Regex" option :)
Rubymine has macros (http://www.jetbrains.com/ruby/webhelp/binding-macros-with-keyboard-shortcuts.html) but I dont think they are powerful enough for this example.
It's possible that you could solve it with some elaborate feature hidden inside Rubymine, but I think it would be a lot easier to do this with a tool like perl/sed from the Terminal. If you are using Windows I assume you could search the net and find a text search/replace tool that fits your need.
In OSX I there are a bunch of Text Substitutions app too.
I would go that route since Rubymines macro tool isnt up to the task.
Here's a cheap and sleazy alternative:
Copy a newline character from between two empty lines in the file being edited. Temporarily add two empty lines if you don't have any.
Set up search/replace and enter the string you want to replace into the search text input box.
Paste the newline you just copied into the replacement text box plus whatever other text you want. You will be able to see the height of the replacement text input box grow vertically by one line due to the newline.
Perform the search/replace.
For this, the use of the Rubymine regex is optional.

Parentheses over selected words in Eclipse

A few days back I felt this question to be dumb and dint post it here, but after even after searching a lot I dint find a proper solution.
For those of you who used TextEdit (on Mac), they will perfectly know what I am talking about.
While coding I just want to put quotes or parentheses over a word or a line.To do this I'll have to move back to the starting of the word, open the quote and then go to the ending of the word and close it.
Is there a plugin or so in eclipse where I can just surround the current selection with quotes or parenthesis ?? I am not talking about quick fix (Ctrl + 1). It can be used for much complex templates.
You can do that with a custom template, so for example if you want to create this template for java, you can do :
Preferences ---> Java ---> Templates
Create a new template and call it quote, then type this as pattern :
"${word_selection}"${cursor}
Save it and Apply.
After that you can use that template selecting the text you want to quote then press CTRL + SPACE and then chose quote.
Same thing for parenthesis :
(${word_selection})${cursor}

Hungry Backspace in Eclipse?

In some editors there exist plugins implementing a feature called "hungry backspace" or "hungry delete".
If this mode is active in a text editor then one hit to the backspace key will automatically delete all whitespace chars backwards from the current cursor position up to the first non-whitespace character.
For example, this feature exists for Emacs and IntelliJ IDEA.
Does anyone know if it is also available in Eclipse?
Alt-Del is probably as close as you're going to get without writing a plugin yourself. Others have asked for this feature (coming from intelliJ) but so far it doesn't exist, or it's not published.
-Adam
CTRL-backspace is pretty close too: delete previous word:
function(); (4 spaces)
+ CTRL-BACKSPACE gives:
function
Other than that, AnyEdit plugin can convert trailing spaces into tabs (but also into "", effectively removing them)
Ctrl+Shift+Left, Backspace always works for me. works in notepad, web browsers, everywhere.
Stick to the standards :)
In SciTE, and Eclipse (3.4), Ctrl+Shift+Del with the caret after the last visible character will delete these spaces. Ie. it deletes from caret to end of line.
Actually, in SciTE I don't need to do that, since I have set it up to automatically remove these trailing spaces when saving.
Note: In Preferences > General > Keys, there is a Remove Trailing Whitespace binding (without key assignment by default) which seems to apply to File.
From eclipse Windows menu/Preferences
Search for Keys and filter to "Delete Previous Word"and Bind it to the Ctrl+Backspace