-
Notifications
You must be signed in to change notification settings - Fork 53
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
Implement and provide default mappings for some Obsidian-specific Vim motions/commands #222
Conversation
jumpToNextHeading: g] jumpToPreviousHeading: g[
…stead of undefined
utils/jumpToPattern.ts
Outdated
// Polyfill for String.prototype.matchAll, in case it's not available (pre-ES2020) | ||
matchAllShim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing we don't actually need this polyfill since users are probably using a version of Obsidian that runs on a post-2020 Electron/Chromium version (which will have String.matchAll
implemented). In which case we should update tsconfig
to specify ES2020
for target
and lib
First, I must express my deepest regrets for taking so long to review this. I think this is a great contribution to this plugin in so many ways, it's a shame users should have waited. |
Hey @esm7 sorry for the slightly late reply myself and no worries at all, I know very well how life can get in the way of things like this :) thanks for getting around to looking through this, glad things look good to you on the whole! I'll try and find time soon to update the documentation! |
Okay, just pushed some simple docs updates! @esm7 Things could maybe be more organized since now I guess we have some outdated code examples in |
This is very useful, thanks! I tried this through the 0.10.0 plugin version, and the
I'm not sure if this can easily be avoided, but I thought it doesn't hurt to mention this. :) |
Hey @lebigot glad you find it useful, and yeah thanks for pointing this out, I didn't think of this case! Someone else also noticed it and filed an issue #231 for it. I'm quite busy these next couple days, but this should definitely be fixable when I get a chance soon :) hopefully it's not the biggest annoyance in the meantime haha |
See discussion in improved-obsidian-vimcursor, which is no longer functional as a plugin due to Obsidian switching from CodeMirror 5 to 6.
New motions/actions
This PR now has this plugin automatically provide the following vim motions/actions in Obsidian:
[[
/]]
gl
/gL
zk
/zj
gf
This PR also implements associated helper functions and types (
defineAndMapObsidianVimMotion
,defineAndMapObsidianVimAction
,jumpToPattern
,MotionFn
,ObsidianActionFn
) that would hopefully make it easier to add more motions/actions like these to the plugin in the future.Not done yet
count
s to jump multiple headings/links at a time)Screen recording
(Keystroke viewer may be a little hard/fast to see here, but including anyway in case it's useful)
Screen.Recording.2024-05-11.at.4.11.42.PM.mov