{"id":22004,"date":"2023-02-21T08:19:22","date_gmt":"2023-02-21T08:19:22","guid":{"rendered":"https:\/\/www.booksofall.com\/cn\/?post_type=product&#038;p=22004"},"modified":"2023-02-21T08:19:22","modified_gmt":"2023-02-21T08:19:22","slug":"vim-recipes-a-cookbook-for-the-vim-text-editor","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/","title":{"rendered":"Vim Recipes &#8211; A cookbook for the Vim text editor"},"content":{"rendered":"<h2>Choosing the Right Mode<\/h2>\n<p><strong>Problem<\/strong><\/p>\n<p>You know that <a href=\"https:\/\/www.vim.org\/\">Vim<\/a> has multiple modes of operation but aren&#8217;t sure when to use which one.<\/p>\n<p><strong>Solution<\/strong><\/p>\n<p>For practical purposes there are four modes:<\/p>\n<ul>\n<li><a href=\"https:\/\/learnbyexample.github.io\/vim_reference\/Insert-mode.html\">Insert mode<\/a>:\u00a0 Use only for typing; not moving around or editing. Stay in this mode for as short a time as possible.<\/li>\n<li><a href=\"https:\/\/learnbyexample.github.io\/vim_reference\/Normal-mode.html\">Normal mode<\/a>:\u00a0 Use this for editing: moving around the file, changing text, and rearranging structure. Dip in and out of Insert mode when needed.<\/li>\n<li><a href=\"https:\/\/learnbyexample.github.io\/vim_reference\/Visual-mode.html\">Visual mode<\/a>:\u00a0 Use this for visually selecting text so that you can cut, copy, or format it.<\/li>\n<li><a href=\"https:\/\/learnbyexample.github.io\/vim_reference\/Command-line-mode.html\">Command-Line mode<\/a>:\u00a0 Use this for entering commands, e.g. :set number<\/li>\n<\/ul>\n<p><strong>Discussion<\/strong><\/p>\n<p>Vim&#8217;s modal approach to editing can seem confusing, but it really is the key to understanding Vim.<\/p>\n<p>It&#8217;s tempting to spend much of your time in Insert mode, and navigate with the arrow keys. However, this is slow and requires an awful lot of key presses.<\/p>\n<p>Normal mode is the default mode because it makes it so easy to move around the file to either edit existing text or position the cursor where you want to insert text.<\/p>\n<p>\u272a Use &lt;Ctrl&gt;+o in Insert mode to switch to Normal mode for one command, then<\/p>\n<p>return to Insert mode. For example, &lt;Ctrl&gt;+o gqas enters Normal mode, reformats the current sentence,1 then returns you to Insert mode.<\/p>\n<p>If you create a new file, and just want to type, by all means go straight into Insert mode and do so. All other times, though, stay in Normal mode.<\/p>\n<p>For example, you want to find a paragraph you&#8217;ve written previously, and reword it. In Normal mode you can either search for it (e.g. \/Hobson argued), or simply page through the file (e.g. &lt;Ctrl&gt;+F to scroll downwards) to find it. Once there, you can move to the section you&#8217;re interested in using either the basic movement commands or text objects. You can now use text objects again to select something and change it. For example caw deletes the current word and puts you into Insert mode to change it. Once you have done so, hit &lt;Esc&gt; again to return to Normal mode.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 750px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/vim-recipes-a-cookbook-for-the-vim-text-editor-19ii04a7ge?p=1\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":22018,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"When learning Vim, we may face different questions. Try to solve them one by one by following the steps and discussion shown in the book here!"},"product_brand":[],"product_cat":[351],"product_tag":[],"class_list":{"0":"post-22004","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-ide-and-editors","8":"first","9":"instock","10":"shipping-taxable","11":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Vim Recipes - A cookbook for the Vim text editor - BooksOfAll Simplified Chinese<\/title>\n<meta name=\"description\" content=\"When learning Vim, we may face different questions. Try to solve them one by one by following the steps and discussion shown in the book here!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Vim Recipes - A cookbook for the Vim text editor - BooksOfAll Simplified Chinese\" \/>\n<meta property=\"og:description\" content=\"When learning Vim, we may face different questions. Try to solve them one by one by following the steps and discussion shown in the book here!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Simplified Chinese\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/\",\"name\":\"Vim Recipes - A cookbook for the Vim text editor - BooksOfAll Simplified Chinese\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg\",\"datePublished\":\"2023-02-21T08:19:22+00:00\",\"description\":\"When learning Vim, we may face different questions. Try to solve them one by one by following the steps and discussion shown in the book here!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg\",\"width\":\"595\",\"height\":\"842\",\"caption\":\"Vim Recipes - A cookbook for the Vim text editor\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/cn\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Vim Recipes &#8211; A cookbook for the Vim text editor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"name\":\"BooksOfAll Simplified Chinese\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\",\"name\":\"BooksOfAll Simplified Chinese\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Simplified Chinese\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Vim Recipes - A cookbook for the Vim text editor - BooksOfAll Simplified Chinese","description":"When learning Vim, we may face different questions. Try to solve them one by one by following the steps and discussion shown in the book here!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/","og_locale":"zh_CN","og_type":"article","og_title":"Vim Recipes - A cookbook for the Vim text editor - BooksOfAll Simplified Chinese","og_description":"When learning Vim, we may face different questions. Try to solve them one by one by following the steps and discussion shown in the book here!","og_url":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/","og_site_name":"BooksOfAll Simplified Chinese","og_image":[{"url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg","twitter_misc":{"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/","url":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/","name":"Vim Recipes - A cookbook for the Vim text editor - BooksOfAll Simplified Chinese","isPartOf":{"@id":"https:\/\/www.booksofall.com\/cn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg","datePublished":"2023-02-21T08:19:22+00:00","description":"When learning Vim, we may face different questions. Try to solve them one by one by following the steps and discussion shown in the book here!","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#primaryimage","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/Vim-Recipes.jpg","width":"595","height":"842","caption":"Vim Recipes - A cookbook for the Vim text editor"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/cn\/vim-recipes-a-cookbook-for-the-vim-text-editor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/cn\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/cn\/categories\/"},{"@type":"ListItem","position":3,"name":"Vim Recipes &#8211; A cookbook for the Vim text editor"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/cn\/#website","url":"https:\/\/www.booksofall.com\/cn\/","name":"BooksOfAll Simplified Chinese","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/cn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/cn\/#organization","name":"BooksOfAll Simplified Chinese","url":"https:\/\/www.booksofall.com\/cn\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Simplified Chinese"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product\/22004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media\/22018"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media?parent=22004"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_brand?post=22004"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_cat?post=22004"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_tag?post=22004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}