Comments (16)
Thanks for the report! Glad you like the plugin. I emailed the vim_use mailing list about this. As maybe you already know, getchar()
appears to return the same keycode regardless of the current active keymap, and nr2char()
returns the same character also. Also, feedkeys("b")
even inserts a "b" in the current buffer, and so does norm! ib
. So it appears that keymap is completely ignored by every Vim programmatic mechanism that I can think of.
Any ideas?
from vim-sneak.
After a quick look in vim's docs, I found this (in :h mbyte-keymap
):
In Insert and Command-line mode you can use CTRL-^ to toggle between using the
keyboard map or not. |i_CTRL-^| |c_CTRL-^|
I'm not sure how this can be used programmatically though (maybe with a :normal ...
). I'll do some more research later if I have the time...
from vim-sneak.
Andy on vim_use gave a great clue about this! https://groups.google.com/forum/#!topic/vim_use/yPXKsV2Tc_c
It's a little tricky for multi-key maps (like e::
or >>
) but I have it working locally. I will commit once I have the quirks worked out.
from vim-sneak.
How about imcmdline
? Maybe turning it on (default is off) after s
is pressed would be simpler/safer to implement?
from vim-sneak.
My vim doesn't appear to have imcmdline
. If you :set imcmdline
, what is the result of :echo getchar()
when you press the "b" key?
from vim-sneak.
Setting imcmdline
on/off doesn't make any difference to either getchar() or entering commands.. strange. Will test on vim on another platform at let you know.
On brew-installed 7.4 macvim, pressing "b" results in "98" (regardless of imcmdline
)
from vim-sneak.
Thanks! When you :set imcmdline
, what is the result of :echo &imcmdline
? It is always 0 for me, I guess because I am missing some compiler option (maybe +xim
?)
from vim-sneak.
For some reason I can't get imcmdline
to work as I expect (I expect being able to enter non-acsii chars in cmd mode when imcmdline
is on). I've tried on an archlinux, ubuntu and osx. Also, compiling vim with --enable-xim
and/or --enable-multi-byte
didn't enable xim (-xim
is printed by version()). Probably I'm missing something...
Anyway, I don't think modifying imcmdline
would actually make any difference. After setting a keymap and trying
nmap z :<c-^>Sneak 2<cr>
nmap z :<c-^>echo getchar()<cr>
it seems to me that getchar()
is not related to command mode in any way... it just gets the next pressed char...
Maybe the solution here would be not to support multi-key chars in vim-sneak
from vim-sneak.
it seems to me that getchar() is not related to command mode in any way.
I think that might be the case. But I have a pretty good hack working. I will commit next week
from vim-sneak.
Throwing in an idea:
Maybe feedkeys()
can be used. A quick test reveals it's affected by the input method (keymap) as long as "t" is passed as second argument, like so call feedkeys("az", "t")
- this appends a з
(which is typed in by z
).
Not sure if this could be of any use...
from vim-sneak.
Cool! Great find. Will test
from vim-sneak.
Hey, the changes are available in this branch: https://github.com/justinmk/vim-sneak/tree/mbyte-keymap
It looks for &iminsert == 1
, otherwise it ignores the keymap. I thought about adding support for ctrl-^
within the sneak input-prompt, but decided that might be overkill. Would you normally have the keymap activated already before invoking s
, or would you want some way to toggle it during the prompt?
from vim-sneak.
It works pretty well, except invalid sequences will keep accepting input until you hit <esc>
or <enter>
. It also doesn't show very good feedback about the currently pending multi-character sequence. (todo)
from vim-sneak.
Nice! I tested it and didn't find any issues.
Regarding ctrl-^
, I think it would be an overkill. There's a little chance that someone will have an English char next to a non-English char AND he would wan't to sneak up to these 2 chars.
Regarding multi-byte keymaps, I think that might also be an overkill for the bulgarian-phonetic keymap. I've never used another keymap, so I don't know how much use they make of multi-byte chars. Looking at the (distributed with vim) keymaps in runtime/keymap, I see some keymaps make heavy use of them, while others don't define any mbyte chars. If it were up to me - I would keep the source cleaner and the functionality limited, i.e. I would want a cleaner (hack-less) source tree and a 99% feature completeness, rather than 100% features and a hairy source tree.
Anyway, maybe it does make sense to support mbyte chars in vim-sneak.
BTW it seems some bozo decided to add Russian characters in bulgarian-phonetic, hence the mbyte chars http://vim.1045645.n5.nabble.com/keymap-files-for-Bulgarian-td1155752.html I'll contact him and ask him why didn't he include all freakin alphabets in bulgarian-phonetic, just Russian :)
Anyway, thank you for your work!
from vim-sneak.
This is in the main branch now. In case you use streak-mode, there's still a known highlighting bug with multibyte chars like абв
. #27
from vim-sneak.
Thanks!
from vim-sneak.
Related Issues (20)
- [Bug Report] No label when too many occurrences of the search chars HOT 8
- Swapping ; with , makes repeating unusable HOT 2
- `Alt-f` and `Alt-F` in insert mode didn't reset `;` and `,` HOT 1
- Labels are not shown for last partially displayed line HOT 5
- vim-sneak conflicts with regular usage of `;` HOT 1
- sneak removes user-defined <Esc> mapping HOT 1
- feature ideas: land on second char? remove f/t completely? HOT 1
- Ahead of time labels HOT 2
- 3-chars label? HOT 2
- Sneak_f in operator-pending mode is incorrect if the target is on eol/eof HOT 2
- repetition clobbers registers
- Re-configuring sneak (in VS-Code) so that "s" and "S" keep their traditional meaning HOT 1
- Support for wrapscan? HOT 2
- allow disabling prompt for cmdheight=0 HOT 1
- How to remap s to other key and s work as the default command in vim (subsititute)? HOT 1
- Make ; map to most recent f/s usage HOT 1
- disable prompt? so the cursor stays in place in buffer and does not jump to command line HOT 4
- Is it possible to use ':' to go to a previous search result rather than ','? HOT 1
- label mode not working with f HOT 2
- extended labels ("smart label mode") HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-sneak.