有人请给我一只手重新映射org-shiftmetaright
| org-shiftmetaleft
到[shift-select-meta]left-word
| [shift-select-meta]right-word]
。目标是在组织模式中一举突出选择区域是一个完整的单词(右或左),而不是改变标题的级别。当我释放班次时不要突出显示,但不过向左或向右跳出整个单词。
我认为left-word
和right-word
可能在交互式命令中有那个插入符号"^"
,或者类似的东西,所以没有单独的用于左移或左移的功能右汉字字。
(defvar custom-keys-mode-map (make-keymap) "custom-keys-mode keymap.")
(define-minor-mode custom-keys-mode
"A minor mode so that my key settings override annoying major modes."
t " my-keys" 'custom-keys-mode-map)
(custom-keys-mode 1)
(defun my-minibuffer-setup-hook ()
(custom-keys-mode 0))
(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
(defadvice load (after give-my-keybindings-priority)
"Try to ensure that my keybindings always have priority."
(if (not (eq (car (car minor-mode-map-alist)) 'custom-keys-mode))
(let ((mykeys (assq 'custom-keys-mode minor-mode-map-alist)))
(assq-delete-all 'custom-keys-mode minor-mode-map-alist)
(add-to-list 'minor-mode-map-alist mykeys))))
(ad-activate 'load)
;; (define-key custom-keys-mode-map (kbd "<C-key>") 'some-command)
(define-key custom-keys-mode-map (kbd "M-<left>") 'left-word)
(define-key custom-keys-mode-map (kbd "M-<right>") 'right-word)
(define-key custom-keys-mode-map (kbd "M-S-<left>") 'left-word)
(define-key custom-keys-mode-map (kbd "M-S-<right>") 'right-word)
编辑:这是来自bindings.el的函数,我希望在org-mode中使用:
(defun right-word (&optional n)
"Move point N words to the right (to the left if N is negative).
Depending on the bidirectional context, this may move either forward
or backward in the buffer. This is in contrast with \\[forward-word]
and \\[backward-word], which see.
Value is normally t.
If an edge of the buffer or a field boundary is reached, point is left there
there and the function returns nil. Field boundaries are not noticed
if `inhibit-field-text-motion' is non-nil."
(interactive "^p")
(if (eq (current-bidi-paragraph-direction) 'left-to-right)
(forward-word n)
(backward-word n)))
(defun left-word (&optional n)
"Move point N words to the left (to the right if N is negative).
Depending on the bidirectional context, this may move either backward
or forward in the buffer. This is in contrast with \\[backward-word]
and \\[forward-word], which see.
Value is normally t.
If an edge of the buffer or a field boundary is reached, point is left there
there and the function returns nil. Field boundaries are not noticed
if `inhibit-field-text-motion' is non-nil."
(interactive "^p")
(if (eq (current-bidi-paragraph-direction) 'left-to-right)
(backward-word n)
(forward-word n)))
答案 0 :(得分:5)
由于您只想回到这些绑定的默认行为,我们可以简单地删除org-mode覆盖。
(eval-after-load "org"
'(progn
(define-key org-mode-map (kbd "<M-S-left>") nil)
(define-key org-mode-map (kbd "<M-S-right>") nil)
(define-key org-mode-map (kbd "<M-left>") nil)
(define-key org-mode-map (kbd "<M-right>") nil)))
答案 1 :(得分:3)
如果您只设置(setq org-replace-disputed-keys t)
,则org-mode将重新映射这些冲突的密钥。它也是首选,因为您仍然可以在日期选择中使用Shift +箭头键。
有关详细信息,请参阅http://orgmode.org/manual/Conflicts.html。
答案 2 :(得分:2)
信不信由我也想这样做。我按照上面的说法 - 我还将这些命令重新绑定到C键:
(eval-after-load "org"
'(progn
(define-key org-mode-map (kbd "<M-S-left>") nil)
(define-key org-mode-map (kbd "<M-S-right>") nil)
(define-key org-mode-map (kbd "<M-left>") nil)
(define-key org-mode-map (kbd "<M-right>") nil)
(define-key org-mode-map [C-S-right] 'org-shiftmetaright)
(define-key org-mode-map [C-S-left] 'org-shiftmetaleft)
(define-key org-mode-map [C-right] 'org-metaright)
(define-key org-mode-map [C-left] 'org-metaleft)
(define-key org-mode-map [C-S-return] 'org-insert-todo-heading)
))