vim编辑器替换功能详解

AUTOSAR知识点 之 XCP (三):XCP功能描述 记录一下XCP使用时候的功能包含命令时序、错误码表、事件描述以及对规范的记录。XCP的图示如下从上图就可以看出数据流的流向CAN-CANIF-XCP,发送反之。XCP的状态机如下。 阅读详情

转载自http://www.uhdesk.com/?p=29


he substitute command searches for a text pattern, and replaces it with a text string. There are many options, but these are what you probably want:


:%s/foo/bar/g
Find each occurrence of ‘foo’ (in all lines), and replace it with ‘bar’.


:s/foo/bar/g
Find each occurrence of ‘foo’ (in the current line only), and replace it with ‘bar’.


:%s/foo/bar/gc
Change each ‘foo’ to ‘bar’, but ask for confirmation first.


:%s/\<foo\>/bar/gc
Change only whole words exactly matching ‘foo’ to ‘bar'; ask for confirmation.


:%s/foo/bar/gci
Change each ‘foo’ (case insensitive) to ‘bar'; ask for confirmation.
This may be wanted after using :set noignorecase to make searches case sensitive (the default).


:%s/foo/bar/gcI
Change each ‘foo’ (case sensitive) to ‘bar'; ask for confirmation.
This may be wanted after using :set ignorecase to make searches case insensitive.
The g flag means global – each occurrence in the line is changed, rather than just the first. This tip assumes the default setting for the ‘gdefault’ and ‘edcompatible’ option (off), which requires that the g flag be included in %s///g to perform a global substitute. Using :set gdefault creates confusion because then %s/// is global, whereas %s///g is not (that is, g reverses its meaning).


When using the c flag, you need to confirm for each match what to do. Vim will output something like: replace with foobar (y/n/a/q/l/^E/^Y)? (where foobar is the replacement part of the :s/…/…/ command. You can type y which means to substitute this match, n to skip this match, a to substitute this and all remaining matches (“all” remaining matches), q to quit the command, l to substitute this match and quit (think of “last”), ^E to scroll the screen up by holding the Ctrl key and pressing E and ^Y to scroll the screen down by holding the Ctrl key and pressing Y. However, the last two choices are only available, if your Vim is a normal, big or huge built or the insert_expand feature was enabled at compile time (look for +insert_expand in the output of :version).


Also when using the c flag, Vim will jump to the first match it finds starting from the top of the buffer and prompt you for confirmation to perform replacement on that match. Vim applies the IncSearch highlight group to the matched text to give you a visual cue as to which match it is operating on (set to reverse by default for all three term types as of Vim 7.3). Additionally, if more than one match is found and you have search highlighting enabled with :set hlsearch, Vim highlights the remaining matches with the Search highlight group. If you do use search highlighting, you should make sure that these two highlight groups are visually distinct or you won’t be able to easily tell which match Vim is prompting you to substitute.


DetailsEdit
Search range:


:s/foo/bar/g Change each 'foo' to 'bar' in the current line.
 


:%s/foo/bar/g Change each 'foo' to 'bar' in all the lines.
 


:5,12s/foo/bar/g Change each 'foo' to 'bar' for all lines from line 5 to line 12 (inclusive).
 


:'a,'bs/foo/bar/g Change each 'foo' to 'bar' for all lines from mark a to mark b inclusive (see Note below).
 


:'<,'>s/foo/bar/g When compiled with +visual, change each 'foo' to 'bar' for all lines within a visual selection. Vim automatically appends the visual selection range ('<,'>) for any ex command when you select an area and enter :. Also, see Note below.
 


:.,$s/foo/bar/g Change each 'foo' to 'bar' for all lines from the current line (.) to the last line ($) inclusive.
 


:.,+2s/foo/bar/g Change each 'foo' to 'bar' for the current line (.) and the two next lines (+2).
 


:g/^baz/s/foo/bar/g Change each 'foo' to 'bar' in each line starting with 'baz'.
Note: As of Vim 7.3, substitutions applied to a range defined by marks or a visual selection (which uses a special type of marks ‘< and ‘>) are not bounded by the column position of the marks by default. Instead, Vim applies the substitution to the entire line on which each mark appears unless the \%V atom is used in the pattern like: :'<,’>s/\%Vfoo/bar/g.


When searching:


., *, \, [, ], ^, and $ are metacharacters.
+, ?, |, {, }, (, and ) must be escaped to use their special function.
\/ is / (use backslash + forward slash to search for forward slash)
\t is tab, \s is whitespace
\n is newline, \r is CR (carriage return = Ctrl-M = ^M)
\{#\} is used for repetition. /foo.\{2\} will match foo and the two following characters. The \ is not required on the closing } so /foo.\{2} will do the same thing.
\(foo\) makes a backreference to foo. Parenthesis without escapes are literally matched. Here the \ is required for the closing \).
When replacing:


\r is newline, \n is a null byte (0x00).
\& is ampersand (& is the text that matches the search pattern).
\0 inserts the text matched by the entire pattern
\1 inserts the text of the first backreference. \2 inserts the second backreference, and so on.
You can use other delimiters with substitute:


:s#http://www.example.com/index.html#http://example.com/#
Save typing by using \zs and \ze to set the start and end of a pattern. For example, instead of:


:s/Copyright 2007 All Rights Reserved/Copyright 2008 All Rights Reserved/
Use:


:s/Copyright \zs2007\ze All Rights Reserved/2008/
Using the current word or registersEdit


:%s//bar/g
Replace each match of the last search pattern with ‘bar’.
For example, you might first place the cursor on the word foo then press * to search for that word.
The above substitute would then change all words exactly matching ‘foo’ to ‘bar’.


:%s/foo//g
Replace each occurrence of ‘foo’ with the word under the cursor.
means that you press Ctrl-R then Ctrl-W.
The word under the cursor will be inserted as though you typed it.


:%s/foo//g
Replace each occurrence of ‘foo’ with the WORD under the cursor (delimited by whitespace).
means that you press Ctrl-R then Ctrl-A.
The WORD under the cursor will be inserted as though you typed it.


:%s/foo/a/g
Replace each occurrence of ‘foo’ with the contents of register ‘a’.
a means that you press Ctrl-R then a.
The contents of register ‘a’ will be inserted as though you typed it.


:%s/foo/\=@a/g
Replace each occurrence of ‘foo’ with the contents of register ‘a’.
\=@a is a reference to register ‘a’.
The contents of register ‘a’ is not shown in the command. This is useful if the register contains many lines of text.


:%s////g
Replace each match of the last search pattern with the / register (the last search pattern).
After pressing Ctrl-R then / to insert the last search pattern (and before pressing Enter to perform the command), you could edit the text to make any required change.


:%s/*/bar/g
Replace all occurrences of the text in the system clipboard (in the * register) with ‘bar’ (see next example if multiline).
On some systems, selecting text (in Vim or another application) is all that is required to place that text in the * register.


:%s/a/bar/g
Replace all occurrences of the text in register ‘a’ with ‘bar’.
a means that you press Ctrl-R then a. The contents of register ‘a’ will be inserted as though you typed it.
Any newlines in register ‘a’ are inserted as ^M and are not found.
The search works if each ^M is manually replaced with ‘\n’ (two characters: backslash, ‘n’).
This replacement can be performed while you type the command:


:%s/=substitute(@a,"\n",'\\n','g')/bar/g
The “\n” (double quotes) represents the single character newline; the ‘\\n’ (single quotes) represents two backslashes followed by ‘n’.
The substitute() function is evaluated by the = (Ctrl-R =) expression register; it replaces each newline with a single backslash followed by ‘n’.
The indicates that you press Enter to finish the = expression.
See Paste registers in search or colon commands instead of using the clipboard.


Additional examplesEdit


:%s/foo/bar/
On each line, replace the first occurrence of “foo” with “bar”.


:%s/.*\zsfoo/bar/
On each line, replace the last occurrence of “foo” with “bar”.


:%s/\<foo\>//g
On each line, delete all occurrences of the whole word “foo”.


:%s/\<foo\>.*//
On each line, delete the whole word “foo” and all following text (to end of line).


:%s/\<foo\>.\{5}//
On each line, delete the first occurrence of the whole word “foo” and the following five characters.


:%s/\<foo\>\zs.*//
On each line, delete all text following the whole word “foo” (to end of line).


:%s/.*\<foo\>//
On each line, delete the whole word “foo” and all preceding text (from beginning of line).


:%s/.*\ze\<foo\>//
On each line, delete all the text preceding the whole word “foo” (from beginning of line).


:%s/.*\(\<foo\>\).*/\1/
On each line, delete all the text preceding and following the whole word “foo”.


:s/^\(\w\)/\u\1/
If the first character at the beginning of the current line is lowercase, switch it to uppercase using \u (see switching case of characters).


:%s/\(.*\n\)\{5\}/&\r/
Insert a blank line every 5 lines.
The pattern searches for \(.*\n\) (any line including its line ending) repeated five times (\{5\}).
The replacement is & (the text that was found), followed by \r (newline).


:%s/\<foo\(\a*\)\>/\=len(add(list, submatch(1)))?submatch(0):submatch(0)/g
Get a list of search results. (the list must exist)
Sets the modified flag, because of the replacement, but the content is unchanged.
Note: With a recent enough Vim (version 7.3.627 or higher), you can simplify this to:


:%s/\<foo\(\a*\)\>/\=add(list, submatch(1))/gn
This has the advantage, that the buffer won’t be marked modified and no extra undo state is created. The expression in the replacement part is executed in the sandbox and not allowed to modify the buffer.
Special casesEdit
For substituting patterns with a corresponding case-sensitive text, Michael Geddes’s keepcase plugin can be used, e.g.:


:%SubstituteCase/\cHello/goodBye/g
Substitute ‘Hello hello helLo HELLO’ by ‘Goodbye goodbye goodBye GOODBYE’
For changing the offsets in a patch file (line number of a block), this little snippet can be used:


s/^@@ -\(\d\+\),\(\d\+\) +\(\d\+\),\(\d\+\) @@$/\=”@@ -“.eval(submatch(1)+offsetdiff).”,”.submatch(2).” +”.eval(submatch(3)+offsetdiff).”,”.submatch(4).” @@”/g
Useful when we want to strip some blocks from a patch, without patch having to complain about offset differences.

2026年03月CCF-GESP编程能力等级认证C++编程一级真题解析 本文收录于专栏《。订阅后可阅读专栏内所有文章。 阅读详情

相关推荐

深入理解C语言内存管理:堆与栈的区别

栈是一种遵循后进先出(LIFO)原则的数据结构。在程序中,栈用于存储局部变量、函数的参数以及函数调用时的返回地址等信息。栈的内存管理由操作系统自动进行,每次函数调用时都会在栈上分配一块内存区域,函数执行完毕后,该内存区域会自动释放。在C语言中,堆与栈是两种不同的内存分配方式,各自有着不同的特点和适用场景。栈内存自动管理,访问速度快,但大小有限,适用于存储局部变量和函数调用信息。堆内存由程序员手动管理,适用于存储动态数据结构,大小不受限制,但访问速度较慢,容易导致内存泄漏等问题。

set_one的博客 1582

vim中的替换

Vim可以在尾行模式下使用:substitute命令将指定的字符串替换成其他目标字符串。 通常我们可以使用该命令的缩写格式:s进行来进行vim字符串替换操作 一、Vim替换字符串命令的语法 Vim替换字符串命令的基本语法是 :[range]s/目标字符串/替换字符串/[option],其中range和option字段都可以缺省不填。 下面介绍VIM替换字符串各个变量的含义: range:表示搜索范围,默认表示当前行; range字段值1,10表示从第1到第10行; %表示整个文件(相当..

qq_42533216的博客 2万+

512分辨率万能遮罩模型实战指南:从下载到高精度应用

本文提供了512分辨率万能遮罩模型的完整实战指南。该模型经过超过540万次迭代,专门优化了对头发、手、眼睛等复杂区域的识别。文章详细介绍了从可靠渠道下载、环境部署、使用DF_ICE工具批量应用遮罩,到利用XSeg Editor进行高精度精修的全流程,旨在帮助用户显著提升AI换脸合成视频的质量与效率。

y2z3a4b5c的博客 1165

vim replace

1.replace a word :%s/oldWord/newWord/g e.g.: replace all oldWord with newWord %表示所有行 g 表示到行尾 :%s/oldWord/newWord/gc 每个word替换之前需要人工确认 2.change "Last, First" to "First Last" :%s/\([^,]*\), \(....

平凡 3464

基于Apache SeaTunnel构建CDC数据同步管道

Apache SeaTunnel是一个数据集成开发平台,其发展经历了几个重要阶段:ETL时代(90年代):面向结构化数据库的数据同步,用于构建数据仓库。MPP和分布式技术流行:使用技术如Hive进行数据仓库的构建。此阶段主要使用mapreduce程序进行数据搬运和转换。数据湖技术流行:重视数据集成,强调先同步数据至数据湖仓储,再进行业务面向的转换和设计。CDC,即变更数据捕获,是一种捕获数据库变更事件(如插入、更新、删除)的技术。

weixin_54625990的博客 2172

从CLIP到AnomalyCLIP:零样本异常检测的跨领域进化之路

本文探讨了从CLIP到AnomalyCLIP的技术演进,重点介绍了零样本异常检测在跨领域应用中的突破。AnomalyCLIP通过对象无关提示学习和多尺度特征提取,显著提升了工业质检、医疗影像等领域的检测精度,实现了高达96.4%的金属螺母划痕检测精度和85.7%的皮肤癌敏感度。这一技术为多模态模型在异常检测中的应用开辟了新路径。

r2s3t4的博客 111

Vim基本使用方法来啦

Vim是一个高度可配置的文本编辑器,用于创建和更改任何类型的文本非常高效。与大多数UNIX系统和Apple OS X一起,它被包含为“vi”。Vim是稳定的,并且不断发展,变得更好。其特点是:持久的多级撤消树;广泛的插件系统;支持数百种编程语言和文件格式;强大的搜索和替换;与许多工具集成。Vim是Vi IMproved,是编辑器Vi的一个加强版,一个极其强大并符合IT工程师(程序员、运维)习惯的编辑器。如果你是一名职业的SE,那么一定在寻找一款出色的能够自由定制、满足灵活编辑功能的编辑器。

muxiaoyu0318的博客 2507

【网络协议】TCP的拥塞控制机制

前言 计算机网络中的带宽、交换节点中的缓存和处理机等,都是网络的资源,在某段时间内,若对网络中某一资源的需求超过了该资源所能提供的可用部分,网络的性能就要变坏,这种情况就叫做拥塞。 所谓拥塞控制,就是防止过多的数据注入到网络中,从而使网络中的路由器或链路不致过载。要注意用拥塞控制与流量控制的区别,拥塞控制是一个全局性的过程,涉及到所有的额主机、路由器,以及与降低网 拥塞控制的算法有:慢开始、拥塞避免、快重传、快恢复四种。 慢开始和拥塞避免 发送方维持一个拥塞窗口的状态变量,其大小取决于网络的拥塞程度

兰亭风雨的专栏 1万+

Linux:解决vim打开文件默认为replace模式

Ubuntu打开 vim 默认为 replace 模式。终端的编码设置与目标机器的编码设置不同。修改 vim 配置文件(

weixin_44498318的博客 1166

个人整理的数据集(手写中文数据、发票数据、快递单数据、车牌数据)

本人在工作生活中收集了各个方面比较多的真实的数据集如下: 一、手写中文数据集 1、档案类数据: 此数据集为手写档案数据,数量较大,大约128G,图像均未标注。 ex: 2、手写作文数据: 此数据集为手写作文数据,是大约800M左右,图像按行提供位置和内容标注,十分珍贵。 ex: 二、发票数据集: 1、增值税发票 此数据集包含了大量真实的增值税发票数据,大约9G,标注了发票位置数据,未提供详细标注。 ex: 2、购车发票 此数据集未提供标注。

weixin_43143224的博客 5877

BIDS数据存储格式介绍与dcm2bids安装与使用

BIDS格式&dcm2bids安装与使用

machinelearning_er的博客 7318

vim程序编辑器

1、vim编辑器的特点:   a. 所有的UNIX Like 系统度会内置vi文本编辑器,其他的文本编辑器,其他的文本编辑器则不一定会存在。   b. 很多软件的编辑接口都会主动调用vi;   c. vim具有程序编辑能力, 可以主动以字体颜色辨别语法的正确性,方便程序设计,vim可以视作vi的高级版本, 可以用颜色或底线等方式来显示一些特殊的信息。   d. 程序简单,编辑速度...

a13311629770的博客 196

【大模型】SpringBoot整合LangChain4j实现RAG检索实战详解

SpringBoot整合LangChain4j实现RAG检索实战详解

congge 1万+

linux下vim命令详解

hive 如何键盘输入\001分隔符?用vi编辑器Ctrl+v然后Ctrl+a 高级一些的编辑器,都会包含宏功能,vim当然不能缺少了,在vim中使用宏是非常方便的::qx 开始记录宏,并将结果存入寄存器xq 退出记录模式@x 播放记录在x寄存器中的宏命令稍微解释一下,当在normal模式下输入:qx后,你对文本的所有编辑动作将会被记录下来,再次输入q即退出了记录...

weixin_30629653的博客 82

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

基于对Linux的学习,Vim编辑器使用

总结了Vim编辑器的高效使用技巧及终端常用快捷键,帮助C语言学习者快速掌握开发工具。Vim部分详细介绍了删除(x/dd)、复制(yy)、粘贴(p)、撤销(u)等核心操作,以及查找替换(/string、%s)的高级用法。终端部分整理了清屏(Ctrl+L)、标签页管理(Ctrl+Shift+T)、进程控制(Ctrl+C/Z)、文本编辑(Ctrl+A/E)等实用快捷键。这些技巧能显著提升代码编辑效率,适合开发者日常使用。

XxO33的博客 168

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Vim编辑器基础操作实践总结

Vim是Linux系统内置的文本编辑器,分为三种核心工作模式:普通模式、插入编辑模式、底行命令模式。本次实验基于Xshell远程终端完成Vim编辑器全套基础操作,包含文件创建、模式切换、内容保存、关键词查找、范围替换等内容。在普通模式下输入冒号,进入底行命令模式执行各类管理指令。编辑器自带内部检索功能,可以定位文档内指定关键词,匹配内容会自动高亮,并且支持跳转到下一处匹配位置,快速遍历全文相同内容。在底行命令模式下,可以将编辑好的内容写入本地文件,也可以选择保存内容后直接关闭编辑器,避免编辑内容丢失。

Tse22x2711的博客 218

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

vim编辑器的查找与替换

vim编辑器的查找与替换。

牧以南歌的博客 1348

Vim编辑器的基本使用

vi编辑器是Unix系统最初的编辑器。它使用控制台图形模式来模拟文本编辑窗口,允许查看文件中的行、在文件中移动、插入、编辑和替换文本。尽管它可能是世界上最复杂的编辑器(至少讨厌它的人是这么认为的),但其拥有的大量特性使其成为Unix系统管理员多年来的支柱性工具。在GNU项目将vi编辑器移植到开源世界时,他们决定对其作一些改进。由于它不再是以前Unix中的那个原始的vi编辑器了,开发人员也就将他重命...

Ramscy 11万+

vim 编辑器使用详解

vi()编辑器通常被简称为vi,它是Linux和Unix系统上最基本的文本编辑器,类似于Windows 系统下的(记事本)编辑器。vim()是vi编辑器的加强版,比vi更容易使用。vi的命令几乎全部都可以在vim上使用,全兼容vi,最明显的区别是vim可以。通常情况下已经默认安装好了 vi 或 Vim 文本编辑器,只需要通过vim命令就可以直接打开vim编辑器。

Cyan_Jiang的博客 5674

Vim 编辑器

编辑器之神 —— Vim 编辑器 目录 Vi 介绍 Vim 介绍 Vim 三种模式 命令模式 光标移动 复制,粘贴 删除/剪切 撤销/恢复 扩展一:光标的快速移动 末行模式 保存/退出 调用外部命令 搜索/查找 替换 显示行号 打开多个文件如何切换 编辑模式 打开方式 退出方式 实用功能 代码着色 计算器 扩展 配置文件 异常退出 别名机制 退出方式 Vi 介绍 Vi 编辑器是所有 Unix 及 Linux 系统下标准的编辑器,类似于 windows 系统下的 no

选择目标,然后保持热爱。 9540

Vim编辑器的使用之替换

Global Replacement(全局替换) 命令: :s/old/new/ :s替换命令,在当前行 将第一个old 替换成 new ,最后一个/是可选择的。 :s/old/new/g 在当前行将所有的old替换成new (其实用几下w【可以用number+w,比如2w】,到那个单词那里cw会更快一点) :50,100s/old/new/g 从50行到1...

zeroming的博客 3227

【Linux系列】Vim 编辑器中的替换命令:`:%s/true/false/g`详解

Vim 是从 Vi 发展出来的一个文本编辑器,它继承了 Vi 的模式编辑方式,同时增加了很多新的功能,如语法高亮、代码补全、多窗口编辑等。Vim 的设计哲学是“模式、动作、文本对象”,这意味着几乎所有的操作都可以通过键盘快捷键来完成,从而提高了编辑效率。

优快云站内信: https://i.youkuaiyun.com/#/msg/chat/qyj19920704 2万+

vim编辑器的操作详解

1.移动光标 要移动光标,可以按下h、j、k、l 键。 h 的键位于左边,每次按下就会向左移动。 l 的键位于右边,每次按下就会向右移动。 j 键看起来很象一支尖端方向朝下的箭头。 k键就是向上移动 功能和上下左右键大致一样 2.VIM的进入和退出——q!/wq 1. :q! 这种方式的退出编辑器会丢弃您进入编辑器以来所做的改动。 文本未经过修改可以直接:q 退出 文本经过修改后不想保存就退出可以:q! (强制退出) 2. :wq 保存改动过的文件并退出 ...

oyyy3的博客 8349

VIM总结之一:VIM编辑器常用命令详解

VIM编辑器常用命令详解(基础篇)                                                                                                                          ——键字如飞   最近又重温了一下VIM编辑器的教程,结合自己这一段时间使用VIM的经验和体会,总结了一些在VIM使

祝 枫 2万+

【Linux】vim编辑器使用详解

Vim(ViIMproved)是一种高度可配置的文本编辑器,用于有效地创建和更改任何类型的文本。Vim的设计目标是提供一种高效的文本编辑方式,通过键盘快捷键和命令来执行大部分编辑任务,从而减少对鼠标的依赖。Vim 的设计哲学是键盘优先,所以尽量使用键盘快捷键来完成操作,而不是鼠标。随着你对 Vim 的熟悉,你会发现使用 Vim 的效率远远超过其他编辑器愿我们都能玩转Vim。

liuty0125的博客 3006
上一篇: error: The requested URL returned error: 403 Forbidden while accessing https://github.com/blah/blahb
下一篇: chrome皮肤编写教材
hellochenlian
博客等级 码龄17年 629粉丝 295原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hellochenlian

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值