第十章 Making big changes

2023-10-30 01:48
文章标签 第十章 changes big making

本文主要是介绍第十章 Making big changes,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

usr_09 Using the GUI

I don’t want to use gui

usr_10 Making big changes

10.1 Record and playback commands

The “.” command repeats the preceding change.

  • recording
    1. The “q{register}” command starts recording keystrokes into the register named {register}.
    2. Type your commands.
    3. To finish recording, press q.
  • execute the macro by the command “@{register}”, can be preceded by a count.
  • move and execute
@a
@@
  • using registers
"np
{edits}
0
"ny$
dd
  • appending to a register
"aY
"AY
10.2 Substitution
  • to perform string replacements.
:[range]substitution/from/to/[flags]
:%substitute/Professor/Teacher/
  • to change every occurrence on the line.
%s/Professor/Teacher/g
  • flags
  1. global
  2. print
  3. confirmation
:s/^the/these/
:s:one/two:one
10.3 Command ranges
  • The simple form of a range is {number},{number}.
1,5s/this/that/g
  • address one specified line:
:54s/President/Fool/
  • write only the current line into a file:
:.write otherfile
  • to substitution in the lines from the cursor to the end:
:.,$s/yes/no/
  • from the first to the last line:
% is a short way to say "1, $"
  • Using A Pattern In a range
:?^Chapter?,/^Chapter/s=grey=gray=g
= is delimiter 
  • add and substract
  • To search for a pattern and then use the line above it:
/Chapter/-1
  • To address the second line below the match:
/Chapter/+2
  • The offsets can also be used with the other items in a range:
:.+3,$-5
  • using marks
  • use mt ot mark the top of an area and mb to mark the bottom:
:'t,'b
  • visual mode and ranges
  • you press : to start a colon command, you will see this:
:'<,'>
The '< and '> are actually marks, placed at the start and end of the Visual selection.
  • you can use the '< command to jump to position where the visual area started:
:'>,$
  • a number of lines
you can type the number and then ":". if you type "5:", you will get:
:.,.+5
10.4 The global command
  • find a match for a pattern and execute a command there.
:[range]global/{pattern}/{command}
:g+//+s/foobar/barfoo/g
10.5 Visual block mode
  • ctrl-v selection of a rectangular area of text.
  • inserting text
the command I{string}<Esc> inserts the text {string} in each line.
  • changing text
  • Other commands that change the characters in the block:
        ~       swap case       (a -> A and A -> a)U       make uppercase  (a -> A and A -> A)u       make lowercase  (a -> a and A -> a)
  • filling with a character
  • shifting
  • the command “>” shifts the selected text to the right one shift amount, inserting whitespace.
:set shiftwidth=4
  • joining lines
  • the “J” command joins all selected lines together into one line.
10.6 Reading and writing part of a file
  • include another file.
:read {filename}
  • appends the file “patch” at the end of the file.
:$r patch
  • read the file above the first line.
:0read patch
  • writing a range of lines
:.,$write tempo
  • if you know what you are doing and want to overwrite the file:
:.,$write! tempo
  • appending to a file
  • write the first line with this command:
:.write collection
:.write >>collection
10.7 Formatting text
  • type plain text, each line is automatically trimmed to fit in the window:
:set textwidth=72
  • to check the current value of textwidth:
:set textwidth
  • to tell vim to format the current paragraph
gqap
  • format the whole file:
gggqG
10.8 Changing case
                         gUwsection header      ---->      SECTION header
  • to make an operator work on lines you double it.
                            g~~ Some GIRLS have Fun    ---->   sOME girls HAVE fUN ~
Using an external program
  • The command “!{motion}{program}” takes a block of text and filters it through an external program.
  • sort lines 1 through 5 of a file.
!5Gsort<Enter>
  • !! command filters the current line through a filter.
!!date<Enter>
  • when it donesn’t work
        'shell'         specifies the program that Vim uses to executeexternal programs.'shellcmdflag'  argument to pass a command to the shell'shellquote'    quote to be used around the command'shellxquote'   quote to be used around the command and redirection'shelltype'     kind of shell (only for the Amiga)'shellslash'    use forward slashes in the command (only forMS-Windows and alikes)'shellredir'    string used to write the command output into a file
  • reading command output
  • to read the contents of the current directory into the file:
:read !ls
  • a range can be used to where vim should put the lines:
0read !date -u
  • writing text to a command
  • to count the words in the current file:
:write !wc
  • redrawing the screen
ctrl-l

这篇关于第十章 Making big changes的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/304802

相关文章

第十章 【后端】环境准备(10.4)——Vagrant

10.4 Vagrant Vagrant 官网 Vagrant 镜像仓库 下载 安装 直接 install。 设置环境变量 Vagrant 默认将镜像保存在用户文件夹的 .vagrant.d 目录下,若用户文件夹在C盘,下载的镜像文件会大量占用C盘空间。设置环境变量 VAGRANT_HOME 后,Vagrant 会将镜像保存到环境变量指定的文件夹下。

Python计算机视觉编程 第十章

目录 一、OpenCv基础知识 1.读取和写入图像 2.颜色空间 3.显示图像和结果 二、处理视频 1.输入视频 2.将视频读取到NumPy数组中 三、跟踪 1.光流 2.Lucas-Kanade算法 一、OpenCv基础知识 OpenCV 自带读取、写入图像函数以及矩阵操作和数学库。 1.读取和写入图像 import cv2# 读取图像im = c

Matlab simulink建模与仿真 第十章(模型扩展功能库)

参考视频:simulink1.1simulink简介_哔哩哔哩_bilibili 一、模型扩展功能库中的模块概览         注:下面不会对Block Support Table模块进行介绍。 二、基于触发的和基于时间的线性化模块 1、Trigger-Based Linearization基于触发的线性化模块 (1)每次当模块受到触发时,都会调用linmod或者dlinmod函数

【POJ 3666】Making the Grade(简单DP)

首先可以明确一个方面,那就是如果将X改成Y,那么Y肯定是这N个数中的某一个(为什么仔细想想) 之后可以得到一个状态转移那就是dp[i][j]代表已经考虑了i位的情况下,结尾为j的最小更改数。 状态转移为dp[i][j] = min(dp[i-1][k] + abs(a[i] - b[j])) 这样的话可以写出一个初步的代码: #include<cstdio>#include<cst

[论文笔记]Making Large Language Models A Better Foundation For Dense Retrieval

引言 今天带来北京智源研究院(BAAI)团队带来的一篇关于如何微调LLM变成密集检索器的论文笔记——Making Large Language Models A Better Foundation For Dense Retrieval。 为了简单,下文中以翻译的口吻记录,比如替换"作者"为"我们"。 密集检索需要学习具有区分性的文本嵌入,以表示查询和文档之间的语义关系。考虑到大语言模

【ZOJ】3889 Making Sequence【构造】

传送门:【ZOJ】3889 Making Sequence 根据题意构造即可。ZOJ月赛我们抢的第二个FBwww my  code: my~~code: #include <bits/stdc++.h>using namespace std ;typedef unsigned long long ULL ;const int MAXN = 205 ;ULL n , a , b , s ,

第十章 DCEP简介

第十章 DCEP简介 1、概述2、概念3、目标3.1 国内需求3.1.1 纸质现金的不足3.1.2 数字资产的需求3.1.2 反洗钱、反恐怖融资的需要3.1.3 负利率有望实现3.1.4 信息安全的需求 3.2 国际机遇3.3 核心目标 4、特点5、优缺点5.1 优点5.2 缺点 6、对比6.1 DCEP与比特币、以太坊等加密货币6.2 DCEP与Libra6.3 DCEP与支付宝、微信 参

第十章 多态 内部类

10.1 多态概述 多态是指一个对象对应不同类型的引用,体现为父类或接口指向子类对象。 Cat c = new Cat(); //正常Animal a = new Cat(); //多态多态的使用提高了代码的可扩展性。 10.2 弊端 & 前提 弊端:只能调用父类成员方法 前提;两者为继承或实现关系,并且有覆盖的功能 10.3 多态的转型 Animal a =

Codeforces Round #328 (Div. 2)C. The Big Race(数学gcd lcm)

题目连接 题意:比赛时 ,居然理解错题意= =,以为两个人的速度是一样的,然后有个人的只会有一步是w米,另一个人只有一步是b米。。。。 就是一个人每一步是w,一个人每一步是b,终点后是深渊,然后长度是在1–t随机选择一个d作为赛道长度,问不能区分二人胜负的可能。 思路:就是求d%w==d%b = = #include<bits/stdc++.h>using namespace std;

[SimCLR v2] Big Self-Supervised Models are Strong Semi-Supervised Learners

1、目的         借助无监督预训练来提升半监督学习的效果 2、方法                  1)unsupervised/self-supervised pretrain                 -> task-agnostic                 -> big (deep and wide) neural network可以有效提升准确性