Skip to content

Line Motion Invalid argument -1 #484

Open
timsu92/vim-easymotion
#2
@Nealium

Description

@Nealium

Using the (leader)j or (leader)k sometimes breaks. More than likely it's due to me upgrading to Vim 9.0, my odd tabbing of JQuery objects and the folding
I've provided a js file snippet at the bottom, from the last time I ran into the error, I just trimmed the fat a bit.

Error Message

EasyMotion: Vim(call):E475: Invalid argument: -1 : function EasyMotion#jk[5]..<SNR>63_EasyMotion, line 109

System

field value
os Windows 10 Pro 21H1
vim Vim 9.0 2022 Jun 28
locale C.UTF-8
easymotion * b3cfab2*
  • Note: only started when upgraded

Min Vimrc

set wrap
set linebreak
set breakindent
filetype indent on

set autoindent
set smartindent
set expandtab

au BufNewFile,BufRead *
    \ set tabstop=2 |
    \ set softtabstop=2 |
    \ set shiftwidth=2

set foldmethod=indent
set foldlevel=99

set nocompatible
filetype plugin on
syntax on

" EasyMotion: https://github.com/easymotion/vim-easymotion
let g:EasyMotion_do_mapping = 0 " Disable default mappings

"   Jumps:
nmap <Leader>s <Plug>(easymotion-overwin-f)

let g:EasyMotion_smartcase = 1

" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)

Recreating

  • I've created a condensed js file, that's raising the error always after follow steps:
  1. Fold line 19 ( :19 + za )
  2. Goto Line 15 and hit (leader)j (:15 \j)
  • it's not specifically on line 15, it's the area, but that's what I originally hit
  • Note: \k works from this area, but sometimes it's flipped \k is broken and \j works
$(document).ready(function() {
  if (blah.exists){
    $('#submit').click(function(){
      $.ajax({
        method: 'post',
        url: '/form_submit’,
        data: {},
        success: function(data){
          if (data['status']){
            $('<tr></tr>')
              .append(
                $('<th></th>')
                  .append(
                    $('<input></input>')
                      .addClass('buglocation') // \j on this line
                  )
              )
              .append(
                $('<th></th>') // fold right here
                  .append(
                    $('<input></input>')
                  )
              )
          }
        }
      });
    };
  };
});

Folded = Broken

image

Unfolded = works

image

edit: fixed missing quote in code block

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions