GNU Emacs minor mode that provides vi-like bindings for org-mode
abo-abo / worf Goto Github PK
View Code? Open in Web Editor NEWvi-like bindings for org-mode
vi-like bindings for org-mode
Hi
I discovered today that when i enable worf mode it kills/disables company-mode completions in an orgmode buffer.
this is my relevant company mode config
(use-package company
:ensure t
:config
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)
(add-to-list 'company-backends 'company-ispell)
(add-to-list 'company-backends 'company-dabbrev)
(add-to-list 'company-backends 'company-abbrev)
)
(defun my-org-mode-hook ()
(set (make-local-variable 'company-backends)
'((company-capf company-files company-dabbrev))))
(add-hook 'org-mode-hook #'my-org-mode-hook)
any clue why this happens? can you confirm? can we try and debug this?
EDIT: if i move my worf config below company mode it seems to work..strange..any clue why?
thx alot in advance!
Z
Or how could I make worf
work with https://github.com/fgallina/region-bindings-mode ?
Hi
i have been using worf-goto every day as an integral part of my workflow and really love it.
An idea has come up today regarding perhaps having an additional worf-goto
command that would act the same as worf-goto
but on many files?
so either a user defined folder, list of files, agenda file etc..
that way when one launches worf-goto-global
you get all the headers from your pre defined file/folder list of org files.
does that make any sense ;-) any thoughts on that?
best
Z
Hi!
i find worf-goto far superior compared to helm-org-headlines in terms of the UI, ease of use etc. i would love to over to use it full time. yet it seems 10x slower than the helm-org-headlines option. on a 40000 line org file (my main note file) it takes around 15-20 seconds just to load...this makes it not very usable :)
is there a way to speed things up? or perhaps use the excellent ivy/swiper to search orgmode headlines only?
thx so much
Z
The docs say hjkl
are used to move headings after activating worf-change-shift-mode
, but I get this Hydra instead, which uses wasd
for moving headings:
Are the docs not up do date or am I missing something?
(the docs say "While worf-change-shift-mode is active, hjkl act as S- and arrows in the default org".)
Anyway, to be honest, I would prefer using hjkl
as it's consistent with the other keybindings. What do you think?
The line (require 'ace-jump-mode) is not needed anymore (because of ace-link and avy, I guess).
Most likely the same issue of special shadowed keys self-inserting incorrectly.
I just updated some of my package as well as worf-mode
today, then I get this error, when run command (wspecial-worf-goto)
here is the error
Debugger entered--Lisp error: (invalid-function with-ivy-window)
with-ivy-window(656 nil nil)
worf-goto-action((#("2 Package Initialization" 0 1 (idx 3) 4 26 (face org-level-2)) . 656))
ivy-call()
....
I google the related error abo-abo/swiper#185, then I re-install all the related package, such as swiper
, ivy
, but the issue is still not resolved.
Any other idea?
Thanks
I find the default mapping of [ and ] in worf to worf-backward and worf-forward to be awkward, as this prevents me from manually typing in links with square brackets.
I can override the mappings with the following in my init file;
(define-key worf-mode-map "]" nil)
(define-key worf-mode-map (kbd "M-]") 'worf-forward)
(define-key worf-mode-map "[" nil)
(define-key worf-mode-map (kbd "M-[") 'worf-backward)
Am I missing something? Surely it isn't desirable to effectively prevent the use of the characters [ and [ in all org-mode files?
Would this be a better default?
Apologies in advance if this is a feature rather than a bug.
Unlike with Lispy, where special mode is triggered if "the point is before/after paren or the region is active", Worf documentation makes no reference to enabling special mode when the region is active. Indeed, tree manipulation commands are useless beyond headers or Org markup.
However, on an emacs -q session, editing an org file with worf-mode enabled and region active outside of a header:
C-h k q
reads:q runs the command wspecial-worf-quit (found in worf-mode-map), which
is an interactive Lisp function in ‘worf.el’
C-h k j
echoes:j runs the command wspecial-worf-down (found in worf-mode-map), which
is an interactive Lisp function in ‘worf.el’.
Both suggesting that Worf is in special mode when the region is active.
Is this behaviour by design or a bug?
I open a new issue because it has not much to do with my issue a a couple of days ago.. I do not have redefined any worf-mode keys ins this scenario.
Take this simple structure of a org file:
* Testing A
** Testing a
** Testing b
* Testing B
go to *** Testing A** headline press i
to fold it and hit a (wspecial-worf-add)
to insert a new heading below. The result looks like this:
The command inserts the heading after **Testing b
, is this a bug?
When I hit c (change mode) + a
it works without problems. This are my settings for blank lines in org-mode.
(setq org-blank-before-new-entry
'((heading . auto)
(plain-list-item . auto)))
I commented them out but it does not help.
Regards
Thorsten
I think that the equivalents from lispy would work well in worf as well. I often traverse with worf-right deep into a tree, then want to continue to the next top level item.
Is there a way to make worf-goto
search without case sensitivity (i.e., both "HOW" and "how" match "How")?
worf-beginning-of-line could behave nicer when visual-line mode is active. Here's two alternatives which makes it work. I am not sure which one is more desireable.
First one behaves as worf-beginning-of-line usually does:
(defun worf-beginning-of-line ()
"Replaces `org-beginning-of-line'.
When already at beginning of line, move back to heading."
(interactive)
(let ((pt (point)))
(org-beginning-of-line)
(when (and (eq pt (point))
(not (looking-at "^[*]")))
(push-mark)
(re-search-backward "^*"))))
Second one moves to beginning of visual line -> beginning of logical line -> back to heading.
(defun worf-beginning-of-line ()
"Replaces `org-beginning-of-line'.
When already at beginning of line, move back to heading.
When at beginning of visual line, move to beginning of logical line."
(interactive)
(let ((pt (point)))
(org-beginning-of-line)
(when (eq pt (point))
(cond ((looking-at "^[^*]")
(push-mark)
(re-search-backward "^*"))
((not (looking-at "^[*]"))
(push-mark)
(re-search-backward "^")))))
Seems [
and ]
are bound with commands. But how can I type literally?
Dear abo-abo
Thank you very much, it is really a good accomplishment.
I tested the snippet, maybe there are some little bugs.
worf--summary-on
, it hides all my subheadings. It would be best without doing any other things except re-display in my opinion.worf--summary-on
automatically when i am in org-mode. Ok, i can add the hook by myself.Thanks again, it is really a great help to me!
Best regard!
I found a solution to this emacs stackexchange question and then started to think that it could a good addition to worf-delete-subtree.
I am not too sure about the design philosophy behind worf and implications of adding this functionality, so rather than creating a pull request, I suggest here that this could be added to the end of the worf-delete-subtree function code:
(when org-provide-todo-statistics
(org-update-parent-todo-statistics))
At least, there is very little overhead in adding it. At best, updating the stats automatically could be a pleasant surprise to the user. There might be other places where org todo stats could be taken into account, but not sure where.
Hi.
It seems that the regex for getting back to a headline fails when there's a line that contains only bolded text.
For example, consider the following text:
*** Headline
*Bolded text*
- Line 1
- Line 2.
When the point is on line 2 and worf-backward
is executed, the point moves to the bolded text instead. The expected behaviour would be getting to the headline, I think.
Here is the debug info:
Debugger entered--Lisp error: (void-function worf-change-name)
documentation(worf-change-name)
(format "Call%s' when special, self-insert otherwise.\n\n%s" (symbol-name def) (documentation def)) (list (quote lambda) (help-function-arglist def) (format "Call
%s' when special, self-insert otherwise.\n\n%s" (symbol-name def) (documentation def)) (interactive-form def) (list (quote let) (quote (cmd)) (cons (quote cond) (cons (list (quote (worf--special-p)) (if disable (progn (cons disable ...))) (cons def (delq (quote &rest) (delq ... ...))) (cons (quote unless) (cons (cons ... ...) (quote ...)))) (quote ((t (org-self-insert-command 1))))))))
(let ((disable (cdr (assoc :disable alist))) (break (cdr (assoc :break alist)))) (list (quote lambda) (help-function-arglist def) (format "Call%s' when special, self-insert otherwise.\n\n%s" (symbol-name def) (documentation def)) (interactive-form def) (list (quote let) (quote (cmd)) (cons (quote cond) (cons (list (quote (worf--special-p)) (if disable (progn ...)) (cons def (delq ... ...)) (cons (quote unless) (cons ... ...))) (quote ((t ...)))))))) worf--insert-or-call(worf-change-name ((:disable . worf-change-mode) (:break . t))) (defalias (intern (concat "wspecial-" (symbol-name def))) (worf--insert-or-call def (worf--flag-to-alist plist :break))) (let ((func (defalias (intern (concat "wspecial-" (symbol-name def))) (worf--insert-or-call def (worf--flag-to-alist plist :break))))) (if (member func ac-trigger-commands) nil (setq ac-trigger-commands (cons func ac-trigger-commands))) (if (member func company-begin-commands) nil (setq company-begin-commands (cons func company-begin-commands))) (define-key keymap (kbd key) func)) worf-define-key((keymap (116 . wspecial-org-set-tags) (108 . wspecial-org-metaright) (104 . wspecial-org-metaleft) (107 . wspecial-org-metaup) (106 . wspecial-org-metadown)) "n" worf-change-name (:disable . worf-change-mode) :break) apply(worf-define-key ((keymap (116 . wspecial-org-set-tags) (108 . wspecial-org-metaright) (104 . wspecial-org-metaleft) (107 . wspecial-org-metaup) (106 . wspecial-org-metadown)) "n" worf-change-name (:disable . worf-change-mode) :break)) (lambda (x) (let ((y (memq :disable x))) (if y (progn (setcar y (cons :disable (quote worf-change-mode)))))) (apply (quote worf-define-key) (cons worf-change-mode-map x)))(("n" worf-change-name (:disable . worf-change-mode) :break)) mapc((lambda (x) (let ((y (memq :disable x))) (if y (progn (setcar y (cons :disable (quote worf-change-mode)))))) (apply (quote worf-define-key) (cons worf-change-mode-map x))) (("j" org-metadown) ("k" org-metaup) ("h" org-metaleft) ("l" org-metaright) ("t" org-set-tags (:disable . worf-change-mode)) ("n" worf-change-name (:disable . worf-change-mode) :break))) (progn (defvar worf-change-mode-map (make-sparse-keymap)) (progn (progn :autoload-end (defvar worf-change-mode nil "Non-nil if Worf-Change mode is enabled.\nUse the command
worf-change-mode' to change this variable.") (make-variable-buffer-local (quote worf-change-mode))) (defalias (quote worf-change-mode) (function (lambda (&optional arg) "Change verb." (interactive (list (or current-prefix-arg ...))) (let ((last-message ...)) (setq worf-change-mode (if ... ... ...)) (cond (worf-change-mode ...) (t nil)) (run-hooks (quote worf-change-mode-hook) (if worf-change-mode ... ...)) (if (called-interactively-p ...) (progn nil ...))) (force-mode-line-update) worf-change-mode))) :autoload-end (defvar worf-change-mode-hook nil "Hook run after entering or leavingworf-change-mode'.\nNo problems result if this variable is not bound.\n
add-hook' automatically binds it. (This is true for all hook variables.)") nil (with-no-warnings (add-minor-mode (quote worf-change-mode) (quote " [change]") worf-change-mode-map nil nil))) (mapc (function (lambda (x) (let ((y (memq :disable x))) (if y (progn (setcar y ...)))) (apply (quote worf-define-key) (cons worf-change-mode-map x)))) (quote (("j" org-metadown) ("k" org-metaup) ("h" org-metaleft) ("l" org-metaright) ("t" org-set-tags (:disable . worf-change-mode)) ("n" worf-change-name (:disable . worf-change-mode) :break)))) (if (memq (quote worf-change-mode) worf-known-verbs) nil (setq worf-known-verbs (cons (quote worf-change-mode) worf-known-verbs))) worf-known-verbs)
eval-buffer(#<buffer load> nil "/Users/jeremybi/.emacs.d/packages/worf.el" nil t) ; Reading at buffer position 9488
load-with-code-conversion("/Users/jeremybi/.emacs.d/packages/worf.el" "/Users/jeremybi/.emacs.d/packages/worf.el" nil t)
require(worf)
eval((require (quote worf)) nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
#(eval-last-sexp nil nil)
ad-Advice-call-interactively(# eval-last-sexp nil nil)
apply(ad-Advice-call-interactively # (eval-last-sexp nil nil))
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
I like the key sheme of xah fly keys very much. In short:
j = left
l = right
i = above
k= below
worf works with vim like key sheme. My goal is one key sheme for all my work, so I tried to change some keys in worf mode:
(use-package worf
:ensure t
:init
(add-hook 'org-mode-hook #'worf-mode)
:bind
(:map worf-mode-map
;; Navigation mode
("k" . wspecial-worf-down)
("i" . wspecial-worf-up)
("c" . wspecial-worf-tab)
("C" . wspecial-worf-shifttab)
("ö" . wspecial-worf-right)
("<" . wspecial-worf-change-mode)
;; Delete Mode
:map worf-delete-mode-map
("k" . wspecial-worf-cut-subtree)
("i" . wspecial-worf-delete-k)
))
But this makes problems for example when I press a
to add a new heading below the current one the structure of my org file get's corrupted. Without my personal keys it does work fine and of course c
for change mode is not working anymore. Is there any way to change keys to xah fly keys sheme?
Due to the recent maturation of Ivy, I suggest dropping the Helm dependency and instead using Ivy for the goto function.
worf-tab
modifies the buffer when I just want to fold/unfold the subtree.
Hey,
Looks like worf-mode
treats beginning of buffer as special position, so instead of inserting letters it executes underlying commands.
org-mode
enabled.H
.Nothing here, move along
in the echo area.Instead I would like H
letter to be inserted.
To be honest it would not be such a pain if it's wasn't the same in org-campture-mode
. In some templates capture buffer is empty and you have to escape via C-q
first letter you type. I know that it's possible to disable worf-mode
via org-capture-mode-hook
, but I find worf-mode
useful in that mode as well.
Is such behaviour a bug? Or is it by design? If so, is it possible to change it? 😸
Thanks in advance.
P. S. Many thanks for this wonderful package!
**
a- added
:PROPERTIES:
:CUSTOM_ID: added
:END:
Represents /added/ heading. The behavior depends on the currently
active verb:
*** goto
Forward to =org-insert-heading-respect-content= (bound toC-RETin =org-mode=).*** change
Forward to =org-meta-return= (bound toM-RETin =org-mode=).*** keyword <--------------- HERE document is not true ---------------------------------->
Add a new heading with a corresponding keyword.For example
wtawill add a new TODO, andwnawill add a new
NEXT.
source: README.org
wta
would NOT add new heading with TODO status, instead, it makes the current heading as TODO keyword and adds a new heading without any keywords.
In worf.el, looks like "[" is mapped to worf-backwar in global map. how can I input "[" in org-mode, not in the header line
Is there no explicit (require 'hydra)
because another required package requires it? After updating, I've found worf no longer works ((void-variable hydra-worf-change)
) unless I add an explicit require.
I didn't have this issue before, so I'm not sure if it's because of my package manager (straight.el) or because another package that required hydra no longer does. If you think this is really unexpected, I will look into it further.
Hi worf gives an error when trying to jump to selected header i think since the last ivy update. the error is:
ivy-call: Wrong type argument: integer-or-marker-p, (#("2 ivy" 4 7 (pabbrev-added t face org-level-2 org-category "settings" fontified t)) . 59106)
i did reintsall both worf and ivy but that didnt seem to help. any clue?
thx
z
Hi
does worf still need counsel/swiper when installing new ivy 0.80 ? i uninstalled swiper/counsel after upgrading to ivy 0.8 but worf gives start up errors RE missing counsel. should i still keep swiper/counsel alongside ivy?
best
Z
C-return in org respects empty line conventions in your file. Is it possible to let wspecial-worf-add also do this?
* foo
* bar|
Gives:
* foo
* bar
* |
and
* foo
* bar|
Gives
* foo
* bar
* |
Hey,
I have spotted one pretty annoying bug that prevents me from using worf-todo
. When it's used it increments first number in heading by 1
. Some might not find it critical, but it's critical for me as it changed some important data in my headings without me noticing it. Note that calling C-c C-t
doesn't change anything in heading except for TODO
keyword.
First three steps are options, I just show how exactly I've tested it.
-Q
option.org
, hydra
and worf
package directories to load-path
and load them in that exact order.org-mode
file with following content.* Heading 1
** TODO Sub-heading 1: say 2
** TODO Sub-heading 2
worf-mode
(e. g. M-: (worf-mode)
).** TODO Sub-heading 1: say 2
).t
and select d
for DONE
.The second line changes from ** TODO Sub-heading 1: say 2
to ``** DONE Sub-heading 2: say 2`.
The second line changes from ** TODO Sub-heading 1: say 2
to ``** DONE Sub-heading 1: say 2` without changing any numbers in text.
Worf
version is 20161206.201
. If you need any more additional information, please let me know.
I do 'ct' on a headline and emacs complains that org-set-tags
is not a command (as indeed it isn't). Maybe the hydra should call org-set-tags-command
?
Emacs: 26.1
Org: 20190218 (melpa)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.