加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

vim – Emacs中是否有“设置粘贴”选项以粘贴外部剪贴板中的粘贴

发布时间:2020-12-15 21:47:29 所属栏目:安全 来源:网络整理
导读:我在远程机器上使用Emacs,它没有通过腻子的X窗口.问题是外部剪贴板(Shift Ins)的复制/粘贴速度很慢. 在Vim中,当我需要粘贴时有一个选项设置粘贴,那么Emacs是否有任何类似的功能? 我目前正在尝试一些解决方法:在粘贴之前,我将主模式更改为基本模式,然后禁用
我在远程机器上使用Emacs,它没有通过腻子的X窗口.问题是外部剪贴板(Shift Ins)的复制/粘贴速度很慢.

在Vim中,当我需要粘贴时有一个选项设置粘贴,那么Emacs是否有任何类似的功能?

我目前正在尝试一些解决方法:在粘贴之前,我将主模式更改为基本模式,然后禁用模式行中显示的次模式,以使副作用尽可能小.然而,它仍然比使用emacs -Q启动时慢得多.
在显示区域(迷你缓冲区)中,有以“匹配…”开头的消息(括号等).

那么如何妥善解决呢?

解决方法

我不知道Emacs的这种“粘贴模式”.您可以从以下内容开始(新版本,使用单独的缓冲区,以便当前缓冲区的* -change函数仅在最后调用一次):

(defvar ttypaste-mode nil)
(add-to-list 'minor-mode-alist '(ttypaste-mode " Paste"))

(defun ttypaste-mode ()
  (interactive)
  (let ((buf (current-buffer))
        (ttypaste-mode t))
    (with-temp-buffer
      (let ((stay t)
            (text (current-buffer)))
        (redisplay)
        (while stay
          (let ((char (let ((inhibit-redisplay t)) (read-event nil t 0.1))))
            (unless char
              (with-current-buffer buf (insert-buffer-substring text))
              (erase-buffer)
              (redisplay)
              (setq char (read-event nil t)))
            (cond
             ((not (characterp char)) (setq stay nil))
             ((eq char ?r) (insert ?n))
             ((eq char ?e)
              (if (sit-for 0.1 'nodisp) (setq stay nil) (insert ?e)))
             (t (insert char)))))
        (insert-buffer-substring text)))))

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读