Map Alt-j to <Esc><j> in IdeaVim - vim

I am now really used to send escape to Vim in my terminals using the Alt(Meta) key + a movement (like 'j'). Using any "Vim plugin" in IDEs becomes a pain, because they usually do not forward the alt keypress to the emulator plugin.
For example, I cannot obtain this behavior in IdeaVim.
I tried to :map <A-j> <Esc><j>, and also to edit the keymaps for IdeaVim in File->Settings without any success.
Does someone know if this is possible ?

As of IdeaVim 0.33 (released 2014-04-28), key mappings in ~/.vimrc are now supported.
Release announcement
VIM-288
(Note: This question could probably be considered a duplicate of this other StackOverflow question.)

:map, :vmap, and the like are not currrently supported by IdeaVim. However you can vote for them to be implemented in the IdeaVim Bugtracker.
If you want this behaviour now you could use AutoHotKey and the following line:
; Remap <A-j> to <Esc><j>
!j::Send {Escape}{j}
Note that this will remap the keys everywhere not just in vim

ideavim Mappings are only supported at a very basical level. Like map j h. I tried mapping jj to and it didn't work myself, awhile ago. It seems the multi-letter keystrokes don't work in insert mode. Which kind of makes sense as this is emulating vim, and it has to go through, and abide by the key event API of a CUA.

Related

Is there a way to alias vim navigation keys? [duplicate]

After attempting to use vim a number of times, I'm always been put off by its default key bindings. After some research, I decided to remap the default keys to more sane ones (at least for my tastes). I have a few questions about changing bindings that I could not find answers to through Google.
Is there a way to map a key to an action rather than another key. For example:
:noremap a h
will bind the a key to move the cursor left. Is there something along the lines of
:noremap a move-cursor-left
or
:noremap a :move-cursor-left<Enter>
so I can read my config file afterwards?
Is there a way to unbind all of the default key bindings? I've tried :mapclear but it doesn't seem to work, although it might just be clearing non-default bindings. Unmapping every key manually is not an option. If possible, I would like to export the defaults to a file so I can edit them as I need.
Is there another language I can use to write my own commands for vim other than vim-script? I haven't actually looked into this one so much though. If I can bind an external executable to a command, that would be good enough.
I haven't given up on vim although I would like to ask if there are any vim-like alternatives out there. My Google searches came up with nothing actively developed. If the above cannot be done, or reasonably hacked together, I would like to find a fully configurable, modal, command line text editor that can.
The command set of vi / Vim has 40 years of wisdom encoded into it; completely changing it is a bad idea. I can only repeat the reference to this answer from the comments; that should convince you (to accept this, or choose another editor).
Give the default commands another try. It'll take some time to get used to, but most Vim users swear by these. It's fine to make minor adjustments "for personal style": careful evolution, but not revolution. Also, some people with odd keyboard layouts (like Dvorak or Colemak) swap several keys for convenience.
The move-cursor-left is just h; aided by the excellent :help, you should be able to "read" your remappings just fine.
In general, even though it's possible to write extensions / plugins in integrated languages like Perl, Python, Ruby, etc. (based on support for them compiled into the Vim binary), you won't get around learning some key Vim internals and parts of Vimscript. If you don't feel comfortable at all about this, I'd suggest to use another editor. Unfortunately, with your requirements of full extensibility (and probably broad acceptance and platform support), there's only one serious alternative: Emacs (which cannot only be turned into everything but a kitchen sink, but also into a modal editor, too).
(i know this question is old)
you can reset the binds by just over-writing them
on vim you can use many <things> (idk the name)
e.g.
<Up> = Up-arrow-key
<C-f> = Ctrl, f
<A-Down> = Alt, Down-arrow-key
<Esc> = Escape-key
it's possible to remap the hjkl keys to wasd like this:
nmap w <Up>
nmap a <Left>
nmap s <Down>
nmap d <Right>

Use Emac keys while in insert mode?

Using all of Vim, Xvim(for Xcode) and Ideavim(for IntelliJ), I'd like to be able to use the default keybindings while in insert mode rather than Vims. I've been using Xcode for quite some time now and have gotten quite good at typing with the standard Xcode bindings but Vim bindings are so much better while not in insert mode.
I know you can do .vimrc settings such as
:im <C-D> <esc>xa
to emulate these functions, but this still leaves problems with slightly different behaviors as well as losing functionality where these commands have multiple uses. IE ctrl+n is both down while typing and next while scrolling through autocompletions. Custom bindings in .vimrc removes the ability to scroll through autocompletions.
Using
:im <C-N> <NOP>
enables scrolling through autocompletions but still doesn't let it function as down.
Anybody know how to solve this?
If you really want to, you can put
nnoremap i :action VimPluginToggle<CR>
into your ~/.ideavimrc, then in Preferences => Keymap, find the Vim Emulator item and assign the shortcut ESC to it. This when instead of entering insert mode, you'll be disabling IdeaVim, and hitting ESC will re-enable it.
I tested this briefly and it does seem to work at least at a superficial level, although you lose the changing caret style as an indicator of which mode you're in. I'm not sure that's a good idea, however. Probably better to work within the system as designed and set up the bindings you want.

Changing default key bindings in vim

After attempting to use vim a number of times, I'm always been put off by its default key bindings. After some research, I decided to remap the default keys to more sane ones (at least for my tastes). I have a few questions about changing bindings that I could not find answers to through Google.
Is there a way to map a key to an action rather than another key. For example:
:noremap a h
will bind the a key to move the cursor left. Is there something along the lines of
:noremap a move-cursor-left
or
:noremap a :move-cursor-left<Enter>
so I can read my config file afterwards?
Is there a way to unbind all of the default key bindings? I've tried :mapclear but it doesn't seem to work, although it might just be clearing non-default bindings. Unmapping every key manually is not an option. If possible, I would like to export the defaults to a file so I can edit them as I need.
Is there another language I can use to write my own commands for vim other than vim-script? I haven't actually looked into this one so much though. If I can bind an external executable to a command, that would be good enough.
I haven't given up on vim although I would like to ask if there are any vim-like alternatives out there. My Google searches came up with nothing actively developed. If the above cannot be done, or reasonably hacked together, I would like to find a fully configurable, modal, command line text editor that can.
The command set of vi / Vim has 40 years of wisdom encoded into it; completely changing it is a bad idea. I can only repeat the reference to this answer from the comments; that should convince you (to accept this, or choose another editor).
Give the default commands another try. It'll take some time to get used to, but most Vim users swear by these. It's fine to make minor adjustments "for personal style": careful evolution, but not revolution. Also, some people with odd keyboard layouts (like Dvorak or Colemak) swap several keys for convenience.
The move-cursor-left is just h; aided by the excellent :help, you should be able to "read" your remappings just fine.
In general, even though it's possible to write extensions / plugins in integrated languages like Perl, Python, Ruby, etc. (based on support for them compiled into the Vim binary), you won't get around learning some key Vim internals and parts of Vimscript. If you don't feel comfortable at all about this, I'd suggest to use another editor. Unfortunately, with your requirements of full extensibility (and probably broad acceptance and platform support), there's only one serious alternative: Emacs (which cannot only be turned into everything but a kitchen sink, but also into a modal editor, too).
(i know this question is old)
you can reset the binds by just over-writing them
on vim you can use many <things> (idk the name)
e.g.
<Up> = Up-arrow-key
<C-f> = Ctrl, f
<A-Down> = Alt, Down-arrow-key
<Esc> = Escape-key
it's possible to remap the hjkl keys to wasd like this:
nmap w <Up>
nmap a <Left>
nmap s <Down>
nmap d <Right>

How do i comment/uncomment with macvim

How do you comment and uncomment out a code block with janus macvim
The janus documentation for nerdcommenter says that binding is
Janus binds command-/ (`<D-/>`) to toggle comments
What does that mean in keystrokes...my leader key is the comma
UPDATE
After reading the nerdcommenter doc it seems like that might not be what i need to comment...any ideas
It just means pressing keys ⌘/.
The Cmd key (or Apple key on old keyboards) is represented in MacVim as <D>.
That key can only be seen by MacVim in "GUI mode". This means that, like with a lot of crap in Janus and other distributions, you end up learning someone else's crappy non-portable mappings instead of your own cross-platform mappings.
The <D-key> notation means exactly the same thing as the usual Cmd+key so <D-/> is the same as Cmd+/: press the Cmd key, press the / key and release both at the same time. Like in TextMate.
NERDCommenter is a popular commenter plugin. Why the Janus maintainers chose it over other plugins is unknown but it works well.
Press the Command (⌘) and forward slash (/) keys simultaneously. You can prefix this with a modifier (e.g. number of lines) for more complicated effects.

Vim langmap breaks plugin (bépo)

I am using a bépo keymap (http://bepo.fr) and seeking the perfect vim mapping.
So far I used a long list of noremap, but for many binding (for exemple, the motion aw or Ctrl+r), the first keystroke is well remaped but not the others, I reckon it's the expected behaviour, but then this is not what I need.
Ideally I would have my keyboard totally remaped in a higher level (before the map commands) except when typing text (in insertion mode and when typing a substitution for exemple). What I'm looking for seems to be langmap, but I have problems using it.
I added this langmap to my .vimrc, It seems perfect but it broke some of my plugins. SuperTab now insert <Plug>SuperTabForward when pressing Tab in insertion mode, I have t<SNR>24_SelectCompletion(1) when pressing enter.
Does someone know how to fix this langmap issue or a better way to remap my keyboard?
This is a known bug, that has been discussed before. I have made a patch (see the thread starting here) and hopefully Bram will include this change soon.
Update 11/05/2014
This has been fixed by patch 7.4.502. Use the langnoremap option to fix this.

Resources