vim中copy或者delete的技巧

DeepSeek 框架和技术栈分析 DeepSeek 诞生于对更高效、更强大的深度学习计算和模型训练的追求。随着深度学习模型的规模不断增大,如大型语言模型(LLMs)和复杂的视觉模型,传统的框架在处理这些大规模模型时面临着性能瓶颈和资源利用效率低下的问题。DeepSeek 旨在解决这些问题,通过优化框架设计和采用先进的技术栈,实现更高效的模型训练和推理,同时降低计算成本。 阅读详情

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a synonym for y_. The y is doubled up to make it easier to type, since it is such a common operation.

This can also be expressed as dd P (delete the current line and paste a copy back into place; leaving a copy in the anonymous register as a side effect). The y and d "verbs" take any movement as their "subject." Thus yW is "yank from here (the cursor) to the end of the current/next (big) word" and y'a is "yank from here to the line containing the mark named 'a'."

If you only understand basic up, down, left, and right cursor movements then vi will be no more productive than a copy of "notepad" for you. (Okay, you'll still have syntax highlighting and the ability to handle files larger than a piddling ~45KB or so; but work with me here).

vi has 26 "marks" and 26 "registers." A mark is set to any cursor location using the m command. Each mark is designated by a single lower case letter. Thus ma sets the 'a' mark to the current location, and mz sets the 'z' mark. You can move to the line containing a mark using the ' (single quote) command. Thus 'a moves to the beginning of the line containing the 'a' mark. You can move to the precise location of any mark using the ` (backquote) command. Thus `z will move directly to the exact location of the 'z' mark.

Because these are "movements" they can also be used as subjects for other "statements."

So, one way to cut an arbitrary selection of text would be to drop a mark (I usually use 'a' as my "first" mark, 'z' as my next mark, 'b' as another, and 'e' as yet another (I don't recall ever having interactively used more than four marks in 15 years of using vi; one creates one's own conventions regarding how marks and registers are used by macros that don't disturb one's interactive context). Then we go to the other end of our desired text; we can start at either end, it doesn't matter. Then we can simply use d`a to cut or y`a to copy. Thus the whole process has a 5 keystrokes overhead (six if we started in "insert" mode and needed to Esc out command mode). Once we've cut or copied then pasting in a copy is a single keystroke: p.

I say that this is one way to cut or copy text. However, it is only one of many. Frequently we can more succinctly describe the range of text without moving our cursor around and dropping a mark. For example if I'm in a paragraph of text I can use { and } movements to the beginning or end of the paragraph respectively. So, to move a paragraph of text I cut it using { d} (3 keystrokes). (If I happen to already be on the first or last line of the paragraph I can then simply use d} or d{ respectively.

The notion of "paragraph" defaults to something which is usually intuitively reasonable. Thus it often works for code as well as prose.

Frequently we know some pattern (regular expression) that marks one end or the other of the text in which we're interested. Searching forwards or backwards are movements in vi. Thus they can also be used as "subjects" in our "statements." So I can use d/foo to cut from the current line to the next line containing the string "foo" and y?bar to copy from the current line to the most recent (previous) line containing "bar." If I don't want whole lines I can still use the search movements (as statements of their own), drop my mark(s) and use the `x commands as described previously.

In addition to "verbs" and "subjects" vi also has "objects" (in the grammatical sense of the term). So far I've only described the use of the anonymous register. However, I can use any of the 26 "named" registers by prefixing the "object" reference with " (the double quote modifier). Thus if I use "add I'm cutting the current line into the 'a' register and if I use "by/foo then I'm yanking a copy of the text from here to the next line containing "foo" into the 'b' register. To paste from a register I simply prefix the paste with the same modifier sequence: "ap pastes a copy of the 'a' register's contents into the text after the cursor and "bP pastes a copy from 'b' to before the current line.

This notion of "prefixes" also adds the analogs of grammatical "adjectives" and "adverbs' to our text manipulation "language." Most commands (verbs) and movement (verbs or objects, depending on context) can also take numeric prefixes. Thus 3J means "join the next three lines" and d5} means "delete from the current line through the end of the fifth paragraph down from here."

This is all intermediate level vi. None of it is Vim specific and there are far more advanced tricks in vi if you're ready to learn them. If you were to master just these intermediate concepts then you'd probably find that you rarely need to write any macros because the text manipulation language is sufficiently concise and expressive to do most things easily enough using the editor's "native" language.


Q3D提取PCB走线RLCG参数 介绍一种提取PCB走线寄生电容和寄生电感的方法 阅读详情

相关推荐

CGNS快速入门到实战(一):CGNS静态链接库编译

近期,由于需要将CGNS格式加入到教研组自编CFD求解器DUBHE中,所以本人展开了对于CGNS的学习。CGNS快速入门到实战这一系列分成三篇文章展开叙述,具体有:(一)CGNS静态链接库编译;(二)VS配置调用CGNS静态链接库编写;(三)CGNS文件及案例展示。本篇文章重点讲述CGNS静态链接库编译。

ahang_99的博客 3832

搞懂vim复制粘贴

复制粘贴是文本编辑最常用的功能,但是在vim中复制粘贴还是有点麻烦的,有一点学习成本。本文总结了使用vim复制粘贴的典型场景和使用方法,希望对读者有帮助。

2201_75644755的博客 7062

dify工作流的原理

摘要: Dify 工作流是一个基于有向无环图(DAG)的智能任务编排系统,支持多节点(如LLM调用、API工具、条件分支等)的可视化拖拽与流程编排。其核心原理包括执行引擎(解析DAG并管理节点依赖)、上下文变量传递(类Jinja模板的变量引用机制)和状态持久化(存储执行日志与中间结果)。工作流通过事件驱动执行,支持异步任务调度,并与RAG知识库、LLM服务等模块深度集成,最终可发布为API或对话应用。技术栈基于Python(FastAPI+Celery)和PostgreSQL,实现低代码化的AI应用开发。

nbspzs的专栏 2202

Vim编辑器中的复制和全选复制

如何在Vim编辑器中复制粘贴和全选复制粘贴

x5445687d的博客 4万+

CXL技术入门:从PCIe到高性能计算的桥梁(附最新2.0协议解析)

本文深入解析CXL技术如何作为PCIe的进化版,成为高性能计算的关键桥梁,特别聚焦CXL 2.0协议的关键升级。从技术架构、三大子协议到典型应用场景,全面介绍CXL在缓存一致性、内存共享等方面的优势,帮助开发者快速掌握这一前沿技术。

wdx012345的博客 743

【图像超分】论文精读:Residual Dense Network for Image Super-Resolution(RDN)

一个非常深的卷积神经网络 (CNN) 最近在图像分类 (SR) 方面取得了巨大成功,并提供了分层特征。然而,大多数基于深度 CNN 的 SR 模型没有充分利用原始低分辨率 (LR) 图像中的层次特征,从而实现相对较低的性能。在本文中,我们提出了一种新的残差密集网络(RDN)来解决图像SR中的这个问题。我们充分利用所有卷积层的分层特征。具体来说,我们提出了残差密集块(RDB)通过密集连接的卷积层提取丰富的局部特征。RDB 进一步允许将前一个 RDB 的状态与当前 RDB 的所有层直接连接,从而产生连续的内存

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 7271

vim 的基本操作-复制粘贴

一、最基本的复制粘贴 1. 将光标移动到要复制的文本开始的地方,按 v进入可视模式。 2. 将光标移动到要复制的文本的结束的地方,按 y 复制。此时 vim 会自动将光标定位到选中文本的开始的地方,并退出可视模式。 3. 移动光标到文本结束的地方,按p粘贴。 ...

hfut_zhanghu的博客 4万+

基于RK3588边缘计算平台的人数统计系统设计与实现

针对人数统计场景优化的YOLOv5模型完整的模型转换和部署流程高效的嵌入式推理优化方案低成本、低功耗的部署方案实时性强,满足工业应用需求可扩展性好,适配多种应用场景引入注意力机制,提高小目标检测能力结合多模态信息,增强系统鲁棒性开发可视化管理平台,提升用户体验随着边缘计算和AIoT技术的快速发展,基于深度学习的智能视觉系统必将在更多领域发挥重要作用。本项目为相关应用的开发和部署提供了有价值的参考,为推动人工智能技术的产业化应用做出了积极贡献。

LXY_LOVE36的博客 175

详解 vim 复制粘贴和剪贴板

使用的 vim 版本支持 clipboard,通过查看。配置 clipboard 选项,或者使用"*yy明确指定使用或者寄存器。剪贴板管理器。

skysky97的博客 2681

杰理JL701N内置flash录音配置教程

本文详细介绍了内置Flash录音功能的配置方法。主要内容包括:1) 基础模式配置(开启音乐/录音模式、Flash录音宏定义);2) 录音参数设置(格式基准值、存储区域定义、容量配置);3) MP3编码特殊处理;4) 下载时的Flash格式化操作;5) 录音开关和播放接口的使用说明。配置过程涉及多个关键文件的修改,并强调存储容量的精确分配。

qq_42014563的博客 608

【系统架构设计师】二十三、通信系统架构设计理论与实践①

通信网络主要形式:局域网、广域网、移动通信网。 局域网网络架构有 4 种类型:单核心架构、双核心架构、环型架构、层次型架构。 广域网属于多级网络,通常由骨干网、分布网、接入网组成。在网络规模较小时,可仅由骨干网和接入网组成。通常,在大型网络构建中,通过广域网将分布在各地域的局域网互连起来,形成一个大的网络。 移动通信网为移动互联网提供了强有力的支持,尤其是5G 网络为个人用户、垂直行业等 提供了多样化的服务。

帅次的博客 3782

vim 复制粘贴

VIM编辑器 1.复制和粘贴整行 我们都知道复制的快捷键是“nyy”,粘贴的快捷键是“p”。 Tips 1.“yy” 是复制光标所在行,“nyy”是复制包括光标所在行以及向下的“n-1”行**,一共n行。 2. “p”是将已经复制的数据,粘贴在光标所在行的下一行。“P”为粘贴在光标所在行的上一行。 2.粘贴和复制一个单词 当我们想粘贴一行数据中的某些单词时有一些快捷键 如下: yw 复制一个单词 (包括单词后面的空白字符) 4yl 复制当前光标下的字符、以及后面三个字符,总共四个字符 4yh 复制光标前面

记录和分享学习和工作过程中的个人总结 5万+

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

vs code vim copy paste delete

vs code 安装vim 插件 后输入效率大大提高,可是vim的d y p这几个命令使用起来可没那么爽。老是打破ctrl+c ctrl+v ctrl+x的习惯。每次删除都会修改剪贴板。 那么能不能让vim直接调用vs code 的copy , paste ,delete line命令呢,答案是可以的。 设置如下 File=>Preferences=>Settings "vim.normalModeKeyBindingsNonRecursive": [ { ..

Codec007的专栏 825

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

vi 使用技巧: copy, paste, delete, 块编辑,redo/undo

1. copy and paste yy : copy 光标所在的行 nyy: copy n line yw: copy 光标所在的单词 nyw: copy 光标所在位置到其后的n 个单词(未必是同一行) y$: copy 光标所在位置到行尾($是行尾的标示) ny$: copy 光标所在位置之后的n行(包括当前行,当前行=y$) p: paste 在光标所在位置之右 P: paste 在光标所在位置之左 2. delete, 和copy 类似 dd : delete current line ndd: d

scsidisk的专栏 888

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Parabolic:免费开源的 yt-dlp 图形化视频下载器,粘贴链接三步拿到文件

Parabolic 是一个免费开源的 yt-dlp 图形化视频下载器:你不用记任何命令行参数,粘贴链接、选格式,就完事。它基于 yt-dlp 引擎覆盖数百个站点,提供 Windows 和 Linux 两个原生版本。 ## 一条命令装好 Linux 上从 Flathub 一条命令搞定: ```bash # 安装 Parabolic 的 Flatpak 版 flatpak install fla

gitblog_00870的博客 875

《Vim实用技巧》第五章

其中{start}地址是模式/<html>/,{end}地址是/<\/html>/对指定范围内匹配{pattern}的所有行执行Ex命令{cmd}:copy命令可以简写成:co,也可以用命令:t。把指定范围内出现{pattern}的地方替换为{string}对指定范围内的每一行执行普通模式命令{commands}把指定范围内的行拷贝到{address}指定的行之下。把指定范围内的行移动到{address}指定的行之下。删除指定范围内的行[到寄存器x中]复制指定范围的行[到寄存器x中]

jenury的博客 166

Vimfiler.vim高级用法:SSH远程文件管理与批量操作技巧

Vimfiler.vim是一个功能强大的Vim文件管理器插件,它为Vim用户提供了完整的文件浏览和管理解决方案。这款强大的文件管理器不仅支持本地文件操作,还通过集成unite-ssh插件实现了SSH远程文件管理功能,让您可以直接在Vim中访问和管理远程服务器文件。本文将详细介绍Vimfiler.vim的SSH远程文件管理和批量操作技巧,帮助您提升工作效率。 ## 🚀 为什么选择Vimfiler

gitblog_00498的博客 741

Vim

Vim documentation: usr_toc 标准术语与 Vim 术语对照 Standard terminology Vim’s jargon paste put copy yank cut delete delete delete and write to “blackhole” register 寄存器 blackhole register:...

anleng6817的博客 93

vim - copy/paste a word

1. http://stackoverflow.com/questions/7797068/copying-a-word-and-pasting-over-a-word viwp - visually select a word, and paste over it by something in the clip. 2. How to copy/delete word under curso...

weixin_30906185的博客 145

Vim查找、删除、复制

查找并删除 按ESC键回到普通模式; 输入/加想要查找的字符,回车; 按N,n可以向上向下查找,按x可以进行删除,按a可以进入编辑模式。 普通模式下删除文本的快捷方式 命令 说明 x/Delete 删除光标所在字符 X 删除光标所在的前一个字符 dd 删除整行 dG 删除到文档结尾处 d1G 删除到文档首部 :2,4d 删除第2行到第4行 复制:将第9行...

weixin_42217205的博客 876

vim的ex模式介绍

vim底层是行编辑器ex,这东西产生于终端时代,那时候输入者们需要print一行东西,然后输入编辑内容,然后再print才能看到该行。目前大多数的编辑 操作都不会直接用到 这个老前辈了,不过你要修改多个文件的时候,这东西还是比较有用的。 1、使用 ex filena...

776

vi 使用技巧(二): copy, paste, delete, 块编辑,redo/undo

1. copy and paste    yy : copy 光标所在的行  nyy: copy n line    yw: copy 光标所在的单词  nyw: copy 光标所在位置到其后的n 个单词(未必是同一行)    y$:  copy 光标所在位置到行尾($是行尾的标示)  ny$:  copy 光标所在位置之后的n行(包括当前行,当前行=y$)      p:  paste 在光标所

埋头学习 | 踏实 | 刻意训练 | 原创 2559

vim使用手册

vim使用手册 最最基础的存活之法   事实上,我当初把Linux命令行基础和vim放到同一篇博客里写过。但是接触的稍微多了一些突然发现当时的理解还是不够。改起来太麻烦并且那里做一个备忘录还是不错的,所以就重开一篇咯。   首先,vim并不需要你安装,它是命令行内置的。Linux上可以直接用,Windows上安装了Bash之后输入vi或者vim也可以进入。   学习vim我们首先来学一些———

夜落初阳,书写欢乐 470

解决ThinkPHP5 Redis::delete() is deprecated

解决ThinkPHP5 Redis::delete() is deprecated

WZP_LOVE的专栏 3672

在vim中复制内容到系统剪切板

如题,记录下来 我试着用+y 不知道为啥没成功 应用场景之一, 我在学习vim正则表达式指北dahu/VimRegexTutor: A vimtutor clone for learning Regular Expressions in Vim时,需要将vim的内容复制到命令行,就遇到了困难,用以下的做法就解决了。。。 Make quoteplus the default register If you’d like to make it easier to interact with the syst.

伪民科小白随意折腾随心记 356

linux 文本编辑器:vi、vim、实用技巧、vimplus、插件管理器vundle、Nano编辑器

Vim / Vi 是一个功能强大的全屏幕文本编辑器。vim ( Vi IMproved ) 是 vi的一个加强版,主要用来 "创建、编辑、显示" 文本文件。现在主流的 linux 都会安装 vim 文本编辑器。Vim/Vi 没有菜单,只有命令。linux 下还有另外2个强大的编辑器 Emacs、Nano。

freeking101的博客 4万+
上一篇: 机器学习&数据挖掘笔记_16(常见面试之机器学习算法思想简单梳理)
下一篇: spotify上关于推荐的一个benchmark
overstack
博客等级 码龄14年 115粉丝 55原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址