-
Notifications
You must be signed in to change notification settings - Fork 8
Integrate keybindings for delve v2 with evil or doom #3
Comments
Here's a doom-specific solution posted by @oatmealm: (use-package! delve
:bind (("<f12>" . delve-open-or-select))
:config
(set-evil-initial-state! 'delve-mode 'insert)
(map! :map delve-mode-map
:n "gr" #'delve-refresh-buffer
:n "<right>" #'delve-expand-insert-tolinks
:n "<left>" #'devle-expand-insert-backlinks
:localleader
"RET" #'lister-key-action
"TAB" #'delve-expand-toggle-sublist)
(use-package! delve-minor-mode
:hook (org-roam-mode . delve-minor-mode-maybe-activate))) |
Mind you this is a doom specific code. I think the right way to go would be to add a snippet via the evil-collection package, which is more generic and also supported in doom via the evil-everywhere flag. I've looked at evil-collection once to get an idea, and it seems straight forward enough. I'll see if I can find the time to create a snippet and send them pull request. |
I don't even know the difference between |
more generic until evil-collection. (evil-define-key* '(normal insert) delve-mode-map
(kbd "<return>") #'lister-key-action
(kbd "<tab>") #'delve-expand-toggle-sublist
(kbd "gr") #'delve-revert
(kbd "sm") #'delve-sort-buffer-by-mtime
(kbd "sa") #'delve-sort-buffer-by-atime
(kbd "sc") #'delve-sort-buffer-by-ctime
(kbd "<right>") #'delve-expand-insert-tolinks
(kbd "<left>") #'delve-expand-insert-backlinks
(kbd "c") #'delve-collect
(kbd "q") #'delve-kill-buffer) |
@natask thanks for the snippet! Out of curiosity, you seem to have added a function to sort the buffer contents by {m/a/c}-time. Would you mind sharing it or even add a PR? Seems like a useful extension, didn't think of it. |
@publicimageltd sure. A couple points, ctime isn't supported officially. I have changed the ui to display all three times which clutters the ui but I don't mind. Also sorting doesn't preserve sublists. It maybe possible by using (defun delve-sort-buffer-function (buf function)
"sort all items in BUF by FUNCTION."
(when-let* ((all-data (lister-get-all-data buf))
(head (car all-data))
(tail (cdr all-data)))
(lister-with-locked-cursor buf
(with-temp-message "Updating the whole buffer, that might take some time...."
(lister-set-list buf (cons head (funcall function tail))))))) |
Closed since this discussion refers to an outdated version |
I would also really like some more doom/evil specific integration, as currently I need to set this up myself (haven't taken the time do so, atm just using I will try to find a decent set of keybindings and make PR! |
I would love to find an abstract way to do this. Maybe the doom map could just remap the original bindings? |
This is an issue thread to add evil keybindings to delve. There has been one proposal yet; if there are any other suggestions or improvements, feel free to post them here. Eventually, I will include the most approved and affirmed solution into the source code. I don't use evil, and I am not really willing to install it and to learn to use it, so please help me to do this "blindly"!
The text was updated successfully, but these errors were encountered: