I am using PhpStorm 7.1.2 with IdeaVim plugin.
When in Insert mode, I want to select words using Shift + ArrowKey
. However, this IdeaVim plugin seems to be preventing from doing that. I can only highlight the words in Command mode using v
key.
shift+Home/End/PageDown/PageUp
or shift+ctrl+arrowKeys
all do not work properly.
I tried changing shortcuts (i.e. Select to Right => shift+right) in Keymap setting but did not work.
Is there any way I can achieve this non-vim behavior?
UPDATE 1
There is a ticket opened in their bug tracking system without any fix. So I guess I can't do what I described above.
UPDATE 2 (11/14/2019)
From this last comment in that bug ticket, ideaVim now supports this shift+arrowKeys selections. I moved away from intellij to pure vim few years after asking this question so I won't be trying this out but wanted to just update this question for completeness. And saw @citizenmatt's answer after writing this update so see @citizenmatt's answer below for more details on this.
I would create a ~/.ideavimrc
with the following lines
nmap <S-Up> v<Up>
nmap <S-Down> v<Down>
nmap <S-Left> v<Left>
nmap <S-Right> v<Right>
vmap <S-Up> <Up>
vmap <S-Down> <Down>
vmap <S-Left> <Left>
vmap <S-Right> <Right>
imap <S-Up> <Esc>v<Up>
imap <S-Down> <Esc>v<Down>
imap <S-Left> <Esc>v<Left>
imap <S-Right> <Esc>v<Right>
It makes my code select text in the same way.
create ~/.ideavimrc file with the following lines
nnoremap <S-Left> :action EditorLeftWithSelection<CR>
nnoremap <S-Right> :action EditorRightWithSelection<CR>
nnoremap <S-Up> :action EditorUpWithSelection<CR>
nnoremap <S-Down> :action EditorDownWithSelection<CR>
inoremap <S-Left> <C-O>:action EditorLeftWithSelection<CR>
inoremap <S-Right> <C-O>:action EditorRightWithSelection<CR>
inoremap <S-Up> <C-O>:action EditorUpWithSelection<CR>
inoremap <S-Down> <C-O>:action EditorDownWithSelection<CR>
It appears to not be possible out of the box. However, it is not hard to hack the plugin to remove the hard-coded vim actions for shift + arrow keys, as long as you have ideavim. This has the effect of letting the default behaviours be used.
Steps:
git clone https://github.com/JetBrains/ideavim.git
ideavim/src/com/maddyhome/idea/vim/RegisterActions.java
.:s%/^.*KeyEvent.VK_\(KP_\)\?\(LEFT\|RIGHT\|UP\|DOWN\), KeyEvent.SHIFT_MASK.*$//
.clean compile dist
.ideavim/out/dist/ideavim-xx-dev.zip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With