跳至主要内容

Vim命令学习

一般模式切换至编辑模式

  • i,I    从目前光标所在处插入,从所在行第一个非空格符处插入
  • a,A    从光标所在下一个字符开始插入,从光标所在行最后一个字符出开始插入
  • o,O    下一行插入,上一行插入
  • r,R    替换光标所在字符一次,一直替换直至[Esc]

常用操作

  • dd    删除光标所在行       ndd    删除光标所在的向下20
  • dw    删除一个字(word)
  • J    两行合并
  • u    复原前一个操作         ctrl-r   重做上一个操作
  • .    重复前一个操作,重复删除,重复粘贴都常用到
  • x,X    相当于[Del],[Backspace]
  • D    删除到行末
  • yy    复制光标所在行         nyy,表示从当前行开始复制n
  • yw    复制一个字
  • y$    复制到行末
  • p,P    将复制数据粘贴在下一行,上一行

查找和替换

  • /word    向下查找带有word字符串
  • ?word    向下寻找带有word字符串
  • :n1,n2s/word1/word2/g    在第n1行和第n2行之间替换word1word2
    • :n1,$s/word1/word2/gc   从第一行搜寻至最后一行,替换之前询问用户

退出VIM

  • :w[filename]  将缓冲区写入文件,即保存文件
  • :q     退出,如果对缓冲区进行过修改,则会提示
  • :q!     强制退出,放弃修改
  • :wq     保存修改并退出
  • :x     保存修改并退出

窗口命令

  • ctrl+w s     水平分割窗口
  • ctrl+w w     切换窗口
  • ctrl+w q     退出当前窗口(由于同时有多个文件,此命令不会影响其他窗口)
  • ctrl+w v     垂直分割窗口

页面操作

  • h,j,k,l     上,下,左,右
  • ctrl-f     相当于pagedown
    c
    trl-b     相当于pageup
  • $     ^        跳至行尾           跳至行首的第一个字符
  • home0  end$     移动到这一行行首/行尾
  • gg    G   跳至文件的第一行      最末行
  • nG         移动到这个文件的第n         gg 本质上相当于1G
  • N[ENTER]  n为数字,光标向下移动n行

Popular posts from 产品随想的博客

产品随想 | 陪读《乔布斯传》:1-17章

乔布斯经典照片集 坐在麗莎電腦旁。他說:「毕加索曾說:「好的藝術家懂得模仿,佛大的藝術家善於偷取。」因此,窃取偉大的點子沒有什麼好羞耻的。 與蓋茲在電話中達成協議:「比爾,謝謝你支持蘋果。因為你的支持,世界將變得更美好。」 1997年蘋果在波士頓舉行的麥金塔世界大會,蓋茲透過衛星連線在巨大的螢幕上出現。質伯斯說:「我真是笨死了,竟然讓蓋兹以這種方式現身。他讓我看起來好沙小。」 ──时刻自省 前言 The people who are crazy enough to think they can change the world are the ones who do. 只有那些瘋狂到以為自己可以改變世界的人, 才能改變這個世界。 這麼些年來,賈伯斯說起話來的認真與專注態度,著實打動不少人。我們一直保持連絡,即使在他被逐出蘋果之後,我們還有來往。每次他有新產品要推出時,像 NeXT 電腦或皮克斯 (Pixar)的電影,他就會來找我。他常帶我去曼哈頓下城一家壽司店用餐,講起他的產品,渾身散發出光和熱,眉飛色舞的說這是他登峰造極之作。我喜歡這個人。 ──对自己产品深深的爱 他的堅持教我疑惑。人人都知道賈伯斯不道餘力捍衛隱私, 而且我不知道他是否看過我寫的任何一本傳記。我還是不敢立刻答應,只說或許再等等。然而到了 2009年,我接到他太太蘿琳. 鮑威爾打來的電話。她直截了當說:「如果你還想為史帝夫寫傳,最好趕快動筆。」這是他第二次因病向公司請長假。我坦言他早在2004 年得知自己罹患胰臟癌的時候就曾主動邀我寫傳,但我當時對他罹癌的事一無所知。蘿琳解釋說,他們盡量保密,因此當時根本沒幾個人知道。他是在動手術的前夕打電話給我的。 ──和Make Something Wonderful对照起来看 他還說,自從他回到蘋果重新掌權,這十二年來是他創造新產品的高峰期,但他還有更重要的目標,也就是效法惠普的惠立和普克(David Packard),締造一家創新動力無限的公司,進而超越惠普。 ──苹果公司才是乔布斯最得意的产品 他說:「我一直認為,自己是個偏向人文的孩子,但我也喜歡電子的東西。後來,我讀到寶麗來(Polaroid)創辦人蘭德 (Edwin Land)曾說過,一個人能站在人文和科學的交會口,兼容贯通,才是真正的人才。在那當下,我决定要當這樣的人。」他似乎在暗示我,這可以做為傳...

Steve Jobs at 44, By Michael Krantz, 1999

Differences and Similarities Between Apple and Pixar Apple turns out many products--a dozen a year; if you count all the minor ones, probably a hundred. Pixar is striving to turn out one a year. But the converse of that is that Pixar's products will still be used fifty years from now, whereas I don't think you'll be using any product Apple brings to market this year fifty years from now. Pixar is making art for the ages. Kids will be watching Toy Story in the future. And Apple is much more of a constant race to continually improve things and stay ahead of the competition.  His Role At Pixar At Pixar my job is to help build the studio and recruit people and help create a situation where they can do the best work of their lives. And to some degree it's the same at Apple. But at Pixar, I don't direct the movies, whereas at Apple probably, if I had to pick a role out of a film production, I'd be the director. So it...

产品随想 | 周刊 第85期:e-Residency与数字游民

  David Shambaugh   https://www.google.com/search?q=David+Shambaugh 中国问题研究专家,著作极多 郭玉闪   https://zh.wikipedia.org/wiki/郭玉闪?useskin=vector 中国公共知识分子 我只想好好观影   github.com/BetterWorld-Liuser/autoMovies 刘煜辉:中国资本市场灵魂出窍 最有活力的公司几乎不在A股   https://finance.sina.com.cn/stock/marketresearch/2017-06-23/doc-ifyhmtek7705574.shtml 回看17年的专家讲话,还是挺有水平的,挺多都认可 纽约文化沙龙   https://www.youtube.com/@user-cu2hl5tf6y/videos 视频质量出奇的高,推荐 透视中国政治by吴国光、程晓农 备忘下,貌似评价挺好的一本书 CAPI China Chair Wu Guoguang (吴国光 / 吳國光)   https://www.youtube.com/playlist?list=PLIt1szHhnm_Hso3jGUbfGpnEAbsPOuEVV 因为热爱中国,我们越要看懂中国 AI Canon   https://a16z.com/2023/05/25/ai-canon/ in this post, we’re sharing a curated list of resources we’ve relied on to get smarter about modern AI. We call it the “AI Canon” because these papers, blog posts, courses, and guides have had an outsized impact on the field over the past several years. 希望中国的投資機構,也能有更多的分享與輸出,提升整個社會的認知 Cantonese Font 粵語字體   https://visual-fonts.com/zh/...

Interview with Steve Jobs, WGBH, 1990

Interviewer: what is it about this machine? Why is this machine so interesting? Why has it been so influential? Jobs: Ah ahm, I'll give you my point of view on it. I remember reading a magazine article a long time ago ah when I was ah twelve years ago maybe, in I think it was Scientific American . I'm not sure. And the article ahm proposed to measure the efficiency of locomotion for ah lots of species on planet earth to see which species was the most efficient at getting from point A to point B. Ah and they measured the kilocalories that each one expended. So ah they ranked them all and I remember that ahm...ah the Condor, Condor was the most efficient at [CLEARS THROAT] getting from point A to point B. And humankind, the crown of creation came in with a rather unimpressive showing about a third of the way down...

Linux私房菜-14章 Linux帐号管理

1.认识三个文件夹 '/etc/passwd' '/etc/shadow' '/etc/group' 2.Mac更改Terminal shell: chsh -s /bin/bash 3.权限更改的一种姿势: chmod u+x file    user group others 4.一般帐号密码忘记:root身份passwd即可    root帐号密码忘记:重启进入用户维护模式再以 passwd命令更改密码,或Live CD开机挂载根目录再修改/etc/shadow,将root密码字段清空,重启后root将不再需要密码 5.有效用户组与初始用户组认识  groups命令查看当前登录用户支持的用户组

巴菲特致股东信-1975年

 笔记: 华盛顿邮报已成为伯克希尔第一重仓股 翻译: 雪球:https://xueqiu.com/6217262310/131409324 备份:https://archive.ph/4hgK3 原文: To the Stockholders of Berkshire Hathaway Inc.: Last year, when discussing the prospects for 1975, we stated “the outlook for 1975 is not encouraging.” This forecast proved to be distressingly accurate. Our operating earnings for 1975 were $6,713,592, or $6.85 per share, producing a return on beginning shareholders ’ equity of 7.6%. This is the lowest return on equity experienced since 1967. Furthermore, as explained later in this letter, a large segment of these earnings resulted from Federal income tax refunds which will not be available to assist performance in 1976. On balance, however, current trends indicate a somewhat brighter 1976. Operations and prospects will be discussed in greater detail below, under specific industry titles. Our expectation is that significantly better results in textiles, earnings added from recent acquisitio...

产品随想 | 周刊 第128期:将时间转化为知识和体验

自行车棚效应:我们为什么在小事上纠结,却对大事视而不见?   https://limboy.me/posts/bike-shedding Benz-Patent   https://www.mercedes-benz.com/en/innovation/milestones/benz-patent-motor-car/ 豐田博物館   https://toyota-automobile-museum.jp/tw/ 值得一去的汽车博物馆 一人公司   https://github.com/cyfyifanchen/one-person-company one-person-company, 一人公司 AI 工具系列 wujiaxian   https://wujiaxian.com/ 可能吧创始人的个人Blog,介绍自己的方式,很值得学习 日本京都10大設計熱點!「建築大師貝聿銘操刀美術館,皆川明設計旅館、選物店,還有全球最美的藍瓶咖啡店舖!」   https://www.elle.com/tw/life/style/g33846398/2020-kyoto-10-hotspots/ 京都真是非常美 Henry L. Stimson   https://en.wikipedia.org/wiki/Henry_L._Stimson?useskin=vector While Kyoto may have satisfied the military criteria for a useful target, Stimson objected, declaring in a meeting if the Interim Committee on June 1, 1945, "...there was one city that they must not bomb without my permission and that was Kyoto." 人性的努力保护了京都 Brooke Astor, 105, Aristocrat of the People, Dies   https://www.nytimes.com/2007/08/14/obituaries/14astor.html 值得尊敬...

Steve Jobs: `There's Sanity Returning', 1998

Nobody can doubt the charisma of Steven P. Jobs. The interim CEO of Apple Computer Inc., who returned to the company last July after his ignominious 1985 ouster, has brought back his legendary vision, impatience, and infectious passion for the Macintosh. Jobs spoke to Business Week Correspondent Andy Reinhardt in Apple's stark, fourth-floor boardroom, just after the company rolled out its new software strategy on May 11. Note: This is an extended, online-only version of the Q&A that appears in the May 25, 1998, issue of Business Week. Q: Now that you've introduced the new, bold-looking iMac, are you going to do some radically different products? A: There's a lot of talk about such things -- about handhelds, set-top boxes. A lot of computer companies have been searching for a consumer product. My view is that the personal computer has been the most successful consumer product of the last 10 years. What we have to do, what the industry stopp...

Steve Jobs: Rolling Stone’s 2003 Interview

  When Steve Jobs cruises into the airy reception area on the Apple Computer campus in Cupertino, California, on a recent morning, nobody pays much attention to him, even though he’s the company’s CEO. He’s wearing shorts, a black T-shirt and running shoes. Tall and a little gawky, Jobs has a fast, loping walk, like a wolf in a hurry. These days Jobs seems eager to distance himself from his barefoot youth – who was that crazy kid who once called the computer “a bicycle for the mind”? – and driven to prove himself as a clear-thinking Silicon Valley capitalist. Jobs punches the elevator button to the fourth floor, where his small office is located. For a man who is as responsible as anyone for the wonder and chaos of Silicon Valley, Jobs’ view of it all is surprisingly modest: shrubby treetops extending out toward San Francisco Bay, the distant whoosh of the freeway below. There is nothing modest, however, about Apple’s recent accomplishments. In the past few months,...