Collapsing code sections is nice. But everytime I select the collapsed part in the editor and cut/delete it the selection expands and I have to find the start/end manually in the expanded code.
Is there an easier way?
Many thanks!
When your cursor is inside the element you can use Select Enclosing Element Shift+Alt+Up. You may need to press it a few times, depending how many levels of enclosing elements there are (blocks like loops).
You may use a desktop environment that thinks it is a good idea to define a few hundred shortcuts that you will never use but that override all your application shortcuts (Ubuntu Unity). In this case you may need to change your desktop environment (by far the most painless way to solve this problem).
Using Neon
Collapse the code
Double click the collapsed code
Hit ctrl-x or the Delete key.
Hitting Backspace or the Enter key still just expands the collapsed code
Related
I want to map two dot/period key presses to Tab key in AutoHotkey script. I tried to map similarly as its shown for remapping semicolon key - on AutoHotkey forums, but it doesn't work. I tried following:
1. `..`::Tab
2. ..::Tab
AutoHotkey gives an error
.
I tried searching on AutoHotkey Remap docs, but couldn't figure it out. The period key is the one with the greater than mark and not the number keypad period key. See this: Dot/period key
Addition info/context in response to reply by user 0x464e:
Basically, I am trying to expand Emmet style abbreviations in devtools style sub-panel since the chrome devtools team wont implement it.
I am not a fast typist, so it's a pain to type complete property names. For example, if I want to type margin-top, (see the image), Chrome autocomplete brings up margin, margin-block margin-block-end etc.
Now, for margin-top, you need to at least type margin-t to get the autocomplete to show that property.
This is the case for many very common CSS properties like margins, paddings, etc., so autocomplete isn't great.
On the other hand, if I just type mt and have Autohotkey expand to margin-top, it's much much faster, saves me much time and keeps me sane.
Basically, I have setup some hotstring in .ahk script and they work too.
However, if I press mt followed by a Tab key press, Chrome's autocomplete takes over and hotstring fails, (try once to see the problem). Instead, currently I press spacebar, or . (period) to trigger the hotstring. It works, but the problem is it leaves a space or a dot with the expanded text. [see this].
So, that's the actual reason I wanted a double period key trigger to replace Tab.
It would be great if the hotstring trigger would work with a double period key, but doesn't leave the trigger character itself and then have send Tab so as to jump to the value input of the just expanded property.
You're not really looking for a traditional remap, which is why you didn't find it from the documentation.
Remapping is just simply remapping one key to another, but you're not trying to do that. You're trying to make some action do another action.
Anyway, what you're asking is doable, but there's loads of different ways it can be achieved with difficulties varying from simple to extremely advanced & complicated.
You'll need to specify things more clearly before this can be answered properly.
Biggest questions that pop into my head right away are at least:
Should this work everywhere, or just in text input fields?
How should the original functionality of . be preserved, if at all.
(What should happen after the initial . keypress?)
Should there be some timeout between the keypresses?
Etc, this is just what I could think of right away, but surely there's more.
Anyway, for now I can give a simple implementation with a hotstring:
:*?:..::{Tab}
So this is a hotstring with the * and ? options.
I'm guessing these would probably be pretty good options for this.
So what this does, is it presses backspace twice and sends a Tab if you type ...
This should be fine for text editors, but it leaves much to be desired (the points I listed above aren't considered since I can't know what you're looking for. This is just what a default simple hotstring can offer).
Looks to me like you don't actually want the additional mapping of .. to Tab, but instead just want to update your existing hotstrings to activate immediately (without waiting for an EndChar) when the hotstring is followed by ..
Normally, you might look to the Ending Characters option to create this functionality, but since you want multiple characters to trigger this, we need to look to other options.
I will be using the example of ::mt::margin-top for my sample implementation. Extend any changes I make to these to the rest of your hotstrings in the script you screenshotted.
Here are the changes I am making to this example:
Add your .. to the end of each of your hotstrings triggers. For example ::mt::margin-top becomes ::mt..::margin-top. However, at this present, this still requires some sort of ending character to be pressed in order to proc. Let's fix that in the next step
Add the Asterisk Modifier to the hotstring. From the docs:
* (asterisk): An ending character (e.g. Space, ., or Enter) is not required to trigger the hotstring.
Final code for ::mt::margin-top example:
:*:mt..::margin-top
And extend this * insertion and .. appendation to each of your hotstrings.
Hope this helped! Lmk if you need any more help or changes.
Let's suppose I have the following code:
But I change my mind and I don't want to call it plan anymore. I want to call it schedule. So, because VS Code is so amazing and I'm so lazy, I press Ctrl + D hoping for VS Code to change the name respecting the case. But suddenly:
Is it there any way to tell VS Code to respect the case?
With 1.37 (July 2019), it is possible through a find/replace (which now can replace by preserving case).
Issue 9798 has been implemented by PR 78003.
issue 78397 has been implemented by PR 79111 (1.38 only) for search/replace.
From 1.37 release notes:
You can now preserve case when doing replacement in the editor's Find widget. The feature is turned on when the Preserve Case option (AB button) is turned on in the editor's Replace input box.
Currently VS Code only supports preserve Full Upper Case, Full Lower Case, and Title Case.
Shortcuts are Alt + C for case sensitive. There is a little toolbar appears at the top-right corner of the VS Code, to let you toggle search options.
or you just Ctrl + F to toggle replace mode.
The v1.38 release in early September will extend the Preserve Case functionality to replacements while searching across files using the Search Panel. See add Preserve Case to Searches (all files).
.
There is also a new case preservation mode for hyphen-separated words.
v1.39 is adding preserve case for _underscore separated words. Like foo_bar.
See https://github.com/microsoft/vscode/pull/79660
If you want to achieve this without using the find/replace menu, there is an extension which solves your problem: https://marketplace.visualstudio.com/items?itemName=Cardinal90.multi-cursor-case-preserve
As far as I know it isn't, a workaround could be using the buttons that appear on top right after you press Ctrl + D. The second lets you select occurrences respecting the case, this way you could replace the text in 2 steps, first Plan and then plan.
So select the code bit, ctrl+h to open replace, edit find and replace, turn off match case in find, turn on preserve case within replace, Alt+L to find all occurences in selection, and Ctrl+Alt+Enter to execute.
9/10 cases you'll get it wrong, doesn't worth the effort. Just use ctr+d, then do the same for the uppercase.
Personally looking forward for a simpler/safer solution through the ctrl+d way. :)
In eclipse you can hit "enter" and the IDE will automatically take you to the end of the line and place a semicolon.
In IntelliJ, if you hit shift-enter you get similar behavior minus adding the semicolon. I have read and tried cntrl-shift-enter and you get the exact same behavior. However, that is such an awkward key combination to be using all the time, at least much more so than the one-button approach using Eclipse.
Any ideas?
IntelliJ autocomplete escape
In InteiJ IDEA use (Ctrl-Shift-Enter) for "Smart Autocomplete".
It will end the line "smartly" with a semicolon as you wish. It also works in a few different situations like IF statements of FOR loops.
Why don't you redo the key binding?
Go to: (spanner icon) Settings -> Keymap -> Complete Current Statement and rebind how you will (for example, ctrl-enter might suit you better).
Or there's also a default keymap set for Eclipse that you can choose. I'm not sure if it affects the complete-current-line action, but you could take a look.
you can also use ctrl+shift+space
if you want always have it just do this
I have some kind of weird behavior in Netbeans. I guess I accidentally entered some key combination which messed up the cursor and selection behavior. In the image you'll see what I mean: normally, if you select text across multiple lines, you'll see the behavior on the right screenshot.
But I have the behavior on the left screenshot. Also, trying to insert text at a certain position with Shift, inserts it some positions to the right (= not where the cursor is). Additionally, when the cursor blinks, it appears dashed.
The fact that the selection in the left screenshot is drawn nicely doesn't make me think of a bug, but rather of a feature. I can't seem to find the key combination to turn it off again.
So my question is, what is this feature? Why does it exist and with what key combination did I turn it on?
One possibility is you have the Rectangular Selection plugin installed.
However, the more likely candidate is the rectangular selection feature in the editor core. Find the button on your edit toolbar, and toggle it off. As per helpful comments below, this can accidentally be switched on (and toggled back off again) using:
On Windows and Linux: Ctrl + Shift + R
On Mac: Shift + Meta + R
On Mac, if the above does not work: some folks have reported that Shift + Command + R worked for them
This key combination (Ctrl+Shift+R) is used to open types etc. in Eclipse, so when switching to Netbeans many people will get stuck with this.
When we're using ctags in vim and want to go to particular definition of variable or function we press ctrl + ], when we want to go back we press ctrl + T.
When we want to autocomplete a name of a variable we press ctrl + N and from a little violet window we can choose the right word.
Is it possible to improve go to definition so that we won't jump in the document, but only the little window with the function or variable definition will appear?
thank you
You want a way to see the function's signature without actually jumping to its definition?
I know about two plugins supposed to provide exactly this feature:
EchoFunc,
Tag Signature Balloons
The last time I tried echofunc it didn't work for JavaScript, at least for me, but it worked well for the few PHP files I've tested it with. I didn't try the other one because it's GVim-only and I use the CLI version almost as often as the GUI version.
But you can also use TagList and/or TagBar: two very useful plugins providing great code navigation based on ctags. Both will display the signature of the tag under your cursor if you hit <Space>.