emacs - 水平和垂直拆分的快捷方式

时间:2014-08-09 10:55:59

标签: emacs

我从vim切换到emacs,在我的.vimrc中,我有以下快捷方式,用于水平和垂直分割屏幕:

" Create window splits easier. The default
" way is Ctrl-w,v and Ctrl-w,s. I remap
" this to vv and ss
nnoremap <silent> vv <C-w>v
nnoremap <silent> ss <C-w>s

我怎么能在emacs中这样做?

2 个答案:

答案 0 :(得分:4)

欢迎使用Emacs - 我从之前的几个问题中看到您正在使用evil Vim仿真层。这是简短版本:

(define-key evil-normal-state-map "vv" 'split-window-horizontally)
(define-key evil-normal-state-map "ss" 'split-window-vertically)

查看evil上的EmacsWiki page,以及(遗憾的过时)Evil manual

我还建议浏览evil源代码,以了解如何使用find-library功能绑定密钥等操作。 M-x find-library RET evilM-x find-library RET evil-maps应该让你开始。

答案 1 :(得分:4)

除非您计划为Emacs使用某些vim仿真模式,例如evil-mode,否则您可能会对标准的窗口拆分方式感兴趣:

  • C-x 2 - split-window-below(垂直分割)
  • C-x 3 - split-window-right(水平分割)
  • C-x 0 - delete-window(删除当前窗口)
  • C-x 1 - delete-other-windows(使当前窗口填满框架)