{"id":20441,"date":"2012-07-18T22:02:07","date_gmt":"2012-07-19T04:02:07","guid":{"rendered":"http:\/\/www.designandexecute.com\/designs\/?p=20441"},"modified":"2024-07-18T22:05:23","modified_gmt":"2024-07-19T04:05:23","slug":"efficient-text-editing-in-vi","status":"publish","type":"post","link":"https:\/\/www.designandexecute.com\/designs\/efficient-text-editing-in-vi\/","title":{"rendered":"Efficient Text Editing in Vi"},"content":{"rendered":"\n<p>Vi (and its enhanced version, Vim) is a powerful text editor in Unix-like systems. Here are some of the most popular and commonly used commands in Vi:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Navigation<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>h, j, k, l<\/strong>: Move left, down, up, and right, respectively.<\/li><li><strong>0 (zero)<\/strong>: Move to the beginning of the line.<\/li><li><strong>^<\/strong>: Move to the first non-blank character of the line.<\/li><li><strong>$<\/strong>: Move to the end of the line.<\/li><li><strong>w<\/strong>: Move to the beginning of the next word.<\/li><li><strong>b<\/strong>: Move to the beginning of the previous word.<\/li><li><strong>e<\/strong>: Move to the end of the current word.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Editing<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>i<\/strong>: Insert mode before the cursor.<\/li><li><strong>I<\/strong>: Insert mode at the beginning of the line.<\/li><li><strong>a<\/strong>: Insert mode after the cursor.<\/li><li><strong>A<\/strong>: Insert mode at the end of the line.<\/li><li><strong>o<\/strong>: Open a new line below and enter insert mode.<\/li><li><strong>O<\/strong>: Open a new line above and enter insert mode.<\/li><li><strong>x<\/strong>: Delete the character under the cursor.<\/li><li><strong>dd<\/strong>: Delete the current line.<\/li><li><strong>D<\/strong>: Delete from the cursor to the end of the line.<\/li><li><strong>dw<\/strong>: Delete the word from the cursor onward.<\/li><li><strong>yy<\/strong>: Yank (copy) the current line.<\/li><li><strong>p<\/strong>: Paste after the cursor.<\/li><li><strong>P<\/strong>: Paste before the cursor.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Searching<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\/<\/strong>: Search forward for a pattern.<\/li><li><strong>?<\/strong>: Search backward for a pattern.<\/li><li><strong>n<\/strong>: Repeat the search in the same direction.<\/li><li><strong>N<\/strong>: Repeat the search in the opposite direction.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Undo\/Redo<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>u<\/strong>: Undo the last change.<\/li><li><strong>Ctrl + r<\/strong>: Redo the last undone change.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Visual Mode<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>v<\/strong>: Start visual mode (character-wise selection).<\/li><li><strong>V<\/strong>: Start visual line mode (line-wise selection).<\/li><li><strong>Ctrl + v<\/strong>: Start visual block mode (block-wise selection).<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Saving and Exiting<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>:w<\/strong>: Save the file.<\/li><li><strong>:q<\/strong>: Quit vi.<\/li><li><strong>:wq<\/strong> or <strong>ZZ<\/strong>: Save the file and quit.<\/li><li><strong>:q!<\/strong>: Quit without saving.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Other Useful Commands<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>:set nu<\/strong>: Show line numbers.<\/li><li><strong>:set nonu<\/strong>: Hide line numbers.<\/li><li><strong>:syntax on<\/strong>: Enable syntax highlighting (if using Vim).<\/li><li><strong>:syntax off<\/strong>: Disable syntax highlighting.<\/li><\/ul>\n\n\n\n<p>These commands form the basis of efficient text editing in Vi, allowing for powerful navigation, editing, and file management within the text editor.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vi (and its enhanced version, Vim) is a powerful text editor in Unix-like systems. Here are some of the most popular and commonly used commands in Vi: Basic Navigation h, j, k, l: Move left, down, up, and right, respectively. 0 (zero): Move to the beginning of the line. ^: Move to the first non-blank [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":20442,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[],"class_list":["post-20441","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-productivity-quality"],"jetpack_featured_media_url":"https:\/\/www.designandexecute.com\/designs\/wp-content\/uploads\/2024\/07\/20210415_153942_0000-2259381216.png","_links":{"self":[{"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/posts\/20441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/comments?post=20441"}],"version-history":[{"count":1,"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/posts\/20441\/revisions"}],"predecessor-version":[{"id":20443,"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/posts\/20441\/revisions\/20443"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/media\/20442"}],"wp:attachment":[{"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/media?parent=20441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/categories?post=20441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.designandexecute.com\/designs\/wp-json\/wp\/v2\/tags?post=20441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}