terrychou / iVim

A vim port to iOS.
598 stars 35 forks source link

Autocorrect #55

Open tthkbw opened 6 years ago

tthkbw commented 6 years ago

iVim does not appear to support iOS autocorrect functionality. Or, if it does, there is a setting I haven't found. I can certainly understand not wanting autocorrect on when writing code, but I use iVim for writing prose of varying kinds (and I suspect many on iOS do, or would) and it is very useful for a careless touch typist like me. I have come to rely on it both on iOS and on my desktop iMac.

Any chance this will be supported in the future? Perhaps with a setting to enable/disable?

Other comments:

As a serious Vim user for over 30 years, this port is really useful and complete. The use of the extended keyboard row for ESC is perfect with my Smart Keyboard. The implementation of :idocuments is the best I have seen on iOS. The only real limitation of the port is the fact that iOS doesn't allow keys to repeat, so I have to move around using arrow keys if I am going very far.

Thanks for a great piece of software.

terrychou commented 6 years ago

As the spell checking, vim goes in its own way (:h spell). Although by default it won't correct your typos automatically, you could utilize some key mapping or a plugin (e.g. @sedm0784 's https://github.com/sedm0784/vim-you-autocorrect though I didn't test it myself) to do so.

Glad to know that you like iVim. Most of the features could't exist without the suggestion from users like you.

As to the key repeating, iOS's soft keyboard doesn't support it right now. However, if you are using an external English keyboard, enabling the caps lock key mapping (:h ios-settings) will make most of the keys repeatable, as a side-product. (Even in using the soft keyboard, you could use all the vim's move commands instead of the arrow keys, they are part of vim's power after all.)

tthkbw commented 6 years ago

I will try your autocorrect suggestion, although in looking, I think it will be quite different and difficult to get used to.

With respect to mapping caps-lock: How does one accomplish this?

I thought I was pretty good with vim, but I can't figure it out and the doc only says the mapping can be done, not how to do it--at least that I could find. I tried escaping with ctrl-V and with '\' and using the notation implied in the documentation <caps-lock. and , but no joy.

Can someone post how to do this?

terrychou commented 6 years ago

Like said in (:h ios-settings), most iVim related setting options are put in the Settings.app. You can find the caps lock mapping option there.

tthkbw commented 6 years ago

RTFM a bit more carefully. I am way to vim oriented. Settings means the :set command and map means :map command 😄 I read this section of the manual many times looking for insight. But I didn't reread the first sentence which said "In the system's Settings app." My bad, thanks for the clarification. It is great to have repeating cursor control keys.

Another question. In the external keyboard section d of the doc, it says:

d. special keys esc, arrows, tab and enter combined with modifier keys ctrl, command, alt and shift respectively are supported. However, <C-CR> is not working now.

However, the CMD-arrow keys don't change the behavior of the arrow keys in either vim's command or insert modes that I can see. Normal iOS behavior is that CMD-rightarrow, for example, moves to end of line. In Vim, it just moves one character, as if the CMD modifier is ignored. This is useful to me only because, on iOS, touching the extended keyboard ESC button is not yet ask quick as using the ESC key on a desktop computer, so I tend to arrow key around while in insert mode to fix typos.

Am I misreading the documentation again?

I did test the vim-you-autocorrect plugin. It works as advertised, but I see no way to avoid it autocorrecting whatever it thinks is incorrect, unlike the iOS autocorrect system which provides this feature. As such it isn't particularly useful to me. I have and do use the vim built-in spelling correction functions. It is useful for proofreading and correcting things, but nothing compares to the real-time typing autocorrect and auto-completions of iOS and macOS. I am probably half again as fast typing things with those features enabled as without. That's why I'd love to have them in iVim. It will remain a dream of mine!

Thanks again for all your help.

terrychou commented 6 years ago

The "section d" question:

The "respectively are supported" there means that iVim can catch those key pressing events and translate them in vim way. For example, when you press command + ->, iVim will translate it to <D-Right>, the rest is left to vim to handle it. The reason they are emphasized there is because you cannot get all key pressing events from an external keyboard, <C-CR> is an example.

The autocorrect plugin:

It is sad to hear that it doesn't meet your need perfectly. Maybe it is because I don't use autocorrection much, I think it is kind of a matter of habit. After you are used to the iOS's autocorrection, it feels weird to you by using the plugin. However, I think it will break the culture of vim if we force another spelling checking and correction part into it. After all, vim on a macOS doesn't adapt the system's autocorrection either.

sedm0784 commented 3 years ago

@tthkbw If you're still using iVim and if you're still looking for an autocorrect solution, you might like to take another look at Vim You, Autocorrect! I added a bunch of features last year that allow you to change corrections after it makes them, reverting to the original spelling or stepping through Vim's other suggestions. It's still not tightly integrated with iOS's autocorrect feature (and nor is this possible from a plugin), but maybe it will suffice for you, now.