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

Merge Vim emulation rewrite. #442

Merged
merged 4 commits into from
Aug 10, 2013
Merged

Merge Vim emulation rewrite. #442

merged 4 commits into from
Aug 10, 2013

Conversation

ethercrow
Copy link
Member

You can try it out by launching yi --as=vim2 and configure it using yi/example-configs/yi-vim2.hs as a starting point.

Tests can be run with cabal test, please read yi/src/tests/vimtests/README.rst for some documentation.

Let's use this pull request as a beta release discussion of vim2. When we agree that it's not horribly broken in some way, we can merge it and call it yi-0.7.0

@ethercrow
Copy link
Member Author

Michał J Gajda wrote:

Remaining notes and questions:

  1. Rectangle selection and then '>>' (indent) in visual mode (CTRL-V) doesn't work as intended: all lines but first are shifted.
    May be related to the fact that first move after CTRL-V displays an error, like:
    error: Unhandled event in ex mode

I couldn't reproduce that error about unhandled event, could you post a test?

  1. SHIFT-P doesn't work as intended when inserting the yanked text:
    It should place it starting from beginning of current line, and then putting cursor in current column in first line of inserted text.
  2. Broken paste of rectangular region when there are not enough lines at the end of file:
    a) select a rectangular region of 3 columns x 3 lines,
    b) yank it
    c) put cursor at the second last line of the file
    d) press 'p' for paste
    e) see region flattened at the last line, and remaining rows inserted one after the other into the last line (instead of extending file by single line).

These are bugs, I'll fix them.

  1. There is no clear mapping between Vim2._keymapSet functions and Vim._keymap .
    Is Vim2 module supposed to be used along Vim module, is it just functionality that is not yet transferred, or is Vim2 API supposed to be used in a completely different way?
    In the last case, would it be good idea to provide a temporary compatibility layer for current config files?

Vim2 is intended as a complete replacement for Vim module. I think we should make a release with both implementations, receive some more feedback and then in some future release remove the old one.

As for the compatibility layer, I think it's not worth the effort.

  1. What Yi.Keymap.Vim functionality is not yet in the Vim2?
    If none, is it good idea to poll the list for a complete replacement of the former (possibly with compatibility layer)?

It's hard to tell, because current Vim emulation doesn't have any tests.

Since it is particularly big pull, I would opt for using it for another week and fixing bugs along the way before merging.
I would even add some tidbits on my own before putting it to upstream.

Sure, take as long as you need.

Thank you for review.

@mgajda
Copy link
Contributor

mgajda commented Jul 20, 2013

Something like:

-- Input                                                                                                                                                      
(2,2)                                                                                                                                                         
abcdef                                                                                                                                                        
abcdef                                                                                                                                                        
abcdef                                                                                                                                                        
abcdef                                                                                                                                                        
-- Output                                                                                                                                                     
(2,2)                                                                                                                                                         
abcdef                                                                                                                                                        
a  bcdef                                                                                                                                                      
a  bcdef                                                                                                                                                      
a  bcdef                                                                                                                                                      
-- Events                                                                                                                                                     
<C-v>jj>>

For a problem with the block insertion at the end of file:

-- Input                                                                                                                                                      
(2,2)                                                                                                                                                         
abcdef                                                                                                                                                        
abcdef                                                                                                                                                        
abcdef                                                                                                                                                        
abcdef                                                                                                                                                        
--bcde Output                                                                                                                                                 
(3,3)                                                                                                                                                         
abcdef                                                                                                                                                        
abcdef                                                                                                                                                        
abbcdcdef                                                                                                                                                     
abbcdcdef                                                                                                                                                     
bcd                                                                                                                                                           
-- Events                                                                                                                                                     
<C-v>lljjyjp

I can no longer reproduce "event" bug in the current version.

@mgajda
Copy link
Contributor

mgajda commented Jul 22, 2013

After entering Ex mode with ':' trying to quit it with just leads to:
error: Prelude.read: no parse
Also editing of the command in Ex mode with right/left cursor keys is not possible. Up/down cursor keys do not recall history as they should.

@mgajda
Copy link
Contributor

mgajda commented Jul 23, 2013

Two more things I spotted that would be good to fix before merging:

  1. Most submodules seem to have 0% Haddock documentation coverage. (May be difficult for others to improve without docs.)
  2. Tag stack is not used (history-aware ops are in Vim.TagStack module now.) Are tag operations working?

@ethercrow
Copy link
Member Author

Tag stack is not used (history-aware ops are in Vim.TagStack module now.) Are tag operations working?

I've never used tag operations in yi, how do I test them?

@mgajda
Copy link
Contributor

mgajda commented Aug 10, 2013

Dear Dmitry,

In visual and insert keymaps:
CTRL-t should go to previous tag on the stack
CTRL+] should go to the tag named with currently marked test, or current
word (if no text is marked)
:tags should show a list of tag on TagStack

Underlying ops on a tag stack (pushTagStack, popTagStack, and
listTagStack) are in Vim.TagStack, and should be well isolated so they can
be linked to the keymaps in Vim2.

Reading "tags" file is implemented separately in Yi.Tags.

Best
Michal

@mgajda
Copy link
Contributor

mgajda commented Aug 10, 2013

Seems to work for me. I would open issues for TagStack and isearch history and finalize merging, unless anybody is against.

@mgajda mgajda merged commit f75f4d6 into master Aug 10, 2013
@mgajda
Copy link
Contributor

mgajda commented Aug 10, 2013

Dear Dmitry,

The issues I opened are here:
#449
#449
50
#449
51

Thanks a lot for this huge patch. It seems to work quite nicely. (Except
for those bugs above, of course. But previous vim had more weaknesses

AFAIR.)

Best
Michal

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

Successfully merging this pull request may close these issues.

None yet

2 participants