我正在寻找一种已经可以在带有标题的操作模式下使用的解决方案,例如:
* HL1
* HL2 {press: Meta+arrowup}=>
* HL2
* HL1(1)我想换段话。基本的想法是,我把这个点移到一个{示例:这里[]}在一个段落的中间,按{key+arrowdown},这个段落将与下面的一个切换。
(2)这将使在编辑论文时更容易调整文本结构。
=>第(2)款现在应该放在第(1)款前面。我不知道这是否一个微不足道的问题。如果它是(而不是),那么它将更合适,它只是一个函数,如:
P1和P2的真正转换不会使段落周围的间隔变得混乱。
谢谢,
编辑:找到解决方案:
1.容易:
(global-set-key (kbd "M-ü") 'transpose-paragraphs) ;; forward
(global-set-key (kbd "C-M-ü")
(lambda () (interactive) (transpose-paragraphs -1)
(backward-paragraph)
)) ;; backwards2.详细阐述(在ergoemacs-functions.el中找到-目前只有org-mode):
(defmacro ergoemacs-define-org-meta (direction &optional disable)
"Defines org-mode meta-direction keys.
DIRECTION defines the `org-mode' and `ergoemacs-mode' direction.
DISABLE defines if the option should be disabled by default."
`(progn
(defcustom ,(intern (format "ergoemacs-use-ergoemacs-meta%s" direction)) ,(not disable)
,(format "Use ergoemacs-mode defined <M-%s>." direction)
:type 'boolean
:group 'ergoemacs-mode)
(defun ,(intern (format "ergoemacs-org-meta%s" direction)) ()
,(format "Run `org-meta%s' in the proper context.
When `ergoemacs-use-ergoemacs-meta%s' is non-nil use what ergoemacs-mode defines for <M-%s>.
ARG is the prefix argument for either command." direction direction direction)
(interactive)
(cond
((or
(not ,(intern (format "ergoemacs-use-ergoemacs-meta%s" direction)))
(org-at-heading-p)
(org-at-item-p)
(org-at-table-p)
(and (org-region-active-p)
(save-excursion
(goto-char (region-beginning))
(org-at-item-p)))
(org-with-limited-levels
(or (org-at-heading-p)
(and (org-region-active-p)
(save-excursion
(goto-char (region-beginning))
(org-at-heading-p))))))
;; (setq prefix-arg current-prefix-arg)
;; Send prefix to next function
(call-interactively ',(intern (format "org-meta%s" direction))))
(t
;; (setq prefix-arg current-prefix-arg)
;; Send prefix to next function
(ergoemacs-lookup-key-and-run ,(format "<M-%s>" direction)))))))
(ergoemacs-define-org-meta "left")
(ergoemacs-define-org-meta "right")
(ergoemacs-define-org-meta "up" t)
(ergoemacs-define-org-meta "down" t)请确认工作!
发布于 2015-07-14 18:35:27
转置-段落
transpose-paragraphs听起来像你想要的函数。它是interactive,所以您可以使用M-x调用它。如果您发现您非常需要它,请考虑将它绑定到一个键(也许是M-T?)。
编辑(讨论摘要如下)
用户lpoik发现,在他/她的系统上,带有-1参数的-1并没有使point处于正确的位置(在两段之间),以便随后重复操作,将段落再向上移动一段。解决办法是在之后使用backward-paragraph移动点:
(defun my-transpose-paragraphs-backward ()
(interactive "*")
(transpose-paragraphs -1)
(backward-paragraph))
(global-set-key (kbd "C-M-ü") 'my-transpose-paragraphs-backward)如果您让my-transpose-paragraphs-backward接受一个数值参数,我不知道这是否也有效:
(defun my-transpose-paragraphs-backward (arg)
(interactive "*p")
(transpose-paragraphs (- arg))
(backward-paragraph))https://stackoverflow.com/questions/31412903
复制相似问题