hluk/FakeVim

Implement vim previous and forward location shortcuts (Ctrl+O, Ctrl+I) between files

Opened this issue · 13 comments

First, thank you for a great plugin!

Previous and forward shortcuts don't work when moving between files. You can reproduce it by go to definition outside from current file and then pushing Ctrl + O. You'll be moved to the beginning of a definition file, not to original file.

hluk commented

Oh, true. Shouldn't be too difficult to implement since you already can jump to other files using marks -- this will just make the jumplist global.

hluk commented

Well, it seems it won't be easy to implement after all. Vim has jumplist for each window. In Qt Creator, each splits would need to have its own jumplist and that could get really complicated.

I won't be doing this any time soon, so we'll have to live with Qt Creator's Alt+Left and Alt+Right to jump to old positions across multiple files.

Hello! As temporary solution, I can suggest bind Ctrl+I Ctrl+O to user commands, in User Command Mapping, that will call GoBack and GoForward. Behaviour of this commands are similar to behaviour of VIM moving.

But I've got another issue. When goes to another file, say by FollowSymbolUnderCursor, then I move cursor to some lines up or down, after this I can't go back.

I use case, that I decripted above, when I type my User Command directly it doesn't works too.

I use it on Windows 7.
Qt Creator 3.6.0
Based on Qt 5.5.1 (MSVC 2013, 32 bit). Fakevim is 3.6.0 too.

I have one more question, how do you debug this project? And if you don't have a time, can you say me, where can I start bug in code.

Sorry, if my english is not clear.

hluk commented

I don't use user commands in Qt Creator. If you want to debug Qt Creator behavior you will have to build it in debug mode (or perhaps just the plugin).

This project is stand-alone library for Qt application and not plugin to Qt Creator though they share the same code base. I fix bug and implement features first for the plugin since there are automated tests and code review.

Mmm. I've got it. So... thank you. I will take a look on QtCreator.

I can't figure out how to map Ctr-O/Ctrl-I to QtCreator's "GoBack"/"GoForward".
It seems like FakeVim intercepts those key bindings.
Is there a way to let Ctrl-O/Ctrl-I to go to QtCreator in FakeVim mode?
Thanks

hluk commented

@sheinz You have to disable "Pass control key" in FakeVim configuration in Qt Creator. Alternatively you can also do :map <C-O> ,<C-O> (comma is to enter special PASS mode) selectively for shortcuts you want to pass to IDE (more info at https://bugreports.qt.io/browse/QTCREATORBUG-14413).

I still haven't reached the desired behaviour.
I have unchecked "Pass control key" in my FakeVim setting page.
I have the following .vimrc:

map <C-O> ,<C-O>
map <C-I> ,<C-I>
map <C-]> ,<C-]>

And I reassigned "GoForward", "GoBack" and "FollowSymbol" in QtCreator to <C-I>, <C-O> and <C-]>.

Now when I press <C-]> the status line displaying PASSING and nothing happens. If I press <C-]> once more "FollowSymbol" operation is performed. So, I have to press each key sequence twice :(

Am I doing something wrong?
My FakeVim version is 4.0.2 (4.0.0)

Thanks

hluk commented

@sheinz Try using noremap instead of map. Also this may not work for some shortcuts and functionality in Qt Creator.

@hluk Unfortunately noremap doesn't work, no reaction on key press. :(

@sheinz nmap instead noremap?

@ANtlord with nmap the behaviour is the same as with map: have to press key sequence two times to trigger the action. Also red status "Recursive mapping" is displayed sometimes.

@sheinz Hmm, have you found a solution for that?