{"id":30212,"date":"2021-01-18T03:36:04","date_gmt":"2021-01-17T19:36:04","guid":{"rendered":"https:\/\/web.mwwsb.com.my\/pjci\/?post_type=kb&#038;p=30212"},"modified":"2022-09-07T20:03:18","modified_gmt":"2022-09-07T12:03:18","slug":"overview-of-the-vim-text-editor","status":"publish","type":"kb","link":"https:\/\/www.casbay.com\/guide\/kb\/overview-of-the-vim-text-editor","title":{"rendered":"Overview of the Vim Text Editor"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"30212\" class=\"elementor elementor-30212\" data-elementor-post-type=\"kb\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f0f8176 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f0f8176\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-753747d\" data-id=\"753747d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-763fb3b elementor-widget elementor-widget-heading\" data-id=\"763fb3b\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Overview of the Vim Text Editor<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-578b2e9 elementor-widget elementor-widget-text-editor\" data-id=\"578b2e9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Many articles in this knowledge base advise editing configuration files. However, we usually recommend using the text editor which you prefer. At Liquid Web, we would recommend <a href=\"https:\/\/www.vim.org\/\" rel=\"noopener\">vim<\/a>. Vim, or its older sibling vi, are installed by default on nearly every server that we come across. If you do not yet have a text editor in your mind, read on to see if vim might work for you.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-52b02e1 elementor-widget elementor-widget-image\" data-id=\"52b02e1\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"210\" height=\"157\" src=\"https:\/\/www.casbay.com\/guide\/wp-content\/uploads\/2021\/02\/images-1-e1611947064389.jpg\" class=\"attachment-large size-large wp-image-32289\" alt=\"Overview of the Vim Text Editor\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b840b1f elementor-widget elementor-widget-text-editor\" data-id=\"b840b1f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><em>Vim Text Editor<\/em><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b9426b7 elementor-widget elementor-widget-heading\" data-id=\"b9426b7\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">1) Normal Mode<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d816e60 elementor-widget elementor-widget-text-editor\" data-id=\"d816e60\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>The biggest concept that beginning vim users need to know is the concept of\u00a0<em>modes<\/em>. There are different editor functions, such as moving the cursor around and inserting text. We can accomplish them in different modes. Open up a file in vim:<\/p><p><code>vim example.conf<\/code><\/p><p>Then, you are immediately put into <strong>normal<\/strong>\u00a0mode. Normal modes does not seem normal at first. If you press \u201cj\u201d in normal mode, the letter \u201cj\u201d does not appear. Instead, the letter \u201cj\u201d moves the cursor down one line. Positioning the cursor in this mode is completely done with letter keys. The most basic are:<\/p><ul><li><strong>j<\/strong>\u00a0\u2013 one line down<\/li><li><strong>k<\/strong>\u00a0\u2013 one line up<\/li><li><strong>h<\/strong>\u00a0\u2013 one character left<\/li><li><strong>l<\/strong>\u00a0\u2013 one character right<\/li><\/ul><p>While this may seem odd at first, switching from mode to mode actually speeds typing up. This means that you do not have to move your right hand over to the arrow keys. Moreover, you also do not need to move back every time you wish to reposition the cursor.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c7a023a elementor-widget elementor-widget-heading\" data-id=\"c7a023a\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">2) Insert Mode<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-081ac68 elementor-widget elementor-widget-text-editor\" data-id=\"081ac68\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>To leave normal mode and start typing text, press \u201ci\u201d to enter\u00a0<strong>insert mode<\/strong>. Insert mode behaves much more like the default mode in other text editors. There should not be any surprises.<br \/>When you are done with insert mode, hit the\u00a0<strong>ESC<\/strong>\u00a0key to get back to normal mode.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c8ea7d0 elementor-widget elementor-widget-heading\" data-id=\"c8ea7d0\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">3) Command-line Mode<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7a4e662 elementor-widget elementor-widget-text-editor\" data-id=\"7a4e662\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Command-line mode is used to perform a wide range of commands. To enter vim\u2019s command line, hit \u201c:\u201d (the colon) in normal mode. This will drop the cursor to the bottom of the terminal. Here you can do things like:<\/p><ul><li>Save your changes (write):<code>:w<\/code><\/li><li>Quit out of vim:<code>:q<\/code><\/li><li>Quit without saving changes:<code>:q!<\/code><\/li><\/ul><p>You can also combine commands to run them together. This is commonly done to save the file and quit vim at the same time:<\/p><p><code>:wq<\/code><\/p><p>After you have run a command, vim will place you back in normal mode.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Overview of the Vim Text Editor Many articles in this knowledge base advise editing configuration files. However, we usually recommend using the text editor which you prefer. At Liquid Web, we would recommend vim. Vim, or its older sibling vi, are installed by default on nearly every server that we come across. If you do [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[109],"kbtag":[106,105],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/30212"}],"collection":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/comments?post=30212"}],"version-history":[{"count":10,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/30212\/revisions"}],"predecessor-version":[{"id":38115,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/30212\/revisions\/38115"}],"wp:attachment":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/media?parent=30212"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=30212"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtag?post=30212"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=30212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}