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

Not changing to Line mode automatically like vim #154

Closed
Archie-2021 opened this issue Dec 30, 2023 · 10 comments
Closed

Not changing to Line mode automatically like vim #154

Archie-2021 opened this issue Dec 30, 2023 · 10 comments

Comments

@Archie-2021
Copy link

When we use a key like dj it should automatically change to line mode and delete two line completely. But right now it just deleted from current cursor position. This inconsistency between vim and CM is really annoying.

Thanks

@nightwing
Copy link
Collaborator

Hi, where do you see this behavior, and is there some additional config applied to codemirror-vim ?

On https://raw.githack.com/replit/codemirror-vim/master/dev/web-demo.html dj deletes two lines as expected, so more information to track down the issue would be greatly appreciated.

@Archie-2021
Copy link
Author

Hi, where do you see this behavior, and is there some additional config applied to codemirror-vim ?

On https://raw.githack.com/replit/codemirror-vim/master/dev/web-demo.html dj deletes two lines as expected, so more information to track down the issue would be greatly appreciated.

I am using Obsidian and since they use code mirror I thought it being a upstream bug like usual. If it work on CM then it should be an Obsidian bug. The was webapp that I test CM to see if it is replicated there or not, but I could not find that for test.

@nightwing
Copy link
Collaborator

The was webapp that I test CM to see if it is replicated there or not, but I could not find that for test.
You probably mean https://replit.com/@util/codemirror-vim
But https://raw.githack.com/replit/codemirror-vim/master/dev/web-demo.html is better as it is directly the version from github master

Does Obsidian map j to gj?
Vim help says that gj should be not linewise, but when wrap is off, gj in vim behaves like j

gj		or					*gj* *g<Down>*
g<Down>			[count] display lines downward.  |exclusive| motion.
			Differs from 'j' when lines wrap, and when used with
			an operator, because it's not linewise.

@Archie-2021
Copy link
Author

The was webapp that I test CM to see if it is replicated there or not, but I could not find that for test.
You probably mean https://replit.com/@util/codemirror-vim
But https://raw.githack.com/replit/codemirror-vim/master/dev/web-demo.html is better as it is directly the version from github master

Does Obsidian map j to gj? Vim help says that gj should be not linewise, but when wrap is off, gj in vim behaves like j

gj		or					*gj* *g<Down>*
g<Down>			[count] display lines downward.  |exclusive| motion.
			Differs from 'j' when lines wrap, and when used with
			an operator, because it's not linewise.

Thank you. It is the exact problem. It is not the issue of obsidian per se, It is my config I use from my obsidian.vimrc file which I mapped j to gj.

@nightwing
Copy link
Collaborator

I think adding onoremap j j to disable gj mapping in operator pending mode should accomplish the behavior you want.
But please let me know if you see a way in which codemirror-vim could be improved. As far as i can tell now we behave exactly in the same way as neovim.

@Archie-2021
Copy link
Author

I think adding onoremap j j to disable gj mapping in operator pending mode should accomplish the behavior you want.
But please let me know if you see a way in which codemirror-vim could be improved. As far as i can tell now we behave exactly in the same way as neovim.

I will give it a try when get home.

Yes I can see great improvement over time (I remember when it was not like this) Now there is even possible to run macros inside it which is awesome.

Thank you very much for your efforts

@nightwing
Copy link
Collaborator

Closing the issue, but please tell us if you think that the way codemirror-vim handles gj is incorrect, or if you see any way to improve it.

As far as i understand, changing linewise behavior of gj only when wrap is set, does not match the behavior described in vim help, so it is a bug, and what neovim does is better, but maybe i am wrong?

@Archie-2021
Copy link
Author

Closing the issue, but please tell us if you think that the way codemirror-vim handles gj is incorrect, or if you see any way to improve it.

As far as i understand, changing linewise behavior of gj only when wrap is set, does not match the behavior described in vim help, so it is a bug, and what neovim does is better, but maybe i am wrong?

No you are totally right about this, it is just an issue with my setting and I am OK with it.

I like to see more vim ex commands as there are very few implemented right now. Fir example it like to see my vim marks with :marks. But I suppose it is a subject for another FR.

Thanks

@nightwing
Copy link
Collaborator

@Archie-2021 added marks in https://raw.githack.com/replit/codemirror-vim/ex-marks/dev/web-demo.html, not sure if it is worth to make them clickable or change the style in some way.

@Archie-2021
Copy link
Author

@Archie-2021 added marks in https://raw.githack.com/replit/codemirror-vim/ex-marks/dev/web-demo.html, not sure if it is worth to make them clickable or change the style in some way.

Thanks

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

No branches or pull requests

2 participants