3

誰かが私に手を再マッピングしてくれませんかorg-shiftmetaright| org-shiftmetaleft[shift-select-meta]left-word| [shift-select-meta]right-word]. 目標は、見出しのレベルを変更するのではなく、組織モードで一挙に (右または左の) 単語全体である選択領域を強調表示することです。シフトを放しても強調表示されませんが、それでも単語全体が左または右にジャンプします。

私はそれを想像しleft-wordright-wordおそらく"^"インタラクティブコマンドまたは同様のものにそのキャレットを持っているので、Shift-Left-WordまたはShift-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)

編集: これは、org-mode で使用しようとしている bindings.el の関数です。

(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)))
4

3 に答える 3

3

を設定しただけの場合(setq org-replace-disputed-keys t)、org-mode はこれらの競合するキーを再マップします。また、日付の選択で Shift + 矢印キーを引き続き使用できるため、これも好ましいです。

詳細については、 http://orgmode.org/manual/Conflicts.htmlを参照してください。

于 2014-12-16T00:30:06.123 に答える
3

信じられないかもしれませんが、私もこれをやりたかったのです。私は上記に従いました - また、これらのコマンドを 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)
 ))
于 2013-11-09T09:46:08.120 に答える