How to prevent auto-complete popup display after comma or colon? - sublimetext

I just updated my Sublime Text version (Build 4107), and it seems to me a new behaviour appeared - that I would like to avoid.
Whenever I write a colon or comma, the auto-complete popup automatically displays, which is problematic because most of the time in this situation I am about to go to next line by pressing Enter. Thing is, if press Enter, I select now the first occurence of autocomplete instead of going to next line.
I can avoid this by doing "Alt + Enter" or by pressing "Esc" before Enter, but it is not a convenient solution. Is there any way to prevent this autocomplete popup to display afer this particular punctuation signs ?
I read about punctuation.separator scope naming (https://www.sublimetext.com/docs/scope_naming.html#punctuation). But I can't figure out how to use it in auto_complete_foo settings to do what I want.
Example :
Thanks for the help !

If you have a package SublimeCodeIntel, try to disable it, and check the problem is saved or not
It helped me

You can set "auto_complete_when_likely": false, in your user preferences which should prevent this behavior.

Related

Xcode 8 and 9: how to disable code completion when clicking "Tab"

I often use Xcode snippets which contain fields to fill (like <#time_interval#>), I jump between those fields with tabulator. Sometimes, when I fill a field with a word and click tab to jump to next field, Xcode automatically changes word to first suggestion from autocompletion dropdown, e.g. HelloWorld. I don't want to disable suggestions, I just want to disable completing my code on clicking tab. Is there a way to do so? I feel extremely dumb because I make iOS apps for over 7 years already and this setting drives me crazy. It should be something simple somewhere and I must have missed it over and over.
UPDATE for clarification (images):
Click tab and enter one field to fill it:
Type what you want to have there e.g. "literal" word:
Click tab again to pass onto next fillMe field. Expected result:
Actual result (instead of word "literal" you get Color Literal there which is the first position in autocompletion list):
You may use CMD+Z as a workaround - it will revert Xcode autocompletion and leave everything else as is.

Completion popup closes after pressing Enter twice

I'm using Qt Creator 3.1.1 with FakeVim mode enabled.
When the completion popup appears with the desired function already as the first one, I have to press Enter twice in order to insert text. The same thing happens when I want to insert more letters before hitting Enter. I have to press first key twice, than everything goes as expected (following keys require single presses, Enter too).
ex. I entered avform and the popup appeared. If I want the first tooltip AVFormatContext i press Enter twice. If I want avformat_smthing I need to press aaform_ cause the first a will like change mode back to insert (but not really as I'm still in INSERT mode).
I wonder if anybody stumbled upon similar problem/inconvenience, and what can I do to change QtCreator behavior.
It seems like it's a known bug, and it hasn't been fixed yet. It only appears in newer versions of Qt-creator (>2.8.1). Partial fix is to disable autocompletion or unmark Pass keys in insert mode but both options have side effects (ex.Ctrl+N opens completion popup, but the text doesn't get inserted).
Link to: Issue on BugTracker for curious.

How can I find and replace inside a selection in Xcode?

In Xcode < 4, you could hold the "option" key, and the "Replace All" button would change to "Replace in Selection". As of Xcode 4, this does nothing. Anyone know if there's a new way to do it, or is it bug filing time?
This appears to be working again now, at least in Xcode 4.4.1.
When the find/replace bar appears at the top of the editor, holding down the option key on the keyboard causes "Replace in Selection" to appear in lieu of "Replace All."
I'm glad, because this was an ANNOYING omission.
Another workaround:
In Xcode, select the text, press copy
In a terminal session:
pbpaste|sed 's/SOURCETEXT/NEWTEXT/g'|pbcopy
Return to Xcode window, press paste
Since the original should still be selected, it will just be replaced. You could probably build a simple shell script to do this.
Doug
An few images to supplement the chosen answer:
And holding down Option:
See also
Find/Replace in Xcode using Regular Expressions
Seems like missing functionality. You should file a bug report.
I'm upset that they took out this functionality, as I used it constantly, but here's my workaround. Copy your selected text from Xcode4 to TextEdit or some other word processor, do the find and replace there, and then copy the results back into Xcode.
It's not sexy but it's worth it if you do a lot of these "find and replace on my selection", and you leave the word processor open in Spaces as you work.
They should add "my selection" as an alternative to "workspace" and "my scope".
There is another way only replace the matches you find, rather than just this one or all of them.
I suggest you save a copy first, just in case....
In Find and Replace, Show Find Options (you can do this by pressing the magnifying glass).
Press Preview.
Uncheck all the ones you don't want replacing.
Press Replace
Hope that helps, it did me.
Not ideal, but not too bad:
Do a find and replace in workspace (cmd-opt-shift-f) enter your desired find/replace
Enter your desired search term and hit return
Select the range of replacements from the list of matches on the left
Hit replace (not replace all)
To replace text in a selection using Xcode 9
Press Option-Command-F to bring up the find/replace box.
Enter the search and replace string. Changing the search string will lose any existing selection, so..
Make your selection (again). (If you don't do this, the selection will be the first search string found only)
Hold down the key and "Replace All" will change to "Replace Selection", then click it.
Once you understand that you make your selection AFTER you have entered the search string, then this is not that clumbersome and works fine.
I find alt-command-f easier for local find and replace (4.3) and then working around your selection.
EthenA.Wilson asked in a comment to the OP a couple of days ago:
"Is there a way to do this in Xcode 5?"
For the benefit of those who, like me, had been searching for it, here's how:
After you put your Find and Replace terms in the bars at the top left-hand side of the editor page, select the text you want to search in, then look at the top right-hand side (same bar). You'll see where it says "All", right next to "Replace." Now press the Option key. "All" will change to "All in Selection." Click it, and you're done. Could be a bit more intuitive, but the functionality is there in Xcode 5.
Naturally, good idea to take a snapshot before you click!
HTH!
Not sure which feature prior to Xcode 4 you're referring to, but the shortcut Command+Shift+E gives you "Use Selection for Replace". If you're talking about "Find and Replace in Workspace" (Command+Option+Shift+F), then what you need to do is run your find and then hold down "Shift" or "Command" on the selections shown and then hit "Replace".

Textmate tab and de-tab selected block

Recently switched to Textmate on Mac for coding. On PC when ever I want to tab in or out a block of code I just highlight and press tab or shift+tab to move it in our out. It's very useful when you are adding an extra loop or conditional statement to a block of code to keep everything tidy and neatly indented.
On Textmate however when I try this it just replaces my selected text with a tab. So is there a way to do tab and de-tab lines of code in textmate?
Indent: Alt+Tab
Un-Indent: Shift+Alt+Tab
the hotkey is command-left bracket to move left and command-right bracket to move right
(the buttons next to 'p')
heres a link to more hotkeys and such
http://projects.serenity.de/textmate/tutorials/basics/
You can use Shift+Tab to decrease indent; You just need to make and assign a macro. You can reuse this technique to accomplish a great many things.
Enter some text, and intend them, this is mostly for feedback.
Click the Record Macro Button
Use ⇧+⌥+⇥ (aka; Shift + Option + Tab) to decrease the indentation.
Click the record button to stop recording the macro.
Use the Edit menu or ⌃+⌘+M to save your macro;
Saving will prompt you to create a new bundle*, or add your macro to an existing bundle.
Add a Key Equivalent by clicking in the field and pressing ⇧+⇥
Your bundle-macro should look like the one below, simply Save and you're done! TextMate will now decrease indent on ⇧+⇥
*: (as noted by u/PatrickT) Sadly the create new bundle functionality has not yet been implemented, and you must choose to add to an existing bundle. You can still create a bundle via Bundles -> Edit Bundles then Command + N.
As an alternative, you can change the keybindings, see Link
Here is what I did:
Install Link
Go to File -> Open -> User Key Bindings, this will create/edit ~/Libary/KeyBindings/DefaultKeyBinding.dict
Add a binding, for the action enter shiftRight: (indent) manually (this is a TextMate specific action and not in the pre-populated actions list)
Choose a shortcut, I used cmd+alt+right
Do the same for the action shiftLeft: (un-indent, I used cmd+alt+left)
Save and then restart TextMate
I used a shortcut with arrow keys as my right hand is already on the arrow keys when I am selecting multiple lines, so this is a good fit.
The reason why I did it was because I have a german keyboard and alt+tab/alt+shift+tab don't work for me since I am using Witch for app-switching using these exact shortcuts.
EDIT: cmd+alt+left/right don't work when you have multiple tabs open, as they are used for navigate to next or previous tab in TextMate... seems this cannot be changed or overridden (I tried Setting Shortcut Keys in Textmate). Looking for an alternative shortcut now.

Xcode auto-completion - replace text keystroke?

Say we have a TestClass with the 2 methods, -getSomeString and -getAnotherString, and we are editing the following code and the cursor is in the location shown:
NSString *aString = [TestClass get<cursorIsHere>SomeString];
Say I want to change it to use -getAnotherString. If I bring up the auto-completion popup and select the other method via hitting enter or tab, I'm left with:
NSString *aString = [TestClass getAnotherStringSomeString];
i.e., it doesn't replace the existing text but rather just inserts.
Is there a special keystroke to make it replace the remaining text?
See IntelliJ for reference.
I don't think that there is a one step operation to achieve this. My suggestion would be similar to Thomas Templemann, but rather than two steps of forward word select and then Delete, I would expand to the desired autocomplete, by bouncing on Control + . and then hit Option + forward delete, which kills to the end of the word.
I don't think so. I have always used the following
double click on getSomeString
press Escape (or your autocomplete key)
find replacement method
that double click step has never really bothered me, but I would be interested if anyone knows better!
My work-around for this problem is this: Since the cursor will be right after the inserted text, I just press Shift-Option-Rightcursor, which selects the word past the cursor, then I hit the Delete key.
You can use the Tab key to perform "replace" instead of "insert" when choosing the method from the auto-complete popup in IntelliJ 9 (don't know if it's available in previous versions).

Resources