kana / vim-submode

Vim plugin: Create your own submodes
http://www.vim.org/scripts/script.php?script_id=2467
217 stars 24 forks source link

Doesn't work in Neovim? #32

Open hakunin opened 6 years ago

hakunin commented 6 years ago

Doesn't seem to work with neovim, not sure why.

$ nvim
Error detected while processing /Users/michal/.vim/init.vim:
line   73:
E117: Unknown function: submode#enter_with
line   74:
E117: Unknown function: submode#leave_with
line   77:
E117: Unknown function: submode#map
line   78:
E117: Unknown function: submode#map
line   79:

Tried installing both with "Plug" and "Plugin", both went fine.

netmana commented 5 years ago

I met the same question as @hakunin .

Neovim 0.4.0, firstly run PlugInstall, it works perfectly for resizing and splitting, but after quit and reopen nvim, it reports errors.This is my config:

Plug 'kana/vim-submode' call submode#enter_with('WindowsMode', 'n', '', ';') call submode#map('WindowsMode', 'n', '', 'j', '-') call submode#map('WindowsMode', 'n', '', 'k', '+') call submode#map('WindowsMode', 'n', '', 'h', '<') call submode#map('WindowsMode', 'n', '', 'l', '>') call submode#map('WindowsMode', 'n', '', 'L', ':vsp') call submode#map('WindowsMode', 'n', '', 'J', ':spl') let g:submode_keep_leaving_key=1 let g:submode_timeout=1 let g:submode_timeoutlen=1000

netmana commented 5 years ago

I just downloaded the raw submode.vim file and saved into autoload directory, it works now. @hakunin

huawenyu commented 3 years ago

Got the same issue as @hakunin. Even download the raw submode.vim into autoload directory, unluky for me. Then use another similar plugin nvim-libmodal, and config like the follow works:

     " Mode windows: Implement feature 'dstein64/vim-win'
          nnoremap <Leader>w :call <sid>windowsMode()<cr>

          let s:windowsModeRecurse = 0
          let s:windowsModeCombos = {
                      \   'j': 'wincmd j',
                      \   'k': 'wincmd k',
                      \   'h': 'wincmd h',
                      \   'l': 'wincmd l',
                      \   'H': '3 wincmd >',
                      \   'L': '3 wincmd <',
                      \   'J': '3 wincmd +',
                      \   'K': '3 wincmd -',
                      \   'r': 'wincmd r',
                      \   'x': 'wincmd x',
                      \}

          " define the BarMode() function which is called whenever the user presses 'z'
          function! s:windowsMode()
              let s:windowsModeRecurse += 1
              call libmodal#Enter('windows' . s:windowsModeRecurse, s:windowsModeCombos)
              let s:windowsModeRecurse -= 1
          endfunction