I have some shoulder pain that I am trying to get rid of by using vscodevim.
My biggest problem with vscodevim so far is that is sometimes collides with VS code shortcuts. For example I often save all my files with Ctrl+K S. But with vscodevim enables, instead that key combination does something else.
I feel tired about the prospect of having to build a configuration with my own key VS Code key bindings, that don't conflict with vsvim. I hope there is a better solution.
So I ask you, my better knowing colleagues, how do you solve this problem?
There is no easy way out for avoiding conflicts between vscode shortcut and vscodevim bindings. I suggest you to use vim keybindings instead of vscode shortcuts wherever possible. Vscodevim can prove to be a good gateway to vim provided you are open to relearning how you use vscode.
Instead of building your own configuration that doesn't collide with vscodevim you could redirect the effort in finding a way to do the same thing in vim. You can search web or use vim help.
Vim help is really comprehensive and easy to read. If you have vim installed you can use :help or :h followed by a specific subject, for example if you need to read about navigation type :h navigation.
Now you have two choices and I will try to use example you provided i.e. saving a file :
Use bindings available for saving file in vim.
Vim provides so many shortcuts just for saving and quitting files, in vim try :help write and :help quit to know more. Many of those shortcuts works in vscodevim too.
To save file :
:w to save a single file
:wa to write all buffers (in vscode all modified files).
Remove the bindings from vscodevim and use vscode shortcut.
You can delegate the key combination back to vscode. I suggest you do this only if there is any vscode shortcut that is absolutely necessary for you and it conflicts with vscodevim as doing this may result in some related vim bindings to not work. To know what Ctrl+k does in vim type :h ctrl-k in vim.
If you want to use Ctrl+K S for saving file do following:
Open vscode settings and search for vim handlekeys or directly open vscode's settings.json:
add following "vim.handleKeys": {"<C-k>": false}
I don't know if this a better solution but I was in your situation and tried different ways to solve it. Finally I found it was much easier to use vim keybindings than trying to coerce vscodevim.
I set up a "toggleVim" keybinding, like so: https://stackoverflow.com/a/61652769/1054322
When I want to use a hotkey that clashes with vim, I just turn off vim.
I installed "vscode neovim" instead of "vim".
Open the vscode setting, you can search "vscode-neovim: Use ctrl keys for insert Mode", disable it.
So you can use "ctrl k+ ctrl c" to add a line comment in insert mode. Also other vscode "ctrl" keys could be used in this mode.
Related
I have installed the vim extension in VS code. I like Vim's features but I don't want Vim to overwrite overwrite all my previous VS code key bindings which I felt comfortable.
I want to use vim though, but not completely. It'd be better if I could use the VS code commands as well. Something like Ctrl+K, Ctrl+O doesn't work while using Vim. And I feel that Ctrl+S is better to use than :wq. How can I make these(my existing) commands work while still using Vim?
I'm currently switching editors from Vim to VS Code. One feature I like in vim is the ability to run an external command on a region of text (the :! command). I've been unable to find an obvious equivalent in VS Code.
Is this feature available in VS Code? Or is there an extension that provides it?
(As a more general question, what's the best way of finding out things like this? Is there a website or anything that describes how to do common tasks from other editors in VS Code?)
For the record, VSCodeVim allows you to do the same thing.
Having searched some more (the key term is "filter the selection") I found the Filter Text extension, which does exactly what I want.
There are several vim clone packages for Emacs (Evil, Viper..). These packages have a special built in functionality where they remap the Escape key for tty users. I'm not sure how this is done (With a timeout?).
I'd like this functionality as well however I don't want to use the entire Evil / Viper package, I only want the Escape key functionality. This is because I use God Mode, basically Vim's normal / Insert mode with emacs keybindings instead. It doesn't however have a solution for the TTY Escape key like Evil / Viper do. My Elisp isn't really good enough to implement this myself.
So if there is a stand alone package for the escape key issue I'd love to hear about it.
This doesn't /really/ answer my question but I've found something nice that solves my problem.
Xcape is a tool that you can use change the behavior of a key. For example if you run this command:
xcape -e 'Control_L=Control_L|G'
When pressing Left Control and releasing right away, it will act as Control-G. If you hold down Control it will simply act as Control normally does.
Now if I remap C-g to active God-mode I get the expected behavior in the terminal as well. And you can change the keys to however you want.
As I said this doesn't really answer my question but it does solve the problem. So I'll just leave this answer for other people to find.
I'm just switching from Emacs to IDEA and it would be a great help to me if I could use shortcuts like Ctrl-A for jump-to-line-start. etc.
Is this possible?
Go to Settings -> IDE Settings -> Keymap and you will have all the keymappsing.
One of the Keymaps you can select from is Emacs.
A note from a long time Emacs and IDEA user - Emacs bindings in IDEA are simply mission impossible. Arthur is perfectly correct about how to enable them, but they will seriously tamper with your IDEA workflow since they tend to override a lot of default IDEA keybindings and in the end you have to come up with completely custom keymap. This is not a problem the first time - but when you have to work on some coworkers machines, or on other computers it becomes extremely annoying. I used to hold my keymap in Subversion.
So basically don't use the default Emacs keybinding in IDEA - copy the basic setup and extend it personally. The IDEA server might be helpful to keep several computers in sync with the same keybindings.
Also keep in mind that only basic navigational commands are supported in IDEA and some helpful IDEA actions may wind up without keybindings by default so pay extra attention how you configure your IDEA.
For me there is only like place like Emacs - and that's Emacs. I have yet to see some software that provides sensible settings using Emacs keybindings.
There's a useful article on this topic here.
The gist of what it says is
You can tweak keybindings, but it's a bandaid at best, lost cause really
You can do better by LivePlugin Scripting with Groovy
You can create an escape hatch to emacs using emacsclient
I am very familiar with emacs--and I realize that there is nothing that it cannot do--but there are some things that it does not do well or efficiently. So, being between projects I am open to the idea of switching to a full-featured IDE such as Eclipse.
With muscle-memory being what it is, I would like to make Eclipse as emacs-like as possible. I have already discovered the excellent Emacs+ plugin which gets me about halfway there. However, I am still missing the following features of emacs which I routinely rely upon:
shell: It's not just a shell, it's also a buffer.
occur: Search->File... is close to what I want, but I just want it to search the current file--which might be a text file, a logfile, or a shell buffer, or whatever.
align-regexp: This awesome little command in emacs helps me make files more readable, and alignment helps with keyboard macros.
What plugins would you recommend to solve these issues? Are there any other emacs features you miss in Eclipse or plugins you would recommend?
Please, no emacs/vi zealots asking why on Earth I would do such a thing.
For the shell you have WickedShell
Ctrl+F is enough to trigger a Search within the current file. (does not create a new buffer with matched lines)
Only Mark Occurrences is about highlighting occurrences, but that is not as advanced as the Emacs function.
Formatter options can emulate "align-regex" function, as described here.
Preferences -> Java -> Code Style -> Formatter.
Click 'Edit' on the profile (you may need to make a new one since you can't edit the default).
In the indentation section select 'Align fields with columns'.
Then, in your code Ctrl+Shift+F will run that formatter.
I can confirm Brian's suggestion (Emacs key-bindings). What I do to resolve this dilemma is to use both Emacs and Eclipse simultaneously. They are both very good at reporting external changes to files so there is minimal chance of tromping on edits (but it can happen). More to the point, you can leverage the strengths of both tools without having to give up either one. The combination of using both tools and Eclipse having Emacs key-bindings makes this quite satisfactory for me.
IIRC (It's been a while since I've used eclipse) eclipse has a "use Emacs key-bindings" mode. I believe that there's also the option to tell eclipse to use emacs as its own editor...