首页 > emacs可不可以像vim那样c-e/c-y一行一行的滚动~?

emacs可不可以像vim那样c-e/c-y一行一行的滚动~?

c-v/m-v一滚就滚全屏幕.


可以使用 scroll-up-line 和 scroll-down-line


我的.emacs中这样设置了下,ALT + P/N 可以方便的上下滚动

(defun hold-line-scroll-up()
"Scroll the page with the cursor in the same line"
(interactive)
(let ((next-screen-context-lines
(count-lines
(window-start) (window-end))))
(scroll-up)))
(global-set-key (kbd "M-N") 'hold-line-scroll-up)
;;
(defun hold-line-scroll-down()
"Scroll the page with the cursor in the same line"
(interactive)
(let ((next-screen-context-lines
(count-lines
(window-start) (window-end))))
(scroll-down)))
(global-set-key (kbd "M-P") 'hold-line-scroll-down)


c-nnnnnnn...


你可以使用evil-mode这个插件。挺好用。


用这个,让它自己滚动,看行不行:

(use-package smooth-scrolling
  :ensure t
  :defer t
  :init
  (progn
    (setq smooth-scroll-margin 5)
      (smooth-scrolling-mode 1)
    )

  )

(provide 'xhx-smooth-scrolling)

C => ctrl
M => Alt

你可以用C-n ,C-l达到类似效果。但肯定没有你vi的方便。当然可以自己定义函数实现。
说到光标移动,emacs一般都是靠C-s,搜索去移动。再配合ace-jump插件。还有在编程语言中M-nM-p可以跳转到下一个和当前单词一样的单词。对应的函数是highlight-symbol-next,可能要装highlight-symbol.el插件。

ps:我用的是purcell的配置。


看到滚动相关的问题必推荐 https://github.com/zk-phi/sublimity :D
其实在知道滚到哪里的情况下,滚一屏没啥不好的

【热门文章】
【热门文章】