vim宏的使用
本文介绍vim宏以及它的魔法。
宏是什么
vim的宏就是把一系列动作录制起来,然后可以进行播放可以执行同样动作的功能。
它是vim中最具有魔法的操作了。可能会有人觉得.
重复操作更具有魔法,但是.
只能记
重复上一次命令,能做的事情有限,所以它最多就是最经常使用的命令而已,并没有魔法。
腾飞中的个人博客
本文介绍vim宏以及它的魔法。
vim的宏就是把一系列动作录制起来,然后可以进行播放可以执行同样动作的功能。
它是vim中最具有魔法的操作了。可能会有人觉得.
重复操作更具有魔法,但是.
只能记
重复上一次命令,能做的事情有限,所以它最多就是最经常使用的命令而已,并没有魔法。
本文介绍在osx和linux下制作U盘启动盘的方法。
假如要把ubuntu.iso做成启动盘。
osx下制作启动盘,需要先将iso转成dmg格式的镜像。然后再把dmg dd到U盘里
……旁路的目的是为了把请求复制一份发到另外的服务上去。这样就可以不影响主流程的情况下 处理额外的逻辑了。最简单的方式就是让nginx把请求发出去,这样我们只要改配置就行了, 而不用改代码。相对于开发,测试回归的成本往往要高很多。
……http basic认证允许我们对自己的web服务器做简单的认证。可以适当的防止别人浏览器我们 的页面。
对于一些简单的web服务需要做简单的认证。比如:
……初学golang的很多人对buffer大小为0和1的channel都不了解。
下面通过make(chan bool)
和make(chan bool, 1)
的例子说明它们的区别。
有的时候,我们需要确保当前只有一个进程实例在运行。特别是定时跑定时任务的时候。
unix/linux的cron可以配置定时任务,让它在指定的时间运行。但是,只要到任务指定的时 间,cron就会fork一个新的进程来执行任务,它不会保证前一个任务运行完成了,下一个任 务才开始。而有时我们却需要只能有一个实例运行。
……这篇文章是只是简单的入门,所以这里会教你怎么可以简单的上手。比如以前完全没有用过 docker,现在要跑一个服务要用docker来跑。
以下是docker官网的介绍
……懒是程序猿的本性。一切重复的东西,程序猿都可以写成脚本来让它自己运行。很多时候程 序猿要写脚本去连到服务器上去执行些命令,其中还包含上传文件到服务器或者从服务器上 下载文件下来。
……很多人在使用feedkeys函数的时候会得取不预期的输出,怎么折腾也搞不明白为什么会得到 这样的结果。这篇文章来给大家解疑一下。
feedkeys({string} [, {mode}]) *feedkeys()*
Characters in {string} are queued for processing as if they
come from a mapping or were typed by the user.
By default the string is added to the end of the typeahead
buffer, thus if a mapping is still being executed the
characters come after them. Use the 'i' flag to insert before
other characters, they will be executed next, before any
characters from a mapping.
The function does not wait for processing of keys contained in
{string}.
To include special keys into {string}, use double-quotes
and "\..." notation |expr-quote|. For example,
feedkeys("\<CR>") simulates pressing of the <Enter> key. But
feedkeys('\<CR>') pushes 5 characters.
If {mode} is absent, keys are remapped.
{mode} is a String, which can contain these character flags:
'm' Remap keys. This is default.
'n' Do not remap keys.
't' Handle keys as if typed; otherwise they are handled as
if coming from a mapping. This matters for undo,
opening folds, etc.
'i' Insert the string instead of appending (see above).
'x' Execute commands until typeahead is empty. This is
similar to using ":normal!". You can call feedkeys()
several times without 'x' and then one time with 'x'
(possibly with an empty {string}) to execute all the
typeahead. Note that when Vim ends in Insert mode it
will behave as if <Esc> is typed, to avoid getting
stuck, waiting for a character to be typed before the
script continues.
'!' When used with 'x' will not end Insert mode. Can be
used in a test when a timer is set to exit Insert mode
a little later. Useful for testing CursorHoldI.
Return value is always 0.
说明文档说了这个函数的使用方式,但是对于大部分人,只理解了一部分,帮而会产生很多
不解的行为。这个函数会把参数中的{string}
当前是用户输入的。默认的,它会把string
的内容放到预输入的buffer(下面直接引用说明文档中的typeahead buffer)中。
对于不解行为,主要都是由这个typeahead buffer产生了。这个typeahead buffer并不是我
们所熟悉的vim与文档内容关联的buffer,下面会对它进行详细的说明。很多人认为,只要
一调用feedkeys,它就立刻产生作用。例如下面这个例子:
influxdb数据旁路一份到prometheus后,prometheus的图有时延时很大,主要是在业务忙的 时候,闲的时候是可以处理到数据的。而influxdb的数据是可以正常显示的。而且这时牛逼 的google并帮不了忙,各种关键字去搜索都找不到相关的问题。
……