【发布时间】:2010-12-15 17:40:45
【问题描述】:
我设法通过(set-variable 'shift-select-mode nil) 禁用了内置的移位选择。我喜欢CUA模式的C-Ret-column-selection。但 CUA 会自动启用移位选择(但似乎不是通过变量 shift-select-mode)。
- 那么,是否有可能在 CUA 模式下禁用移位选择?
- 或者:有没有办法专门使用 CUA 模式的列选择功能,即没有任何其他 CUA 事物?
【问题讨论】:
我设法通过(set-variable 'shift-select-mode nil) 禁用了内置的移位选择。我喜欢CUA模式的C-Ret-column-selection。但 CUA 会自动启用移位选择(但似乎不是通过变量 shift-select-mode)。
【问题讨论】:
这不是一个解决方案,但仅供参考......
我注意到cua-mode 的帮助中提到了这个变量
cua-highlight-region-shift-only is a variable defined in `cua-base.el'.
*If non-nil, only highlight region if marked with S-<move>.
When this is non-nil, CUA toggles `transient-mark-mode' on when the region
is marked using shifted movement keys, and off when the mark is cleared.
But when the mark was set using M-x cua-set-mark, Transient Mark mode
is not turned on.
cua-mode 这样做:
(setq shift-select-mode nil)
(setq transient-mark-mode (and cua-mode
(if cua-highlight-region-shift-only
(not cua--explicit-region-start)
t))))
【讨论】:
具体来说,要禁用 cua-mode 的移位选择,请在打开 cua-mode 之前将以下内容添加到您的 init 文件(例如 .emacs):
(setq cua-enable-cua-keys nil)
(setq cua-highlight-region-shift-only t) ;; no transient mark mode
(setq cua-toggle-set-mark nil) ;; original set-mark behavior, i.e. no transient-mark-mode
...
(cua-mode)
【讨论】:
要仅从 Cua 启用矩形(列)编辑,您可以使用以下命令(来自 emacs-fu)
(setq cua-enable-cua-keys nil) ;;仅适用于矩形 (cua-mode t)
【讨论】: