具有 Windows 风格键绑定的 Xemacs
Xemacs 是否可用于 Windows 样式键绑定 ? Emacs 有这些 Windows 键绑定
Emacs 的键绑定早于 现代 GUI,以及过去的按键 由后来的 GUI 选择进行剪切和复制 被赋予了重要的职能,如 Emacs 中的扩展键盘映射。 CUA模式 尝试让两种绑定共存 通过将 Cx 和 Cc 定义为终止区域 和 copy-region-as-kill 当 区域很活跃,让他们 具有正常的 Emacs 绑定 该区域不活跃。很多人 发现这是可以接受的 妥协。 CUA模式还定义了一个 其他键的数量(Cv、Shift 选择),并且可以从 选项菜单
Is Xemacs available with Windows Style Key Bindings ?
Emacs has these Windows key bindings
The keybindings of Emacs predate
modern GUIs, and the keys that were
chosen by later GUIs for cut and copy
were given important functions as
extended keymaps in Emacs. CUA mode
attempts to let both bindings co-exist
by defining C-x and C-c as kill-region
and copy-region-as-kill when the
region is active, and letting them
have their normal Emacs bindings when
the region is not active. Many people
find this to be an acceptable
compromise. CUA mode also defines a
number of other keys (C-v, Shift
selection), and can be turned on from
the Options menu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您可以忍受 emacs 而不是 Xemacs,那么有 EmacsW32
它是经过简单修改的 emacs,以便更好地与 Windows 集成。它有很多功能,包括 emacs/win 键绑定之间的选择。
来自网页:
If you could put up with emacs instead of Xemacs there is EmacsW32
it's plain emacs modified to integrate better with windows. It has a lot of features including a choice between emacs/win keybindings.
From webpage:
我不确定您正在寻找哪个 Windows 键绑定,可能是剪切、复制、粘贴?这称为 CUA,默认情况下它不附带这些键绑定,但可以轻松添加它们。
这是一个具有 xemacs CUA 模式的站点的链接。您应该能够安装 XEmacs,然后添加 CUA 模式,从而有效地创建您想要的内容。
http://sites.google.com/site/olegalexandrov/xemacs
或者,您可以自己添加它们,并在 init.el 文件中添加几行键分配。首先使用 Cx Ce 在缓冲区中尝试运行它们并确保它们工作。
我不使用kill-ring,并且想以不同的方式标记块,因此我在文件 skm-mark-blocks.el 中编写了一些函数,我将尝试在此处插入或附加该函数。在文件末尾,您可以看到 global-set-key 行,并将它们用作模板,使 Windows 键按照在 Windows 中的方式工作。
-剪断--------------------------------------
; skm-blocks.el
;拜雷尔和史蒂夫·米切尔
; 2009 年 11 月 12 日
;通过以下方式标记块:
;用于标记第一个和第二个块结束标记的相同键
;一旦标记了两端,就可以使用复制、剪切、移动和复制键。删除块
;
;目标:
;用左手执行所有块命令:标记、复制、移动、删除等
;右手用光标键在缓冲区中定位
;
;第一次写模仿 Vedit+ 方法(右手)::
; F9 标记第一端,
; F9 标记第二个结尾,
;然后 Cntl-F9(复制到光标)或 Alt-F9(移动到光标)
; Vedit+ 在块突出显示时使用删除键来删除
堵塞。不会在这里工作
;所以我们定义一个具有相同前缀(super)的键来删除突出显示的块
;
;可能的改进:
;添加变量来选择在 block 时如何移动点(或光标位置或块标记)
;被复制等
;也就是说,这些东西是否随块移动,留在原来的位置
;或移动到新块的末尾等
;添加功能来取消标记所有块结束?
;当前标记了“第三”端,取消了之前的 2 端标记
选定的块结束
;并将第三端视为标记块的新第一端
;除了我的缩写之外,为这种块标记找到一个名称。
;添加使用新组合键进行柱状块标记(矩形)的功能。
;添加变量来配置柱状块标记应如何工作、插入、覆盖等
;
(defvar block-marker-highlight-mode 1
(defvar block-marker-end-position-mode t
插入块
(defvar block-mark1 (point-marker)) ;var 保存块的第一个结尾
(defvar block-mark2 ( point-marker)) ;var 保存块的第二个末端
(defvar block-ends-marked 0) ;0 如果没有标记末端,
;1 或 2 表示标记的结束数
(defvar block-copiedp nil) ;t 如果块已复制
;-------- mark-block ----------------- ---------
(defun mark-block ()
“用 skm 类型块标记块的任一端。”
(交互式)
(if ( or (eq block-ends-marked 0 ) (eq block-ends-标记为 2))
;我们正在标记块的第一端吗?
;-------- copy-block-to-point -----------------
(defun copy-block-to-point ()
"复制 skm 标记的块到 cur. pos. "
(交互式)
(let ((start-pos (point)))
;-------- 移动块到点 ------------ -----
(defun move-block-to-point ()
"将 skm 标记的块移动到当前光标位置。"
(交互式)
(if ( < block-ends-marked 2)
;------ -- cut-block ---------------------------
(defun cut-block ()
"从文件中剪切 skm 标记的块。"
( Interactive)
(if ( < block-ends-marked 2)
;------- 持续高亮显示一个块 --------------
(defunhighlight-region ()
(interactive)
(let ( new-extent) (setq new-extent (make-extent (标记 t)
(point)))
;------- 清除缓冲区中突出显示的块 -----------
(defun clear-highlighting-whole-buffer (&可选缓冲区)
(交互式)
( let ((highlighted-list (extent-list buffer nil nil nil 'face 'zmacs-region)))
(defun clear-highlighting-at-point (&可选缓冲区位置)
(交互式)
(if (不是位置)
(while (extent-at 位置缓冲区 'wordstar-block nil 'at )
;------------ 键分配 ------------------
;-- - 模仿 VEdit+ 方法的按键分配
;--- 验证我们的算法是否正确
;--- 一旦不需要它们就注释掉
(global-set-key [ f9 ] 'mark-block)
(global-set-key [ ( control f9) ] '复制块到点)
(global-set-key [ (meta f9) ] '移动块到点)
(global-set-key [ (control meta f9) ] '剪切- block) ;不在 Vedit 中,但用于测试
(global-set-key [ (control shift f9) ] 'clear-highlighting) ;不在 Vedit 中,但用于测试
;-------- 左手使用的键分配
;--- 仅使用超级键(左 Windows 徽标键)移动
;由于 Windows 抢占了超级键,因此不适用于 Windows 中的 xemacs
;必须尝试找到一些适用于 Windows 的东西'
xemacs...
(global-set-key [ (super space) ] 'mark-block)
(global-set-key [ (super v) ] 'copy-block-to-point) ;助记符:V 表示插入、驱动器a V (wedge) in
(global-set-key [ (super m) ] 'move-block-to-point) ;助记符:M 表示移动
(global-set-key [ (super c) ] 'cut-block) ;助记符:C 代表剪切
(global-set-key [ (super n) ] 'clear-highlighting-at-point)
;助记符:认为 N 代表不突出显示
--snip------------ -----
希望这可以帮助您了解这是多么容易做到的。
在看到代码如何进入此消息后,很明显我需要一些练习将代码放入此编辑器中(咧嘴笑)。
I'm not sure which Windows key bindings you are looking for, probably cut.copy,paste? That is called CUA and no it does not come with those key bindings by default, but they can be easily added.
Here's a link to a site that has a CUA-mode for xemacs. You should be able to install XEmacs, then add the CUA-mode, effectively creating what you are wanting.
http://sites.google.com/site/olegalexandrov/xemacs
Alternatively, you can add them yourself with a few lines of key assignments added to your init.el file. Try them first in a buffer with C-x C-e to run them and make sure they work.
I do not use the kill-ring and wanted to mark blocks a different way, so I wrote some functions in a file skm-mark-blocks.el which I will try to insert or attach here. At the end of the file you can see the global-set-key lines and use them as a template for making the Windows keys work the way they do in Windows.
-snip--------------------------------------
; skm-blocks.el
; Byrel and Steve Mitchell
; Nov 12, 2009
; mark blocks by:
; same key for marking first and second block end markers
; once both ends marked, keys to copy, cut, move, & delete block
;
; Goal:
; to do all block commands: mark, copy, move, del, etc. with the left hand
; while the right hand used for positioning in buffer with cursor keys
;
; first written mimicing Vedit+ method (for right hand)::
; F9 to mark first end,
; F9 to mark second end,
; then Cntl-F9 (copy to cursor) or Alt-F9 (move to cursor)
; Vedit+ uses the delete key while block highlighted to delete
block. Won't work here
; so we define a key with the same prefix (super) for deleting highlighted block
;
; possible improvements:
; add vars to choose how point (or cursor position or block markers) is moved when block
; is copied, etc.
; that is, do these things move with the block, stay where they were was,
; or move to end of new block, etc.
; add function to unmark all block ends?
; currently marking a "third" end unmarks the 2 previously
selected block ends
; and counts the third end as marking a new first end of block
; find a name for this kind of block marking other than my intials.
; add functions to do columnar block marking (rectangles), with new key combinations.
; add vars to config how columnar block marking should work, insert, overwrite, etc.
;
(defvar block-marker-highlight-mode 1
(defvar block-marker-end-position-mode t
inserted block
(defvar block-mark1 (point-marker)) ;var to hold 1st end of our block
(defvar block-mark2 (point-marker)) ;var to hold 2nd end of our block
(defvar block-ends-marked 0) ;0 if no ends marked,
;1 or 2 for number of ends marked
(defvar block-copiedp nil) ;t if block copied
;-------- mark-block --------------------------
(defun mark-block ()
"Marks either end of block with skm type blocks."
(interactive)
(if ( or (eq block-ends-marked 0 ) (eq block-ends-marked 2))
;are we marking the first end of a block?
;-------- copy-block-to-point -----------------
(defun copy-block-to-point ()
"Copies skm-marked block to cur. cursor pos. "
(interactive)
(let ((start-pos (point)))
;-------- move-block-to-point -----------------
(defun move-block-to-point ()
"Moves skm-marked block to current cursor pos. "
(interactive)
(if ( < block-ends-marked 2)
;-------- cut-block ---------------------------
(defun cut-block ()
"Cuts skm-marked block from file."
(interactive)
(if ( < block-ends-marked 2)
;------- highlight a block persistantly -----------
(defun highlight-region ()
(interactive)
(let (new-extent) (setq new-extent (make-extent (mark t)
(point)))
;------- clear the highlighted blocks in a buffer -----------
(defun clear-highlighting-whole-buffer (&optional buffer)
(interactive)
(let ((highlighted-list (extent-list buffer nil nil nil 'face 'zmacs-region)))
(defun clear-highlighting-at-point (&optional buffer position)
(interactive)
(if (not position)
(while (extent-at position buffer 'wordstar-block nil 'at )
;------------key assignments ------------------
;--- key assignments to mimic VEdit+ method
;--- to verify we have algorithm correct
;--- comment out once they are not needed
(global-set-key [ f9 ] 'mark-block)
(global-set-key [ (control f9) ] 'copy-block-to-point)
(global-set-key [ (meta f9) ] 'move-block-to-point)
(global-set-key [ (control meta f9) ] 'cut-block) ;not in Vedit, but for testing
(global-set-key [ (control shift f9) ] 'clear-highlighting) ;not in Vedit, but for testing
;------- key assignments for left hand use
;--- using only super key (left windows-logo key) shifting
;Doesn't work with xemacs in Windows since Windows preempts the super key
; have to experiment to find something to work for windows'
xemacs...
(global-set-key [ (super space) ] 'mark-block)
(global-set-key [ (super v) ] 'copy-block-to-point) ;mnemonic: V for insert, drive a V (wedge) in
(global-set-key [ (super m) ] 'move-block-to-point) ;mnemonic: M for move
(global-set-key [ (super c) ] 'cut-block) ;mnemonic: C for Cut
(global-set-key [ (super n) ] 'clear-highlighting-at-point)
;mnemonic: think N for No highlighting
--snip-----------------
Hope this helps you see how easy it is to do.
After seeing how the code went into this message, it is obvious that I need some practice putting code into this editor (grin).