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

"nmap j gj" not working for some themes #72

Closed
kometenstaub opened this issue Dec 24, 2021 · 7 comments
Closed

"nmap j gj" not working for some themes #72

kometenstaub opened this issue Dec 24, 2021 · 7 comments

Comments

@kometenstaub
Copy link

@kometenstaub kometenstaub commented Dec 24, 2021

First of all, thank you very much for adapting this plugin to cm6! ❤️

I'm not sure if this is the right place, but I noticed something odd.

With themes like Primary or Sanctum, if nmap j gj is in the vimrc, then I cannot navigate below a heading with j or cursor down in normal mode. In insert or visual mode it works. (In visual mode, if the mapping vmap j gj is active, then it requires j two times to go below the heading.)

Instead of going below the line, it goes to the end of it.

vim-j-headings

It does work with the base Obsidian theme, so I was wondering if it is up to the theme devs to fix it. This is where the headings css starts for Sanctum, for Primary I cannot link to the line, but you can find it if you search for Headings.

I tried a few things with Primary's headings css, but I couldn't get it to work.

Note that it doesn't affect upward motions (k).

@kometenstaub
Copy link
Author

@kometenstaub kometenstaub commented Dec 24, 2021

It happens in both Source and Live preview mode.

@kometenstaub
Copy link
Author

@kometenstaub kometenstaub commented Dec 24, 2021

If click after the heading (so after any text or whitespace), I can go below. If I click on the last character, then I cannot move below it.

There are no errors in the console.

I've also contacted the author of Sanctum.

@jdanielmourao
Copy link

@jdanielmourao jdanielmourao commented Dec 24, 2021

Author of Sanctum here! If it happens with Primary and Sanctum, and not many others, it might have to do with .cm-s-obsidian .HyperMD-header-1, etc, which both themes use as part of the heading styling. It's necessary because of things like latex in headings, which can only be targeted with that, afaik.

@kometenstaub
Copy link
Author

@kometenstaub kometenstaub commented Dec 29, 2021

It seems to be impacted by the font size.
When I change the font size to a higher variable (e.g. --font-scale-4), then it stops working.

.markdown-preview-view h2,
.HyperMD-header-2,
.cm-header-2 {
    font-size: var(--font-scale-3);
}
--font-scale-3: 1.48rem;
--font-scale-4: 1.774rem;

@kometenstaub
Copy link
Author

@kometenstaub kometenstaub commented Mar 8, 2022

For others seeing this issue, it isn't a bug with the vimrc plugin, the same can be achieved by remapping manually. I'm leaving this open because this issue will most likely be seen by people who use this plugin.

@esm7
Copy link
Owner

@esm7 esm7 commented Mar 9, 2022

I think it had gotten worse with Obsidian 0.13.27.
It's indeed a bug in Obsidian itself and not this plugin, and I'm actually not sure it was reported to the Obsidian developers properly.

@esm7 esm7 closed this Mar 9, 2022
@kometenstaub
Copy link
Author

@kometenstaub kometenstaub commented Mar 9, 2022

It is tracked here https://forum.obsidian.md/t/bug-vim-mode-gj-movement-command-break-with-live-preview-bullets-and-transclusion/31417/

Now also the normal h1 headings are affected, which wasn't the case before. Before it only affected other themes that set the size too high.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants