AlexPl292 / IdeaVim-EasyMotion

EasyMotion emulation plugin for IdeaVim

Home Page:https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use EasyMotion commands as arguments not working as expected

technoplato opened this issue · comments

Hey, awesome plugin! Thank you very much.

I think I might be doing something wrong with my mapping that's causing a bug.

Picture is worth 1,000 words

ios

I have these two EasyMotion mappings in my .ideavimrc:

" Jump to anywhere with only `f{char}{target}`
" `f<CR>` repeat last find motion.
nmap f <Plug>(easymotion-s)
" Bidirectional & within line 't' motion
omap t <Plug>(easymotion-bd-tl)

I expect than when I press df that then the yellow targets will show, I can type one, hit and then the text designated by my search will be deleted.

Instead, I have to press d<leader>f and then after I enter the destination of my target and press , everything between my cursor and the destination is modified.

Can you help me figure this out?

Entire .ideavimrc if relevant
" source ~/.vimrc

let mapleader=" "

set multiple-cursors
set relativenumber
set number
set clipboard+=unnamed
set exchange
set surround
set incsearch
set easymotion

set hlsearch
set scrolloff=3
set ignorecase smartcase
set showmode
set history=1000

" Jump to anywhere with only `s{char}{target}`
" `s<CR>` repeat last find motion.
nmap f <Plug>(easymotion-s)
" Bidirectional & within line 't' motion
omap t <Plug>(easymotion-bd-tl)

" easy system clipboard copy/paste
noremap <leader>y "*y
noremap <leader>Y "*Y
noremap <leader>p "*p
noremap <leader>P "*P

" clear the search buffer when hitting return
nnoremap <leader><cr> :nohlsearch<cr>

" options
nnoremap cow :action EditorToggleUseSoftWraps<cr>
nnoremap col :action EditorToggleShowWhitespaces<cr>

" actions
nnoremap <leader>q :action CloseContent<cr>
nnoremap <leader>Q :action ReopenClosedTab<cr>
nnoremap <leader>\ :action VimFilePrevious<cr>
nnoremap <leader>E :action SearchEverywhere<cr>
nnoremap <leader>e :action RecentFiles<cr>
nnoremap <leader>t :action FileStructurePopup<cr>
nnoremap <leader>T :action GotoSymbol<cr>
nnoremap <leader>a :action GotoAction<cr>
nnoremap <leader>b :action ToggleLineBreakpoint<cr>

" git
nnoremap <leader>fa :action GitFileActions<CR>

" code navigation
nnoremap <leader>] :action GotoImplementation<cr>
nnoremap <leader>[ :action GotoSuperMethod<cr>
nnoremap <leader>u :action FindUsages<cr>
nnoremap <leader>gt :action GotoTest<cr>
nnoremap <leader>k :action HighlightUsagesInFile<cr>
nnoremap \r :action RunClass<cr>
nnoremap \R :action Run<cr>
nnoremap \d :action DebugClass<cr>
nnoremap \D :action Debug<cr>
nnoremap \c :action CheckStyleCurrentFileAction<cr>
" go to beginning of method
nnoremap <leader>bm [m
" go to end of method
nnoremap <leader>em ]m

" insert line above and below
map <Enter> o<ESC>k
map <S-Enter> O<ESC>j

" code refactoring
nnoremap <leader>cn :action RenameElement<cr>
" jump into parenthesis or brackets when change in triggered
nnoremap ci( f(ci(
nnoremap ci{ f{ci{


" built-in navigation to navigated items works better
nnoremap <c-o> :action Back<cr>
nnoremap <c-i> :action Forward<cr>
" but preserve ideavim defaults
nnoremap g<c-o> <c-o>
nnoremap g<c-i> <c-i>

" new swift file
nnoremap <leader>nsf :action NewSwiftFile<cr>
nnoremap <leader>ge :action ShowErrorDescription<cr>

map L $
map H ^

vmap <leader><leader> <ESC>
imap jk <ESC>

" add inside bracket - source: https://stackoverflow.com/questions/11865845/replace-last-occurrence-in-line
nnoremap <leader>aib /.*\zs}<CR>i,
# nnoremap <leader>aib /.*\zs}<CR>i,space

" place search results at top of screen - source: https://stackoverflow.com/a/45868037/2441420
nnoremap n nzt
nnoremap N Nzt
xnoremap n nzt
xnoremap N Nzt

nnoremap G Gzt

/.*\zs}
nnoremap <leader>s :action SelectAllOccurrences<CR>
map <leader>z :action ToggleDistractionFreeMode<CR>
nnoremap <leader>gh :action ShowErrorDescription<CR>
nnoremap <leader>rnf :action RenameFile<CR>
nnoremap <leader>cc :action CollapseRegion<CR>
nnoremap <leader>ec :action ExpandRegionRecursively<CR>





" source this file
nnoremap <leader>si :source ~/.ideavimrc<CR>

" react specific
" Zoom to render method and put it on the top of the screen
nnoremap <leader>rr /render()<CR>zt

" testing
map <leader>bb vim ~/.testvim

Hi!
df command doesn't work because you use nmap. This mapping works only for normal mode. You should use omap to make it work with d command: omap f <Plug>(easymotion-s). You write that the command works as d<leader>f instead, but I could not reproduce this behaviour. Could you please recheck it all with omap?

Also, you've attached a screenshot that seems to describe a different issue. What keys do you press to reproduce this issue? I guess it also doesn't work because of nmap instead of vmap.

Actually, you can replace your nmap with a single map. In this case it would work for all described cases.

Sorry for the confusing description. Let me try again: https://www.youtube.com/watch?v=82Joq4Nw35A&feature=youtu.be

I've made the changes you suggest in my ~/.ideavimrc and I'm still having an issue where everything between the cursor and destination is altered. Please let me know if this video doesn't make the issue clearer.

Just wanted to pop in and note that I was holding shift (as the letters indicated were capitalized) and I was therefore highlighting from the current position. Typing the letters without holding shift resolves this issue and I feel dumb. Thanks for an awesome port!