-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Many vim-like shortcuts for navigating and manipulating blocks #63
Many vim-like shortcuts for navigating and manipulating blocks #63
Conversation
wow, this looks amazing! will look at it closer tonight-ish |
some want's from just trying it out for a bit
More general Roam toolkit related:
Surfingkeys:
|
Added a commit for undo/redo, and The hints can be remapped from numbers to keys, maybe we can set the default hint keys to something else closer to home row. Maybe there should option to toggle the hints on/off, or have hints be nested in their own mode. I was considering extending |
Hmm, undo/redo/shift-o don't seem to work for me for some reason 🤔 |
So one strange thing I noticed is that whenever I introduce a new key binding, I have to
In order for the shortcut to start working (this is while I'm doing |
ouch, that seems like a bug in settings, can you create an issue for that? |
also as a general remark - this PR is kind of large. if you can think of meaningful way to split it up in several ones to make review easier - would be appreciated. If not it's ok, but it's going to take me a bit to go through it |
One weird thing: In the morning I remapped "Select Panel Left" to |
btw just fui - key sequences should also work - https://github.com/greena13/react-hotkeys#key-combinations-vs-sequences (you just have to specify them with the space within them) |
}, | ||
}) | ||
|
||
export const imap = (settings: BlockNavigationModeSetting): Shortcut => |
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 feel like it should be straightforward to write a function to generate all the functions below based on a given predicate/list of modes
For sure, apologies for that. I'll go through the commits and reorganize them :p |
Created #64 |
import {Selectors} from '../../roam/roam-selectors' | ||
import {delay} from '../../utils/async' | ||
|
||
export type Mode = 'INSERT' | 'VISUAL' | 'NORMAL' |
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.
should these be Enums? (it's not an assertion but a question :) )
toggle fold does not work in references, unless you hover the mouse on top of the block |
Btw, I often have blocks with more then 4 things that can be referenced, what's up with the limit to 4?:) |
If I click on the |
Oh yeah, 4 is too low, I'm thinking something like 10 might be a reasonable upper bound. But then again, the whole hint UX deserves some more consideration |
FYI, heads up that visual mode and insert mode are unreliable for me, sometimes the selection gets stuck, and keys stop working. I'll look more into this. In the React Hotkey debug logs, I sometimes get into a state where pressing "J" is interpreted as "J+whateverWasLastPressed", even if I'm only pressing "J". Unfocusing/focusing the window usually fixes the problem. I think this has to do with some race condition related to focusing/unfocusing blocks. |
btw added |
Tab/shift-tab should work in normal mode (probably generally true for anything that you'd expect to work with "native" selection) |
Also there should probably be mapping for "jump to last block that is not in linked references" |
Just to say that this is absolutely mindblowing... I've been dreaming of something like this! I hate how all the blocks change when you move up/down with a keyboard (especially images etc). I probably even use fewer Markdown links because of that... This will quickly become something I could not live without. Would be very useful with an overview of keyboard shortcuts :) I looked at the source code and tried stuff - worked very well! Love how smooth it feels... Would love line numbers (even more fancy is relative line numbers) on the left, and being able to do 10k etc to jump up to a specific line. Also hope I can remap Esc to jk keychord as I have in my Vim setup :) Fantastic work! 🎉🔥 |
This is absolutely amazing, incredible work. I'm sure as I'll play around with this I'll have more feedback, but for now the only major thing that is missing for me is unwinding context on a block in a query or a linked reference, or while zoomed in on a block. |
2fd8409
to
3cfc609
Compare
3cfc609
to
c842d18
Compare
Also added tntmarket#5, in case anyone wants to try a horizontal sidebar css theme, and wants |
@tntmarket regarding |
I can't contribute, but please don't let this die. vim+roam would be heaven |
@nicksettoon I don't think this is in any danger of dying :) @tntmarket and myself are working on bringing this to master. I use it and love it. Absolutely looking forward to pushing it out to the other users! |
|
…her than introducing a seperate method for that
Oh actually nvm, I'll use |
btw - I'm curious on why make the PRs internal and not to the master here? |
Oh, I thought it'd make the diffs look more clean, so the later ones wouldn't include changes from the earlier ones |
…-hotkeys and provide a more convenient interface that does what you'd expect
- Basic navigation, insert, and visual mode commands - Abstractions on top of Roam that make it more convenient to implement Vim Mode. I didn't integrate this with core/roam yet, since I wanted to get feedback on whether they were the right abstractions first
c842d18
to
1c52dba
Compare
outside of scope of this, but just fyi created #95 |
Since we're getting close to releasing this, I created #104 to update the documentation |
Gonna close this, as the functionality has been merged via other PRs and now. Looking forward to the app store release! |
This introduces a variety of vim like keyboard shortcuts for navigating blocks/pages, opening links, editing and selecting blocks.
It mainly revolves around remembering a "Currently selected block", which is analogous to the cursor in vim.
Demo: https://www.youtube.com/watch?v=ZxtT05CjOyo
I believe this addresses #47, #54, and #18, although in a somewhat intrusive way
Work In Progress
Still need to: