Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code displaying in submode line. #3

Closed
flowchartsman opened this issue Sep 19, 2012 · 1 comment
Closed

Code displaying in submode line. #3

flowchartsman opened this issue Sep 19, 2012 · 1 comment

Comments

@flowchartsman
Copy link

I'm attempting to create a debugging submode for debugging scripts that ties in with VimDebug (http://vim.sourceforge.net/scripts/script.php?script_id=663). I've defined the first command in my .vimrc like so:

call submode#enter_with('Debug', 'n', '', 'D')

It seems to work, only when I hit 'D' from normal mode this is what I see on my status line:

-- Submode: Debug --                                                                   fix:Debug) 

Which I think is coming from submode.vim line 378? It doesn't matter what width my screen is, the same text is displayed on the right. If I change the definition to:

call submode#enter_with('DDDebug', 'n', '', 'D')

I get:

-- Submode: DDDebug --                                                                 x:DDDebug)

Which seems to indicate some sort of unintended echo problem.

@kana
Copy link
Owner

kana commented Feb 4, 2014

The strange characters are displayed by 'showcmd' option. If you type dat slowly, you'll see d and da at the bottom right corner. The same phenomenon happens in a submode.

Technically, submode consists of several combinations of key mappings. Suppose that we have the following definitions:

call submode#enter_with('undo/redo', 'n', '', 'g+', 'g+')
call submode#map('undo/redo', 'n', '', '+', 'g+')

These definitions are translated into the following plain key mappings:

" These are simplified for description.  Actual definitions are more complex.
nmap g+                                 g+<Plug>(submode-prefix:undo/redo)
nmap <Plug>(submode-prefix:undo/redo)+  g+<Plug>(submode-prefix:undo/redo)
nmap <Plug>(submode-prefix:undo/redo)   <Nop>

So that, when you are in a submode, Vim waits for more keys (after <Plug>(submode-prefix:...)) to determine a command to be executed.

If 'showcmd' is enabled, Vim shows typed-but-not-executed-as-a-command characters. In a submode, the characters are too many to show in the bottom right corner. So that Vim shows only the last few characters. Resulting screen is odd for users, as you described.

A quick fix is to turn off 'showcmd' in a submode. But it causes another problem about screen rendering. See gh-9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants