{"id":208,"date":"2020-08-18T19:23:47","date_gmt":"2020-08-18T20:23:47","guid":{"rendered":"http:\/\/www.linux-tutorial.info\/?page_id=77"},"modified":"2020-08-22T19:26:17","modified_gmt":"2020-08-22T20:26:17","slug":"this-is-the-page-title-toplevel-43","status":"publish","type":"page","link":"http:\/\/www.linux-tutorial.info\/?page_id=208","title":{"rendered":"More vi Magic"},"content":{"rendered":"\n<title>More vi Magic<\/title>\n<concept id=\"\" description=\"When you start 'vi', you can specify multiple files.\" \/>\n<question id=\"\" type=\"tf\" text=\"When you start 'vi', you can specify multiple files.\" \/>\n<p>\nIf we need to, we can also start <command>vi<\/command> toedit multiple files. This is done like this:<\/p>\n<p>\n<commandexample command=\"vi\">vi file1 file2 file3<\/commandexample>\n<\/p>\n<concept id=\"\" description=\"When editing mutliple files in 'vi', you can switch between files with :n for the next file and :p for the previous one\" \/>\n<p>\nOnce we are editing, we can switch between files with <keyinput>:n<\/keyinput> for the next file and <keyinput>:p<\/keyinput> for the\nprevious one. Keep in mind that the file names do not wrap around. In other words, if we\nkeep pressing <keyinput>:n<\/keyinput> and get to file3, doing it again does not wrap around\nand bring me to file1. If we know the name of the file, we can jump directly there, with\nthe ex-mode edit command, as in\n<\/p>\n<p>\n<commandexample>:e file3<\/commandexample>\n<\/p>\n<p>\nThe ability to edit multiple files has another advantage. Do you remember those numbered and\nnamed buffers? They are assigned for a single instance of <command>vi<\/command>, not on a per-file\nbasis. Therefore, you can delete or yank text from one file, switch to the next\nand then insert it. This is a crude but effective cut and paste mechanism between files.\n<\/p>\n<concept id=\"\" description=\"You can reload the last saved version of a file in 'vi' with 'e!'.\" \/>\n<question id=\"\" type=\"mc\" text=\"What key combination in 'vi' would you use to reload the last saved version of the current file?\" \/>\n<p>\nIf you switch to editing another file (using <keyinput>:n<\/keyinput> or <keyinput>:r<\/keyinput>),\n reload an original file (using <keyinput>:rew!<\/keyinput> or <keyinput>:e!<\/keyinput>), the contents of the deletion buffers are preserved so that you can cut and paste\nbetween files. The contents of all buffers are lost, however, when you quit vi.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More vi Magic If we need to, we can also start vi toedit multiple files. This is done like this: vi file1 file2 file3 Once we are editing, we can switch between files with :n for the next file and &hellip; <a href=\"http:\/\/www.linux-tutorial.info\/?page_id=208\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-208","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208"}],"version-history":[{"count":1,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/208\/revisions"}],"predecessor-version":[{"id":631,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/208\/revisions\/631"}],"wp:attachment":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}