{"id":1092,"date":"2021-01-07T18:03:26","date_gmt":"2021-01-07T12:33:26","guid":{"rendered":"http:\/\/192.168.0.6\/linuxbots\/?p=1092"},"modified":"2021-01-07T18:03:29","modified_gmt":"2021-01-07T12:33:29","slug":"vim-commands","status":"publish","type":"post","link":"https:\/\/itsupportwale.com\/blog\/vim-commands\/","title":{"rendered":"Vim Commands &#8211; Basic Vim cheat sheet for everyday use"},"content":{"rendered":"\n<p>VI improved text editor or VIM text editor is an opensource solution available for both CLI and GUI interfaces. In this cheat sheet, you will find most of the <a rel=\"noreferrer noopener\" aria-label=\"Vim (opens in a new tab)\" href=\"https:\/\/www.vim.org\/\" target=\"_blank\">Vim<\/a> Commands which are needed when you will work with text files in the CLI interface.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/oracle.itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1-1024x576.jpg\" alt=\"vim-commands-examples\" class=\"wp-image-3464\" srcset=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1-1024x576.jpg 1024w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1-300x169.jpg 300w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1-768x432.jpg 768w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1-495x279.jpg 495w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>So let&#8217;s start with open a file in Vim text editor. Use the below command to open a file in Vim CLI interface.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim myfilename<\/code><\/pre>\n\n\n\n<p>Vim text editor is having two different mods Insert mode and Command mode.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-insert-mode\">Insert mode:<\/h2>\n\n\n\n<p>When you need to write normal text in a file, you can just <strong>press i<\/strong> for insert mode and start writing. After writing <strong>Press Esc.<\/strong> to go back into the command mode.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-command-mode\">Command mode:<\/h2>\n\n\n\n<p>The default mode you will get when you open a file in Vim editor. From here you will give commands to the editor for all operations.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-below-is-the-list-of-basic-vim-commands\">Below is the list of basic vim commands &#8211;<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>:help<\/strong> [keyword] &#8211; To searching for help about a specific keyword<\/li><li><strong>u<\/strong> &#8211; To Undo the last command performed<\/li><li><strong>Ctrl+r<\/strong> &#8211; To Redo the undo command<\/li><li><strong>0<\/strong> &#8211; Press zero (0) to move the cursor to the beginning of the line<\/li><li><strong>$<\/strong> &#8211; Move the cursor to the end of the line<\/li><li><strong>H<\/strong> &#8211; Moves the cursor to the top of the screen<\/li><li><strong>L<\/strong> &#8211; Moves the cursor to the bottom of the screen<\/li><li><strong>M<\/strong> &#8211; Moves the cursor to the middle of the screen<\/li><li><strong>:e [filename]<\/strong> &#8211; For open a file in Vim editor<\/li><li><strong>:w<\/strong> &#8211; To save the file<\/li><li><strong>:w [filename]<\/strong> &#8211; To save the file with a different name<\/li><li><strong>:wq<\/strong> &#8211; To save the file and close Vim editor<\/li><li><strong>:q!<\/strong> &#8211; To Quit without saving the file<\/li><li><strong>yy<\/strong> &#8211; To copy the entire line<\/li><li><strong>yw<\/strong> &#8211; To copy a single word<\/li><li><strong>p<\/strong> &#8211; To paste the copied item<\/li><li><strong>dd<\/strong> &#8211; To delete the entire line of text<\/li><li><strong>dw<\/strong> &#8211;  To delete a single word<\/li><li><strong>\/[keyword]<\/strong> &#8211; To search for a specific keyword. For Example: To search the word cat use the command &#8220;<strong>\/cat<\/strong>&#8220;<\/li><li><strong>n<\/strong> &#8211; To search the next appearance of the specific word which is searched in the last command.<\/li><li><strong>:%s\/[find]\/[replace]\/g<\/strong> &#8211; To find and replace the specific string<\/li><\/ul>\n\n\n\n<p>The Above commands are must be known when we edit a file in Vim text editor. Hope this will help you in any way. You can share your thoughts in the comment section. Also, suggest to me if I missed any basic command here.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Also Read: <a href=\"https:\/\/oracle.itsupportwale.com\/blog\/tcpdump-examples\/\">Tcpdump Examples<\/a><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>VI improved text editor or VIM text editor is an opensource solution available for both CLI and GUI interfaces. In this cheat sheet, you will find most of the Vim Commands which are needed when you will work with text files in the CLI interface. So let&#8217;s start with open a file in Vim text &#8230; <a title=\"Vim Commands &#8211; Basic Vim cheat sheet for everyday use\" class=\"read-more\" href=\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\" aria-label=\"Read more  on Vim Commands &#8211; Basic Vim cheat sheet for everyday use\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":3464,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[498,500,503,2],"tags":[516,564,578,579],"class_list":["post-1092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-foss","category-linux","category-tools","category-tutorials","tag-cli-text-editor","tag-text-editor","tag-vi","tag-vim"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Vim Commands - Basic Vim cheat sheet for everyday use - ITSupportWale<\/title>\n<meta name=\"description\" content=\"Vim Commands which are needed when you will work with text files in the CLI interface. Vim having two different mods Insert mode and Command mode.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Vim Commands - Basic Vim cheat sheet for everyday use - ITSupportWale\" \/>\n<meta property=\"og:description\" content=\"Vim Commands which are needed when you will work with text files in the CLI interface. Vim having two different mods Insert mode and Command mode.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"ITSupportWale\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Itsupportwale-298547177495978\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-07T12:33:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-07T12:33:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Techie\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Techie\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\"},\"author\":{\"name\":\"Techie\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d\"},\"headline\":\"Vim Commands &#8211; Basic Vim cheat sheet for everyday use\",\"datePublished\":\"2021-01-07T12:33:26+00:00\",\"dateModified\":\"2021-01-07T12:33:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\"},\"wordCount\":425,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg\",\"keywords\":[\"cli text editor\",\"text editor\",\"vi\",\"vim\"],\"articleSection\":[\"FOSS\",\"Linux\",\"tools\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\",\"url\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\",\"name\":\"Vim Commands - Basic Vim cheat sheet for everyday use - ITSupportWale\",\"isPartOf\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg\",\"datePublished\":\"2021-01-07T12:33:26+00:00\",\"dateModified\":\"2021-01-07T12:33:29+00:00\",\"description\":\"Vim Commands which are needed when you will work with text files in the CLI interface. Vim having two different mods Insert mode and Command mode.\",\"breadcrumb\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/itsupportwale.com\/blog\/vim-commands\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage\",\"url\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg\",\"contentUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg\",\"width\":1280,\"height\":720,\"caption\":\"vim-commands-examples\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/vim-commands\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/itsupportwale.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Vim Commands &#8211; Basic Vim cheat sheet for everyday use\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#website\",\"url\":\"https:\/\/itsupportwale.com\/blog\/\",\"name\":\"ITSupportWale\",\"description\":\"Tips, Tricks, Fixed-Errors, Tutorials &amp; Guides\",\"publisher\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/itsupportwale.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\",\"name\":\"itsupportwale\",\"url\":\"https:\/\/itsupportwale.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png\",\"contentUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png\",\"width\":1119,\"height\":144,\"caption\":\"itsupportwale\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Itsupportwale-298547177495978\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d\",\"name\":\"Techie\",\"sameAs\":[\"https:\/\/itsupportwale.com\",\"iswblogadmin\"],\"url\":\"https:\/\/itsupportwale.com\/blog\/author\/iswblogadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Vim Commands - Basic Vim cheat sheet for everyday use - ITSupportWale","description":"Vim Commands which are needed when you will work with text files in the CLI interface. Vim having two different mods Insert mode and Command mode.","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:\/\/itsupportwale.com\/blog\/vim-commands\/","og_locale":"en_US","og_type":"article","og_title":"Vim Commands - Basic Vim cheat sheet for everyday use - ITSupportWale","og_description":"Vim Commands which are needed when you will work with text files in the CLI interface. Vim having two different mods Insert mode and Command mode.","og_url":"https:\/\/itsupportwale.com\/blog\/vim-commands\/","og_site_name":"ITSupportWale","article_publisher":"https:\/\/www.facebook.com\/Itsupportwale-298547177495978","article_published_time":"2021-01-07T12:33:26+00:00","article_modified_time":"2021-01-07T12:33:29+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg","type":"image\/jpeg"}],"author":"Techie","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Techie","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/#article","isPartOf":{"@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/"},"author":{"name":"Techie","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d"},"headline":"Vim Commands &#8211; Basic Vim cheat sheet for everyday use","datePublished":"2021-01-07T12:33:26+00:00","dateModified":"2021-01-07T12:33:29+00:00","mainEntityOfPage":{"@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/"},"wordCount":425,"commentCount":1,"publisher":{"@id":"https:\/\/itsupportwale.com\/blog\/#organization"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage"},"thumbnailUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg","keywords":["cli text editor","text editor","vi","vim"],"articleSection":["FOSS","Linux","tools","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/itsupportwale.com\/blog\/vim-commands\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/","url":"https:\/\/itsupportwale.com\/blog\/vim-commands\/","name":"Vim Commands - Basic Vim cheat sheet for everyday use - ITSupportWale","isPartOf":{"@id":"https:\/\/itsupportwale.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage"},"thumbnailUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg","datePublished":"2021-01-07T12:33:26+00:00","dateModified":"2021-01-07T12:33:29+00:00","description":"Vim Commands which are needed when you will work with text files in the CLI interface. Vim having two different mods Insert mode and Command mode.","breadcrumb":{"@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itsupportwale.com\/blog\/vim-commands\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/#primaryimage","url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg","contentUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/vim-commands-1.jpg","width":1280,"height":720,"caption":"vim-commands-examples"},{"@type":"BreadcrumbList","@id":"https:\/\/itsupportwale.com\/blog\/vim-commands\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/itsupportwale.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Vim Commands &#8211; Basic Vim cheat sheet for everyday use"}]},{"@type":"WebSite","@id":"https:\/\/itsupportwale.com\/blog\/#website","url":"https:\/\/itsupportwale.com\/blog\/","name":"ITSupportWale","description":"Tips, Tricks, Fixed-Errors, Tutorials &amp; Guides","publisher":{"@id":"https:\/\/itsupportwale.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itsupportwale.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/itsupportwale.com\/blog\/#organization","name":"itsupportwale","url":"https:\/\/itsupportwale.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png","contentUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png","width":1119,"height":144,"caption":"itsupportwale"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Itsupportwale-298547177495978"]},{"@type":"Person","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d","name":"Techie","sameAs":["https:\/\/itsupportwale.com","iswblogadmin"],"url":"https:\/\/itsupportwale.com\/blog\/author\/iswblogadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts\/1092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/comments?post=1092"}],"version-history":[{"count":0,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts\/1092\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/media\/3464"}],"wp:attachment":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/media?parent=1092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/categories?post=1092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/tags?post=1092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}