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

Fix marks jumping #356

Closed
wants to merge 3 commits into from
Closed

Fix marks jumping #356

wants to merge 3 commits into from

Conversation

Shatur
Copy link
Collaborator

@Shatur Shatur commented Sep 8, 2020

Closes #228.

@Shatur
Copy link
Collaborator Author

Shatur commented Sep 8, 2020

BTW, I noticed that you use something like

nnoremap <silent> <C-o> :<C-u>call <SID>jump(0)<CR>

This can be done in more convenient syntax:

nnoremap <C-o> <Cmd>call <SID>jump(0)<CR>

Let me know if you like the idea, I will send a PR.

@asvetliakov
Copy link
Member

nnoremap <C-o> <Cmd>call <SID>jump(0)<CR>

I like, but <Cmd> has slightly different semantics. Be careful when changing it

@@ -23,6 +29,7 @@ augroup VscodeJumplist
augroup END


onoremap <C-o> <Cmd>call <SID>jumpToMark()<CR>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why <C-o> here? What about jumping with `A and 'A ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omg, sorry, just a stupid typo after merge. Fixed.

function s:jump(forward)
function! s:jumpToMark() abort
let g:isJumping = 1
normal! `
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about 'A ?

@Shatur
Copy link
Collaborator Author

Shatur commented Sep 9, 2020

Hm... The shortcut is working, but let g:isJumping = 1 and let g:isJumping = 0 does not have effect. It works just like before.

@Shatur Shatur marked this pull request as draft September 9, 2020 07:53
@Shatur
Copy link
Collaborator Author

Shatur commented Sep 9, 2020

Do <C-o> and <C-i> work for you for jumping between files?
All this shortcuts do not jump between files for me.

@asvetliakov
Copy link
Member

Do <C-o> and <C-i> work for you for jumping between files?

Yes

I just tried PR, it doesn't work. But changing these to:

function! s:jumpToMark() abort
    let g:isJumping = 1
    normal! `A
    let g:isJumping = 0
endfunction

nnoremap `A <Cmd>call <SID>jumpToMark()<CR>

then mA in first file, then `A in other file correctly jumps. So i guess we shouldn't do operator remap here and use nnoremap in a loop

@Shatur
Copy link
Collaborator Author

Shatur commented Sep 9, 2020

Yes

This is strange. What I have tried:

  1. Remove all my Neovim settings an plugins.
  2. Open this branch in VSCode.
  3. Launch the extension (another VSCode instance opened)
  4. Open any file. Then open another file in split.
  5. Jump to the end, then jump to another side of split, then jump to the beggining.
  6. Press <C-o> - jumping occurs only inside single file.

I just tried PR, it doesn't work.

Of course. But for me even any jumping do not works between two files.
Do I understand correctly that ` from this PR works, it just does not move between files (e.g. it does not fixes the problem)?
I guess you have <C-i> and <C-o> reassigned to workbench.action.navigateBack and workbench.action.navigateForward in VSCode settings. Could you check it?

@asvetliakov
Copy link
Member

asvetliakov commented Sep 9, 2020

Open any file. Then open another file in split.
Jump to the end, then jump to another side of split, then jump to the beggining.

Jumplist is each own separate por editor column and not being inherited by split commands (see readme) 😄

open another file in the same column, switch between them and use <C-o> / <C-i>, it should work

@Shatur
Copy link
Collaborator Author

Shatur commented Sep 9, 2020

Jumplist is each own separate por editor column and not being inherited by split commands (see readme) smile

Still not works for me. What I tried

  1. Opened any file.
  2. Open another file (now I have two tabs)
  3. <C-o> - nothing happened.
  4. G - jumped to the end
  5. <C-o> - jumped to the previous position
  6. <C-o> - nothing happened.
  7. Swith to the previous tab.
  8. <C-o> - nothing happened.

I also updated this branch to the latest master just to be sure. Also this was done without any settings.

@Shatur
Copy link
Collaborator Author

Shatur commented Sep 11, 2020

Oh, got it. The problem was in workbench.editor.enablePreview set to true. Because of it <C-o> and <C-i> not works even if I keeping tabs in editor.

If workbench.editor.enablePreview is set to true it works. But it also have issues. Try the following:

  1. Close all tabs.
  2. Open first file.
  3. Open second file.
  4. <C-o>. It jumps to first file.
  5. Open third file
  6. <C-o>. It jumps to first file.
  7. <C-o>. It jumps to first file.
    This hotkey shouldn't have done that.

Another issue I noticed:

  1. Open a lot of files.
  2. Close them quickly except one.
  3. Quickly press <C-o> a lot of time.
    You will have several Untitled buffers with content insted of opened files. It happens sometimes, but often. Try 1-3 steps two-three times and you should reproduce it.

Is it possible to improve jumping system? I think this should be done before fixing marks.

@asvetliakov
Copy link
Member

You will have several Untitled buffers with content insted of opened files. It happens sometimes, but often. Try 1-3 steps two-three times and you should reproduce it.

I noticed this problem too, for some reason neovim sends /file/path instead file:/// uri when jumping and vscode ignores it. Will try to solve it by either fixing neovim or by accepting paths too

  1. . It jumps to first file.
    This hotkey shouldn't have done that.

There are limitations with jumping. Opening a buffer doesn't create a jumppoint. Not easy to solve

@Shatur
Copy link
Collaborator Author

Shatur commented Sep 20, 2020

There are limitations with jumping. Opening a buffer doesn't create a jumppoint. Not easy to solve

Maybe use VSCode jumping for <C-o> / <C-i>? Yes, it works a bit differently, but do not have issues.

@asvetliakov
Copy link
Member

Maybe use VSCode jumping for / ? Yes, it works a bit differently, but do not have issues.

Unfortunately vscode jumping is completely broken because setting vscode cursor is creating vscode jumppoint for each cursor move

@Shatur
Copy link
Collaborator Author

Shatur commented Sep 20, 2020

Unfortunately vscode jumping is completely broken because setting vscode cursor is creating vscode jumppoint for each cursor move

Yes :(
But I use this in my vimrc for now to avoid current jumping issues.

@asvetliakov
Copy link
Member

asvetliakov commented Sep 20, 2020

Probably can be workarounded by using vscode's cursorMove command. But need to count character shifting then between old & new cursor pos. Oh, and marks won't work too. Nope (only m' wont work so actually can be valid idea)

@asvetliakov
Copy link
Member

asvetliakov commented Sep 20, 2020

cursorMove

Nope. cursorMove vscode command stops when reaching a new line and ignoring given value count. Possible workaround it here too but too clunky. Need to fix vim jumplist

@Shatur
Copy link
Collaborator Author

Shatur commented Dec 29, 2020

Closed after #461.

@Shatur Shatur closed this Dec 29, 2020
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.

Uppercase marks not working
2 participants