-
Notifications
You must be signed in to change notification settings - Fork 210
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
Draft: implement vim keymap (Resolves Issue #24) #51
base: main
Are you sure you want to change the base?
Conversation
Cool! It's nice to see that it seems to mostly work out of the box. I want Heynote to stay "polished", and having the |
It was quite a pleasant surprise while I was testing!
completely understandable, I'll try and see what I can do tomorrow (it's quite late right now where I am) and if nothing else, the next guy can use this as a basis to start from! |
I started adding vim support myself and then found this branch - nice work! Some other issues I found with the block delimiters + vim mode:
These are all variations of the same theme. |
Yeah, the current search is just using the one that comes with Codemirror. I would like to implement a "block-aware" search. Created issue #60 for that.
It's likely that we need to copy these implementations into Heynote and make them block aware for the Vim mode. |
Hello! I took the liberty to test out this branch as well! Aside from the delimiter issues, it works quite well. Any issues I found was mostly around the delimiter text. I'll try to use this branch as a daily driver for a little while to see if I can find any non-trivial issues! |
Is this going to be merged into master for the next release? Lack of vim keybindings is the one thing making it very hard for me to get into the flow of using this. I've stopped for now but will revisit if/when this is added. |
Same |
It's not going to merged as long as it has known bugs. Please see my comment, which is just a couple of comments above yours. I'd love to merge support for Vim key bindings, but then someone needs to do the work. And unfortunately, it's unlikely to be me since I've never used Vim and need to google how to quit anytime Vi opens up in a terminal. |
ATTN: Vim nerds I opted for |
Hey there, I decided to take a stab at #24 and this is what I came up with.
I used the codemirror-vim package: repo as suggested by @nilsherzig here.
All in all it works without a hitch! cut (dd, dw, d$, etc.), copy (yy, yw, y$, etc.) and paste (p) all work without issue in my testing. Along with this, all the basic movement commands I tested (h, j, k, l, gg, G, w, b), highlighting (Shift-V, Ctrl-v), etc. all worked.
The only issue I managed to find was if you delete the whole line (dd) inside of an empty or 1 line block it uncovers the separator regex for the next block, and the next block inherits the code highlighting of the block you just removed. I tried to find a workaround for this, but with my limited JavaScript skills and lack of understanding of how the app works as a whole, I could only deduce that it had something to do with maybe the extra line break between the separators getting deleted. these comments I think help support this hypothesis.
I am unsure if this issue can be avoided without implementing a custom keymap like what you have in emacs.js. The commented out code in keymap.js was my sad attempt at trying to avoid deleting the extra line break. Perhaps someone with more knowledge with codemirror and it's Vim keybindings package can make a better attempt at fixing the issue!
Overall, I think the net positive of having Vim keybindings is worth the minor headache of having to delete the
∞∞∞text
that pops up and reassign the blocks highlighting, but ultimately that's not my call!PS. Sweet app! I find myself too often pasting things inside of a new tab address bar for temporary jotting. Once I saw your post on Hacker News I knew I had to get it... so long as it had Vim keybindings 😉