Emacs 的复制与粘贴

Emacs的剪贴、复制和粘贴 目录 1. 简介 2. 历史 3. 设计原理 4. Emacs中的CUA模式 5. 后话简介在一般的编辑器或IDE中,剪贴、复制、粘贴的快捷键通常是Ctrl-X, Ctrl-C, Ctrl-V,这种快捷键方式称之为CUA模式,或许用XCV模式更切贴。而在Emacs中剪贴、复制、粘贴的默认快捷键却是Ctrl-W, Alt-W, Ctrl-V。这一点让刚接触Emacs的人很费解,不好记。其实只要了解一下 阅读详情

增加Emacs的复制与粘贴功能。具体通过定义几个复制函数,将相关数据复制到删除环上,然后定义这些函数的快捷键。粘贴可以用Ctrl+y实现。现在的.Emacs文件内容如下:

 

(setq initial-frame-alist '((top . 0) (left . 0) (width . 1024) (height . 768)))
(column-number-mode t)
(transient-mark-mode t)
(setq line-number-mode t)
;;(setq default-tab-width 8)
(setq default-tab-width 4)
(customize-set-variable 'scroll-bar-mode' right)
(setq default-directory "/home/zhouyi198631/Study")
(setq inhibit-startup-message t)
(setq global-font-lock-mode t)
(setq make-backup-files nil)
(setq auto-save-mode nil)
(setq x-select-enable-clipboard t)
(setq mouse-yank-at-point t)
;;(define-key global-map [home] 'beginning-of-buffer)
;;(define-key global-map [end] 'end-of-buffer)
(define-key global-map [f3] 'display-line-number-mode-on)
(define-key global-map [C-f4] 'other-window)
(define-key global-map [f5] 'redraw-display)
(define-key global-map [f7] 'compile)
(setq-default compile-command "make")
;;(define-key global-map [f8] 'du-onekey-compile)
(define-key global-map [f6] 'gdb)
(define-key global-map [C-f9] 'previous-error)
(define-key global-map [f9] 'next-error)
;;(set-default-font "9x15")
;;(set-default-font "-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso10646-1")
(set-default-font "10x20")
;;(set-default-font "-outline-ÐÂËÎÌå-normal-r-normal-normal-14-*-96-96-c-*-gb2312")

;; Load CEDET
(load-file "~/.emacs.d/cedet-1.0pre6/common/cedet.el")
;; Enabling various SEMANTIC minor modes.  See semantic/INSTALL for more ideas.
;; Select one of the following:
;; * This enables the database and idle reparse engines
;;(semantic-load-enable-minimum-features)
;; * This enables some tools useful for coding, such as summary mode
;;   imenu support, and the semantic navigator
;;(semantic-load-enable-code-helpers)
;; * This enables even more coding tools such as the nascent intellisense mode
;;   decoration mode, and stickyfunc mode (plus regular code helpers)
;;(semantic-load-enable-guady-code-helpers)
;; * This turns on which-func support (Plus all other code helpers)
(semantic-load-enable-excessive-code-helpers)
;; This turns on modes that aid in grammar writing and semantic tool
;; development.  It does not enable any other features such as code
;; helpers above.
(semantic-load-enable-semantic-debugging-helpers)

;; 配置 Semantic
(setq semanticdb-project-roots (list (expand-file-name "/")))
(defun my-indent-or-complete ()
    (interactive)
    (if (looking-at "//>") (hippie-expand nil) (indent-for-tab-command))
)
(define-key global-map [(control tab)] 'my-indent-or-complete)
(autoload 'senator-try-expand-semantic "senator")
(setq hippie-expand-try-functions-list '(
    senator-try-expand-semantic
    try-expand-dabbrev
    try-expand-dabbrev-visible
    try-expand-dabbrev-all-buffers
    try-expand-dabbrev-from-kill
    try-expand-list
    try-expand-list-all-buffers
    try-expand-line
    try-expand-line-all-buffers
    try-complete-file-name-partially
    try-complete-file-name
    try-expand-whole-kill
))

(define-key global-map [(f4)] 'speedbar-get-focus)
(require 'cc-mode)
(c-set-offset 'inline-open 0)
;;(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
(defun my-c-mode-common-hook()
  (setq tab-width 8 indent-tabs-mode nil)
  (c-set-style "k&r")
  ;;; hungry-delete and auto-newline
  (c-toggle-auto-hungry-state 1) 
  (define-key c-mode-base-map [(control /')] 'hs-toggle-hiding)
;;  (define-key c-mode-base-map [(return)] 'newline-and-indent)
;;  (define-key c-mode-base-map [(f6)] 'compile)
  (define-key c-mode-base-map [(meta /')] 'c-indent-command)
;;  (define-key c-mode-base-map [(tab)] 'hippie-expand)
  (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
  (define-key c-mode-base-map [(meta /)] 'semantic-ia-complete-symbol-menu)
 
  (setq c-macro-shrink-window-flag t)
  (setq c-macro-preprocessor "cpp")
  (setq c-macro-cppflags " ")
  (setq c-macro-prompt-flag t)
  (setq hs-minor-mode t)
  (setq abbrev-mode t)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(defun my-c++-mode-hook()
  (setq tab-width 8 indent-tabs-mode nil)
;;  (c-set-style "stroustrup")
  (c-set-style "k&r")
;;  (define-key c++-mode-map [f3] 'replace-regexp)
)

(add-to-list 'load-path "~/.emacs.d")

(require 'display-line-number)
;;(load-library "linum.el")
(global-display-line-number-mode 1)
;;(setq display-line-number-mode-on t)
(add-hook 'c-mode-hook 'display-line-number-mode)
(add-hook 'cc-mode-hook 'display-line-number-mode)

(add-to-list 'load-path "~/.emacs.d/ecb-2.40")
;;(require 'ecb)
(require 'ecb-autoloads)

;;for gdb-many-window mode
(require 'gud)
(setq gdb-many-windows t)
;;(setq gud-tooltip-mode t)
;;(load-library "multi-gud.el")
;;(load-library "multi-gdb-ui.el")
(add-hook 'gdb-mode-hook '(lambda ()
  (gud-tooltip-mode 1)
  (define-key c-mode-base-map [f5] 'gud-go)
  (define-key c-mode-base-map [C-f5] 'gud-run)
  (define-key c-mode-base-map [S-f5] 'gud-cont)
  (define-key c-mode-base-map [f7] 'compile)
  (define-key c-mode-base-map [f8] 'gud-print)
  (define-key c-mode-base-map [C-f8] 'gud-pstar)
  (define-key c-mode-base-map [f9] 'gud-break)
  (define-key c-mode-base-map [C-f9] 'gud-remove)
  (define-key c-mode-base-map [f10] 'gud-next)
  (define-key c-mode-base-map [C-f10] 'gud-until)
  (define-key c-mode-base-map [S-f10] 'gud-jump)
  (define-key c-mode-base-map [f11] 'gud-step)
  (define-key c-mode-base-map [S-f11] 'gud-finish)))

;; 窗体切换
(require 'wcy-swbuff)
;; then you can use <C-tab> and <C-S-kp-tab> to switch buffer.
(define-key global-map (kbd "<C-tab>") 'wcy-switch-buffer-forward)
(define-key global-map (kbd "<C-S-kp-tab>") 'wcy-switch-buffer-backward)
(setq wcy-switch-buffer-active-buffer-face  'highlight)
(setq wcy-switch-buffer-inactive-buffer-face  'secondary-selection )

;; cscope in emacs
(add-to-list 'load-path "~/.emacs.d/cscope-15.7a/contrib/xcscope")
(require 'xcscope)

;; hotkey for cscope
(define-key global-map [(control f3)]  'cscope-set-initial-directory)
(define-key global-map [(control f4)]  'cscope-unset-initial-directory)
(define-key global-map [(control f5)]  'cscope-find-this-symbol)
(define-key global-map [(control f6)]  'cscope-find-global-definition)
(define-key global-map [(control f7)]
'cscope-find-global-definition-no-prompting)
(define-key global-map [(control f8)]  'cscope-pop-mark)
(define-key global-map [(control f9)]  'cscope-next-symbol)
(define-key global-map [(control f10)] 'cscope-next-file)
(define-key global-map [(control f11)] 'cscope-prev-symbol)
(define-key global-map [(control f12)] 'cscope-prev-file)
(define-key global-map [(meta f9)]  'cscope-display-buffer)
(define-key global-map [(meta f10)] 'cscope-display-buffer-toggle)
(set-face-background 'default "#334455")
(set-face-foreground 'default "wheat")
(set-cursor-color "white")
;;(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0")
;;(require 'color-theme)
;;(color-theme-dark-blue)

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(ecb-source-path (quote ("/home/zhouyi198631/linux"))))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )


;; 复制一行
(defun copy-line (&optional arg)
 "Save current line into Kill-Ring without mark the line"
 (interactive "P")
 (let ((beg (line-beginning-position))
        (end (line-end-position arg)))
 (copy-region-as-kill beg end))
)

;; 复制当前字
(defun copy-word (&optional arg)
 "Copy words at point"
 (interactive "P")
 (let ((beg (progn (if (looking-back "[a-zA-Z0-9]" 1) (backward-word 1)) (point)))
        (end (progn (forward-word arg) (point))))
 (copy-region-as-kill beg end))
)

;; 复制一个段落
(defun copy-paragraph (&optional arg)
 "Copy paragraphes at point"
 (interactive "P")
 (let ((beg (progn (backward-paragraph 1) (point)))
        (end (progn (forward-paragraph arg) (point))))
 (copy-region-as-kill beg end))
)

;; 复制一个字符串
(defun copy-string (&optional arg)
    "Copy a sequence of string into kill-ring"
    (interactive)
    (setq onPoint (point))
    (let (
            ( beg  (progn (re-search-backward "[/t ]" (line-beginning-position) 3 1)
                   (if (looking-at "[/t ]") (+ (point) 1) (point) ) )
            )
            ( end  (progn  (goto-char onPoint) (re-search-forward "[/t ]" (line-end-position) 3 1)
                   (if (looking-back "[/t ]") (- (point) 1) (point) ) )
            )
         )
     (copy-region-as-kill beg end)
     )
)

;; 快捷键
(setq x-select-enable-clipboard t)
(global-set-key (kbd "C-c w") (quote copy-word))
(global-set-key (kbd "C-c l") (quote copy-line))
(global-set-key (kbd "C-c p") (quote copy-paragraph))
(global-set-key (kbd "C-c s") (quote copy-string))

在emacs自动复制粘贴代码到终端运行 这个功能和emacs的包ess类似,可以将当前行或选中的区域弄到某个emacs里的R进程运行,但摆脱了须在emacs运行R的局限。 (defun wk.tmux.send.a-line (&optional line1 target) (if (not target) (setq target "R:R")) (call-process "tmux" nil nil nil "send-keys" "-t" target "-l" line1) (call-process 阅读详情

相关推荐

[HCTF 2018]WarmUp 1学习记录

#[HCTF 2018]WarmUp 1学习笔记 最近做了做ctf,觉得真的很有趣,后悔当初没早点做,不过之前的学习也让我得到了不少经验基础,废话不多说,这次ctf虽然基本上靠了网上的大佬们(因为比较菜),但自己也做了些思考,应该对新手也比较友好吧。 ##1 首先怎么找源码,我承认我确实刚开始不知道在哪找,不过也很快找到了,相信也会有部分新手和我差不多吧 然后下面控制台会有个temp0,然后直接回车 后面我就受到启发,直接在链接后面加上source.php,进行页面跳转,然后就可以开始PHP代码审计了。

weixin_45869407的博客 686

Emacs之快速复制(九十七)

本篇目的:快速复制/剪切函数名、变量、文件名、行号等。

Android系统攻城狮 448

Type-C快充移动电源芯片避坑指南:IP5356配置全流程(支持PD3.0)

本文详细解析了英集芯IP5356芯片在Type-C快充移动电源中的应用,提供了从芯片选型、原理图设计、PCB布局到PD协议调试的全流程实战指南。文章重点剖析了如何避免散热、EMI及协议握手等常见设计陷阱,并分享了量产前的关键测试验证方法,旨在帮助硬件开发者高效打造稳定可靠的快充产品。

weixin_29235525的博客 861

EMACS——常用快捷键

EMACS——常用快捷键基本命令 基本命令 C-x C-f 打开/新建文件 C-x C-s 保存当前缓冲区 C-x C-w 当前缓冲区另存为 C-x C-v 关闭当前Buffer并打开新文件 C-x i 光标处插入文件 C-x b 切换Buffer C-x C-b 显示Buffer列表 C-x k 关闭当前Buffer C-x C-c 关闭Emacs C-c C-z 终止shell中的进程 窗口命令 C-x 2

Snfiltration 1302

SpringBoot+VUE3实战:如何用WebSocket搞定网页端语音通话(避坑指南)

本文详细介绍了如何使用SpringBoot和VUE3结合WebSocket技术实现网页端语音通话功能。从环境配置、WebSocket服务端实现到前端音频处理,提供了完整的开发指南和避坑建议,帮助开发者快速构建稳定高效的实时语音通信系统。

weixin_29021195的博客 221

Verilog——反相器

反相器代码: module inv( A, Y );//A,Y是端口 //定义端口属性 input A; output Y; //定义输入输出关系 assign Y=~A;//Y等于A的反 endmodule //inv是module的名字

weixin_41788560的博客 9502

Emacs-025-Emacs中的复制粘贴

Emacs-025-Emacs中的复制粘贴        其实Emacs中的复制粘贴有好几种,就拿我现在手头用的Windows的GUI版本来说。GUI操作中的赋值粘贴功能就发现两个。由于两个功能差不多,这里的小结暂时以复制功能的小结为主。 1. 工具栏中的快捷图标,选中内容后直接鼠标点击即可,具体位置如下: 2. Edit菜单栏中的操作,具体位置如下: 3. 根据第

小灰笔记 2300

智能座舱(七)——智能音频系统

本文剖析车载智能音频系统的核心技术,聚焦音响、功放、麦克风和广播收音机四大组件。音响系统通过多声道布局(如23扬声器阵列)结合动态声场校准算法,实现三维声场覆盖;功放系统采用高效D类技术,支持OTA音效调整和故障自愈;麦克风阵列运用波束成形技术实现精准拾音,并保障隐私安全;广播系统融合数字与网络技术提升音质。核心在于硬件标准化与算法差异化的协同,未来将朝集成化、AI个性化方向发展。

DC20160101的博客 1579

emacs官网、安装、基本命令:移动、复制、黏贴、删除、查找

安装 使用

zhayushui的专栏 3812

Taro React组件使用(5) —— RuiPasswordInput 密码输入框显示隐藏和清空

初始化时,需要将传入的 value 赋值给当前组件的 value, 不能直接修改 props 的 value;在组件内输出组件内的变量时,最好先判断输出函数是否定义,再输出,否则很容易引起报错。

止于至善 892

Python 爬虫实战:爬取微博热搜与用户评论数据

本文系统讲解微博热搜榜单与用户评论数据的爬取技术方案。针对微博热搜榜采用Requests+BeautifulSoup解析静态HTML结构,实现高效爬取;对于动态加载的评论数据,使用Selenium模拟浏览器行为规避反爬机制。详细阐述技术选型、反爬策略、数据清洗及存储方法,提供完整代码实现和输出示例。同时强调合规要求,提示开发者需在遵守平台规则的前提下进行数据采集。该方案为舆情分析和热点研究提供了可落地的技术实现路径。

2503_91057718的博客 1719

Emacs终端下的复制、粘贴

在终端中使用-nw打开emacs,剪切板命令如clipboard-kill-region、clipboard-kill-ring-save、clipboard-yank会失效,下面是从网络上找到的解决办法,在此感谢各位大神。 //转自:http://vancel1.info/copy-paste-with-emacs-in-terminal/ //最终来源:http://hugoheden.w

6113

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

emacs复制粘贴和查找撤销

在emacs下复制粘贴是这样的。1、在任一行中按下ctrl+space键,最底行会显示 Mark set 表示已经开始标记了。2、移动鼠标或者选中文字然后,可以有两种方式:Alt+w(复制) 或者Ctrl+w(剪切)。如果您选择复制,Emacs会先回到标记的位置,让您查看选中的区域。3、最后,移动到您想要这段文本结束的地方并按下Ctrl+y。 但是,ctrl+space键...

bao8942的博客 306

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Emacs-078-evil复制粘贴小结

Emacs-078-evil复制粘贴小结        目前我自己掌握并且经常用的复制粘贴操作技巧如下: 首先说一下粘贴吧,这个多种情况都用得到。粘贴就是在普通模式下按下p,粘贴的插入位置是光标之后。 关于复制: 复制一行:yy 复制n行:nyy 还有一部分命令操作有点相对位置的概念,我觉得这种操作一定程度上依赖于我们自己的计算,不算直观,一般不用。而ed命令中的复制粘贴等功能,也是同

小灰笔记 885

Emacs复制粘贴乱码问题以及修改当前文件编码

编码修改: 为了和Linux兼容,win环境下将emacs编码修改为utf-8,随意复制了其他关于emacs编码的配置,如下: (setq locale-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-selection-coding...

weixin_30677617的博客 354

emacs中如何复制、剪切、粘贴

<br />keyboard: Go to the beginning of the region and hit Ctrl-space. Go to the end, and type Ctrl-w to cut or Meta-w to copy. Go to the destination, and type Ctrl-y to paste. <br />On pc, Meta replaced by Alt

renrenhappy的专栏 1万+

emacs技巧--鼠标粘贴复制

用鼠标粘贴复制我们一定都用过,过程大致如下:写作过程中,要粘贴上面的内容到现在的地方,首先把鼠标移到要复制的东西的地方,选中,移回来,用鼠标中键粘贴。新方法:按住M(win中alt),首先把鼠标移到要复制的东西的地方,选中,用鼠标中键粘贴。自动粘贴到了刚才光标的位置。少动一次,还剩了眼睛,找来找去。我就是这么懒------有了前面的自动补全的功能,这招用得比较少。只用粘贴得东西太古怪的时候才有用。

wti的专栏 4496

emacs 高级的 复制 剪切 粘贴

;; (defun my-copy-lines(num)   (point-to-register 0)   (beginning-of-line)   (let ((begin-point (point)))     (forward-line num)     (copy-region-as-kill begin-point (point)))   (jump-to-re

xcwenn的专栏 1805

Emacs复制粘贴等常用命令

选中某一块区域:CTRL+@(CTRL+SHIFT+2)或者CTRL+SPACE 移动光标到合适的位置(CTRL+p、CTRL+n、CTRL+f、CTRL+b分别是向上、下、前、后 来移动光标)。剪切快捷键:CTRL+k 删除当前位置到行末,CTRL+d相当于键盘上的DELETE键,删除前面的字符:BACKSPACE复制快捷键:ALT+w,将当前选中的文本复制到缓冲区。粘贴快...

weixin_33979203的博客 296

Emacs-077-evil复制行

Emacs-077-evil复制行 行复制命令:yy 粘贴:p

小灰笔记 557

EMACS學習

今天下載了EMACS,把常用的功能列举一下,以后可以自己查询。 c-v  下一屏 m-v  上一屏 c-l  屏中间                   c-p             c-b            c-f                     c-n                                 --上下前后移动 m-b,m-f  移动的单位为...

weixin_34252090的博客 161

Emacs入门指南(2)

  前面已经介绍了如何打开、保存文件,这一次我们将先介绍如何在文档中移动光标(光标在Emacs术语中表示为Point)。  你固然可以在Emacs中用习惯的光标移动键来移动光标,但这不符合Emacs“手不离主键盘”的设计理念,所以它设计了令类的光标移动方法。  最简单的移动当然就是上下左右了,对应的键是C-p, C-n, C-b, C-f,为了方便记忆,请记住pnbf是previous line、

李凡希的Blog 3898

[Emacs] emacs中如何复制当前缓冲区的全部内容

通过宏定义,定制复制缓冲区所有内容的功能。

on_1y 3288
上一篇: Emacs快捷键
下一篇: skyeye1.3.0在ubuntu 9.10 下的编译安装
Matrix_Designer
博客等级 码龄16年 58粉丝 296原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值