When you write eg. console.log("whatevs") and your cursor is placed before ") I want to bind a key-combination to add ; and then return.
Yeah, u can make a macro to achieve this, or a snippet for console log with right placed tabs.
But if this is python and i want to add : or some other language?
So i started to write a small plugin.
But I cant find out how to know what type of file I'm editing. Maybe i missed it in the documentation.
My question is: Is there already a plugin to achieve this, is there a more detailed documentation somwwhere or maybe someone knows about this and can get me on the right track.
https://github.com/LewisW/SublimeAutoSemiColon Is almost what you want. It makes it so if your cursor is between the () and you press ; it will auto jump to the end of the line and add it there.
You could check out the source for that too for a base to work off to create exactly what you want.
Related
I really like the multiple cursor option in vs code.
With the mouse I can just Alt + Click any line I want to add a cursor to that specific line.
My question is if there is a way to do this with the key board? I have tried selecting current line and Ctrl + G to go to a specific line number, but then I lose my initial selection. I would like to have a cursor on the current line plus any line I choose at same time without using the mouse.
Does anyone know if this is possible? I tried a quick google search and searching here in SO, didn't see anything for this specifically.
Any help much appreciated!
With the extension Select By you can modify a Multi Cursor with the keyboard.
I'm a complete newbie when it comes to emacs. I recently installed Doom emacs and I've been really enjoying it. One thing that I'm struggling to find out is how do I quickly access/select on of the actions that are given to me by lsp-mode (I assume it's lsp-ui). I've attached a screenshot - the actions that I'm referring to are on the right-hand side.
Quick side questions:
When I jump to definition (spc-c-d) how do I jump back? Do I just kill the buffer?
Using ivy, how can I easily go through the list? - using control-n is a bit hard
You can come back to the previous buffer using CTRL+O
You can go down or up in the list using CTRL+j or CTRL+k
There are some tricks to get the answer:
first, try to find the action or function you know.
example 1. "M-x action-you-want-to-know"
example 2. "C-h k then-type-the-shortcut-key-you-want-to-search"
second, try to get the answer from project issues
The answer to your question:
1: press "C-o" jump backward
2: Try to input multi keywords in your search field to narrow down the search scope, just like increment search.
If you get too many lines after ivy-search some keyword you input, that means you donot know what you want to search, right?
When editing an HTML file, if the cursor is on an opening tag, the matching tag is highlighted in the editor. I would like to be able to map a key combination like alt+→ (or something) to go to the closing tag. I looked for an existing action like this in tools->options->keymap, but did not find one, so I decided to try to create a macro for it. I have found that I can do it in multiple steps like this: ctrl+/ (fold code), →, ctrl+* (unfold code). I recorded a macro of this, and it produced this code:
collapse-fold-tree caret-forward expand-fold-tree
Unfortunately, when I run the macro, the cursor stays in the same place, rather than ending up at the end of the closing tag like it does when I do the steps manually. I have successfully created a macro that moves from the closing tag to the opening tag with:
collapse-fold-tree expand-fold-tree
but I cannot get the forward one working. I am also having a bad feeling that I just overlooked the action in the keymap settings and am now trying to reinvent that wheel. Is this an action that is already there? And if not, does anyone know how I might get the macro to work?
There is an existing action in the keymap for this. It is called "Insertion Point to Matching Brace". The shortcut is ctrl + [ or command +[ in Mac.
There is also shortcut Ctrl + Shift + [, which selects content inside this tag.
I'm playing around a bit with DrRacket in the BSL language.
When I'm trying to create a comment like so:
;; Hi(10, 50]
The program fails in the moment when typing the ]. I can only end it via TaskManager. It uses 13 CPU in the TM.
Has anyone of you a solution for that? or is it simply not to use ].
Thank you
This is some bug that was reported several times recently, and there's no fix, yet. It's probably a result of some non-english keyboard layout (which was the case in these reports). Hopefully it will get fixed soon...
UPDATE: The bug was fixed for the next release, but in the meanwhile Matthew posted some instructions on how to do a temporary fix -- repeated here for reference:
We have tracked down a problem that occurs when the AltGr key is needed
to type ].
DrRacket gets stuck due to a bad implementation of an operation that is
intended to be bound to Alt-]. For most of you, though, the problem is
that you didn't want the Alt-] keybinding at all; you're just trying to
type ], and it's misinterpreted as Alt-].
You can work around the problem by placing the five lines at the end of
this message in a file, and then selecting the file via the
Edit -> Keybindings -> Add User-defined Keybindings...
menu item in DrRacket. Typing ] should work immediately after, and
typing [ will also give you just [ (instead of [ and ]).
Beware that after you select the file, it will be difficult to unselect
it. It turns out the the menu item to un-select a keybindings file is
also buggy! Your best bet is to put the file in a place that it can
stay. (You can still edit the file and restart DrRacket if you just
want to drop the bindings.)
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>.