{"id":956,"date":"2020-12-11T07:28:08","date_gmt":"2020-12-11T06:28:08","guid":{"rendered":"http:\/\/www.tinone71.com\/wp\/?p=956"},"modified":"2022-03-19T13:50:56","modified_gmt":"2022-03-19T12:50:56","slug":"vim-cheat-sheet","status":"publish","type":"post","link":"https:\/\/www.tinone71.com\/wp\/?p=956","title":{"rendered":"Vim Cheat Sheet"},"content":{"rendered":"<div style=\"\" class=\"ssag-opads-main     \" ><\/div>\n<h1 class=\"wp-block-heading\">Global<\/h1>\n\n\n\n<ul><li><kbd>:h[elp] keyword<\/kbd>&nbsp;&#8211; open help for keyword<\/li><li><kbd>:sav[eas] file<\/kbd>&nbsp;&#8211; save file as<\/li><li><kbd>:clo[se]<\/kbd>&nbsp;&#8211; close current pane<\/li><li><kbd>:ter[minal]<\/kbd>&nbsp;&#8211; open a terminal window<\/li><li><kbd>K<\/kbd>&nbsp;&#8211; open man page for word under the cursor<\/li><\/ul>\n\n\n\n<p><strong>Tip<\/strong>&nbsp;Run&nbsp;<kbd>vimtutor<\/kbd>&nbsp;in a terminal to learn the first Vim commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cursor movement<\/h2>\n\n\n\n<ul><li><kbd>h<\/kbd>&nbsp;&#8211; move cursor left<\/li><li><kbd>j<\/kbd>&nbsp;&#8211; move cursor down<\/li><li><kbd>k<\/kbd>&nbsp;&#8211; move cursor up<\/li><li><kbd>l<\/kbd>&nbsp;&#8211; move cursor right<\/li><li><kbd>H<\/kbd>&nbsp;&#8211; move to top of screen<\/li><li><kbd>M<\/kbd>&nbsp;&#8211; move to middle of screen<\/li><li><kbd>L<\/kbd>&nbsp;&#8211; move to bottom of screen<\/li><li><kbd>w<\/kbd>&nbsp;&#8211; jump forwards to the start of a word<\/li><li><kbd>W<\/kbd>&nbsp;&#8211; jump forwards to the start of a word (words can contain punctuation)<\/li><li><kbd>e<\/kbd>&nbsp;&#8211; jump forwards to the end of a word<\/li><li><kbd>E<\/kbd>&nbsp;&#8211; jump forwards to the end of a word (words can contain punctuation)<\/li><li><kbd>b<\/kbd>&nbsp;&#8211; jump backwards to the start of a word<\/li><li><kbd>B<\/kbd>&nbsp;&#8211; jump backwards to the start of a word (words can contain punctuation)<\/li><li><kbd>%<\/kbd>&nbsp;&#8211; move to matching character (default supported pairs: &#8216;()&#8217;, &#8216;{}&#8217;, &#8216;[]&#8217; &#8211; use&nbsp;<code>:h matchpairs<\/code>&nbsp;in vim for more info)<\/li><li><kbd>0<\/kbd>&nbsp;&#8211; jump to the start of the line<\/li><li><kbd>^<\/kbd>&nbsp;&#8211; jump to the first non-blank character of the line<\/li><li><kbd>$<\/kbd>&nbsp;&#8211; jump to the end of the line<\/li><li><kbd>g_<\/kbd>&nbsp;&#8211; jump to the last non-blank character of the line<\/li><li><kbd>gg<\/kbd>&nbsp;&#8211; go to the first line of the document<\/li><li><kbd>G<\/kbd>&nbsp;&#8211; go to the last line of the document<\/li><li><kbd>5gg<\/kbd>&nbsp;or&nbsp;<kbd>5G<\/kbd>&nbsp;&#8211; go to line 5<\/li><li><kbd>fx<\/kbd>&nbsp;&#8211; jump to next occurrence of character x<\/li><li><kbd>tx<\/kbd>&nbsp;&#8211; jump to before next occurrence of character x<\/li><li><kbd>Fx<\/kbd>&nbsp;&#8211; jump to previous occurence of character x<\/li><li><kbd>Tx<\/kbd>&nbsp;&#8211; jump to after previous occurence of character x<\/li><li><kbd>;<\/kbd>&nbsp;&#8211; repeat previous f, t, F or T movement<\/li><li><kbd>,<\/kbd>&nbsp;&#8211; repeat previous f, t, F or T movement, backwards<\/li><li><kbd>}<\/kbd>&nbsp;&#8211; jump to next paragraph (or function\/block, when editing code)<\/li><li><kbd>{<\/kbd>&nbsp;&#8211; jump to previous paragraph (or function\/block, when editing code)<\/li><li><kbd>zz<\/kbd>&nbsp;&#8211; center cursor on screen<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>e<\/kbd>&nbsp;&#8211; move screen down one line (without moving cursor)<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>y<\/kbd>&nbsp;&#8211; move screen up one line (without moving cursor)<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>b<\/kbd>&nbsp;&#8211; move back one full screen<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>f<\/kbd>&nbsp;&#8211; move forward one full screen<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>d<\/kbd>&nbsp;&#8211; move forward 1\/2 a screen<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>u<\/kbd>&nbsp;&#8211; move back 1\/2 a screen<\/li><\/ul>\n\n\n\n<p><strong>Tip<\/strong>&nbsp;Prefix a cursor movement command with a number to repeat it. For example,&nbsp;<kbd>4j<\/kbd>&nbsp;moves down 4 lines.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Insert mode &#8211; inserting\/appending text<\/h2>\n\n\n\n<ul><li><kbd>i<\/kbd>&nbsp;&#8211; insert before the cursor<\/li><li><kbd>I<\/kbd>&nbsp;&#8211; insert at the beginning of the line<\/li><li><kbd>a<\/kbd>&nbsp;&#8211; insert (append) after the cursor<\/li><li><kbd>A<\/kbd>&nbsp;&#8211; insert (append) at the end of the line<\/li><li><kbd>o<\/kbd>&nbsp;&#8211; append (open) a new line below the current line<\/li><li><kbd>O<\/kbd>&nbsp;&#8211; append (open) a new line above the current line<\/li><li><kbd>ea<\/kbd>&nbsp;&#8211; insert (append) at the end of the word<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>h<\/kbd>&nbsp;&#8211; delete the character before the cursor during insert mode<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>w<\/kbd>&nbsp;&#8211; delete word before the cursor during insert mode<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>j<\/kbd>&nbsp;&#8211; begin new line during insert mode<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>t<\/kbd>&nbsp;&#8211; indent (move right) line one shiftwidth during insert mode<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>d<\/kbd>&nbsp;&#8211; de-indent (move left) line one shiftwidth during insert mode<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>n<\/kbd>&nbsp;&#8211; insert (auto-complete) next match before the cursor during insert mode<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>p<\/kbd>&nbsp;&#8211; insert (auto-complete) previous match before the cursor during insert mode<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>rx<\/kbd>&nbsp;&#8211; insert the contents of register x<\/li><li><kbd>Esc<\/kbd>&nbsp;&#8211; exit insert mode<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Editing<\/h2>\n\n\n\n<ul><li><kbd>r<\/kbd>&nbsp;&#8211; replace a single character<\/li><li><kbd>J<\/kbd>&nbsp;&#8211; join line below to the current one with one space in between<\/li><li><kbd>gJ<\/kbd>&nbsp;&#8211; join line below to the current one without space in between<\/li><li><kbd>gwip<\/kbd>&nbsp;&#8211; reflow paragraph<\/li><li><kbd>g~<\/kbd>&nbsp;&#8211; switch case up to motion<\/li><li><kbd>gu<\/kbd>&nbsp;&#8211; change to lowercase up to motion<\/li><li><kbd>gU<\/kbd>&nbsp;&#8211; change to uppercase up to motion<\/li><li><kbd>cc<\/kbd>&nbsp;&#8211; change (replace) entire line<\/li><li><kbd>C<\/kbd>&nbsp;&#8211; change (replace) to the end of the line<\/li><li><kbd>c$<\/kbd>&nbsp;&#8211; change (replace) to the end of the line<\/li><li><kbd>ciw<\/kbd>&nbsp;&#8211; change (replace) entire word<\/li><li><kbd>cw<\/kbd>&nbsp;&#8211; change (replace) to the end of the word<\/li><li><kbd>s<\/kbd>&nbsp;&#8211; delete character and substitute text<\/li><li><kbd>S<\/kbd>&nbsp;&#8211; delete line and substitute text (same as cc)<\/li><li><kbd>xp<\/kbd>&nbsp;&#8211; transpose two letters (delete and paste)<\/li><li><kbd>u<\/kbd>&nbsp;&#8211; undo<\/li><li><kbd>U<\/kbd>&nbsp;&#8211; restore (undo) last changed line<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>r<\/kbd>&nbsp;&#8211; redo<\/li><li><kbd>.<\/kbd>&nbsp;&#8211; repeat last command<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Marking text (visual mode)<\/h2>\n\n\n\n<ul><li><kbd>v<\/kbd>&nbsp;&#8211; start visual mode, mark lines, then do a command (like y-yank)<\/li><li><kbd>V<\/kbd>&nbsp;&#8211; start linewise visual mode<\/li><li><kbd>o<\/kbd>&nbsp;&#8211; move to other end of marked area<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>v<\/kbd>&nbsp;&#8211; start visual block mode<\/li><li><kbd>O<\/kbd>&nbsp;&#8211; move to other corner of block<\/li><li><kbd>aw<\/kbd>&nbsp;&#8211; mark a word<\/li><li><kbd>ab<\/kbd>&nbsp;&#8211; a block with ()<\/li><li><kbd>aB<\/kbd>&nbsp;&#8211; a block with {}<\/li><li><kbd>at<\/kbd>&nbsp;&#8211; a block with &lt;&gt; tags<\/li><li><kbd>ib<\/kbd>&nbsp;&#8211; inner block with ()<\/li><li><kbd>iB<\/kbd>&nbsp;&#8211; inner block with {}<\/li><li><kbd>it<\/kbd>&nbsp;&#8211; inner block with &lt;&gt; tags<\/li><li><kbd>Esc<\/kbd>&nbsp;&#8211; exit visual mode<\/li><\/ul>\n\n\n\n<p><strong>Tip<\/strong>&nbsp;Instead of&nbsp;<kbd>b<\/kbd>&nbsp;or&nbsp;<kbd>B<\/kbd>&nbsp;one can also use&nbsp;<kbd>(<\/kbd>&nbsp;or&nbsp;<kbd>{<\/kbd>&nbsp;respectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Visual commands<\/h2>\n\n\n\n<ul><li><kbd>&gt;<\/kbd>&nbsp;&#8211; shift text right<\/li><li><kbd>&lt;<\/kbd>&nbsp;&#8211; shift text left<\/li><li><kbd>y<\/kbd>&nbsp;&#8211; yank (copy) marked text<\/li><li><kbd>d<\/kbd>&nbsp;&#8211; delete marked text<\/li><li><kbd>~<\/kbd>&nbsp;&#8211; switch case<\/li><li><kbd>u<\/kbd>&nbsp;&#8211; change marked text to lowercase<\/li><li><kbd>U<\/kbd>&nbsp;&#8211; change marked text to uppercase<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Registers<\/h2>\n\n\n\n<ul><li><kbd>:reg[isters]<\/kbd>&nbsp;&#8211; show registers content<\/li><li><kbd>\"xy<\/kbd>&nbsp;&#8211; yank into register x<\/li><li><kbd>\"xp<\/kbd>&nbsp;&#8211; paste contents of register x<\/li><li><kbd>\"+y<\/kbd>&nbsp;&#8211; yank into the system clipboard register<\/li><li><kbd>\"+p<\/kbd>&nbsp;&#8211; paste from the system clipboard register<\/li><\/ul>\n\n\n\n<p><strong>Tip<\/strong>&nbsp;Registers are being stored in ~\/.viminfo, and will be loaded again on next restart of vim.<strong>Tip<\/strong>&nbsp;Special registers:<\/p>\n\n\n\n<p>\u2003<kbd>0<\/kbd>&nbsp;&#8211; last yank<br>\u2003<kbd>\"<\/kbd>&nbsp;&#8211; unnamed register, last delete or yank<br>\u2003<kbd>%<\/kbd>&nbsp;&#8211; current file name<br>\u2003<kbd>#<\/kbd>&nbsp;&#8211; alternate file name<br>\u2003<kbd>*<\/kbd>&nbsp;&#8211; clipboard contents (X11 primary)<br>\u2003<kbd>+<\/kbd>&nbsp;&#8211; clipboard contents (X11 clipboard)<br>\u2003<kbd>\/<\/kbd>&nbsp;&#8211; last search pattern<br>\u2003<kbd>:<\/kbd>&nbsp;&#8211; last command-line<br>\u2003<kbd>.<\/kbd>&nbsp;&#8211; last inserted text<br>\u2003<kbd>-<\/kbd>&nbsp;&#8211; last small (less than a line) delete<br>\u2003<kbd>=<\/kbd>&nbsp;&#8211; expression register<br>\u2003<kbd>_<\/kbd>&nbsp;&#8211; black hole register<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Marks and positions<\/h2>\n\n\n\n<ul><li><kbd>:marks<\/kbd>&nbsp;&#8211; list of marks<\/li><li><kbd>ma<\/kbd>&nbsp;&#8211; set current position for mark A<\/li><li><kbd>`a<\/kbd>&nbsp;&#8211; jump to position of mark A<\/li><li><kbd>y`a<\/kbd>&nbsp;&#8211; yank text to position of mark A<\/li><li><kbd>`0<\/kbd>&nbsp;&#8211; go to the position where Vim was previously exited<\/li><li><kbd>`\"<\/kbd>&nbsp;&#8211; go to the position when last editing this file<\/li><li><kbd>`.<\/kbd>&nbsp;&#8211; go to the position of the last change in this file<\/li><li><kbd>``<\/kbd>&nbsp;&#8211; go to the position before the last jump<\/li><li><kbd>:ju[mps]<\/kbd>&nbsp;&#8211; list of jumps<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>i<\/kbd>&nbsp;&#8211; go to newer position in jump list<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>o<\/kbd>&nbsp;&#8211; go to older position in jump list<\/li><li><kbd>:changes<\/kbd>&nbsp;&#8211; list of changes<\/li><li><kbd>g,<\/kbd>&nbsp;&#8211; go to newer position in change list<\/li><li><kbd>g;<\/kbd>&nbsp;&#8211; go to older position in change list<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>]<\/kbd>&nbsp;&#8211; jump to the tag under cursor<\/li><\/ul>\n\n\n\n<p><strong>Tip<\/strong>&nbsp;To jump to a mark you can either use a backtick (<kbd>`<\/kbd>) or an apostrophe (<kbd>'<\/kbd>). Using an apostrophe jumps to the beginning (first non-black) of the line holding the mark.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Macros<\/h2>\n\n\n\n<ul><li><kbd>qa<\/kbd>&nbsp;&#8211; record macro a<\/li><li><kbd>q<\/kbd>&nbsp;&#8211; stop recording macro<\/li><li><kbd>@a<\/kbd>&nbsp;&#8211; run macro a<\/li><li><kbd>@@<\/kbd>&nbsp;&#8211; rerun last run macro<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Cut and paste<\/h2>\n\n\n\n<ul><li><kbd>yy<\/kbd>&nbsp;&#8211; yank (copy) a line<\/li><li><kbd>2yy<\/kbd>&nbsp;&#8211; yank (copy) 2 lines<\/li><li><kbd>yw<\/kbd>&nbsp;&#8211; yank (copy) the characters of the word from the cursor position to the start of the next word<\/li><li><kbd>y$<\/kbd>&nbsp;&#8211; yank (copy) to end of line<\/li><li><kbd>p<\/kbd>&nbsp;&#8211; put (paste) the clipboard after cursor<\/li><li><kbd>P<\/kbd>&nbsp;&#8211; put (paste) before cursor<\/li><li><kbd>dd<\/kbd>&nbsp;&#8211; delete (cut) a line<\/li><li><kbd>2dd<\/kbd>&nbsp;&#8211; delete (cut) 2 lines<\/li><li><kbd>dw<\/kbd>&nbsp;&#8211; delete (cut) the characters of the word from the cursor position to the start of the next word<\/li><li><kbd>D<\/kbd>&nbsp;&#8211; delete (cut) to the end of the line<\/li><li><kbd>d$<\/kbd>&nbsp;&#8211; delete (cut) to the end of the line<\/li><li><kbd>x<\/kbd>&nbsp;&#8211; delete (cut) character<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Indent text<\/h2>\n\n\n\n<ul><li><kbd>&gt;&gt;<\/kbd>&nbsp;&#8211; indent (move right) line one shiftwidth<\/li><li><kbd>&lt;&lt;<\/kbd>&nbsp;&#8211; de-indent (move left) line one shiftwidth<\/li><li><kbd>&gt;%<\/kbd>&nbsp;&#8211; indent a block with () or {} (cursor on brace)<\/li><li><kbd>&gt;ib<\/kbd>&nbsp;&#8211; indent inner block with ()<\/li><li><kbd>&gt;at<\/kbd>&nbsp;&#8211; indent a block with &lt;&gt; tags<\/li><li><kbd>3==<\/kbd>&nbsp;&#8211; re-indent 3 lines<\/li><li><kbd>=%<\/kbd>&nbsp;&#8211; re-indent a block with () or {} (cursor on brace)<\/li><li><kbd>=iB<\/kbd>&nbsp;&#8211; re-indent inner block with {}<\/li><li><kbd>gg=G<\/kbd>&nbsp;&#8211; re-indent entire buffer<\/li><li><kbd>]p<\/kbd>&nbsp;&#8211; paste and adjust indent to current line<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Exiting<\/h2>\n\n\n\n<ul><li><kbd>:w<\/kbd>&nbsp;&#8211; write (save) the file, but don&#8217;t exit<\/li><li><kbd>:w !sudo tee %<\/kbd>&nbsp;&#8211; write out the current file using sudo<\/li><li><kbd>:wq<\/kbd>&nbsp;or&nbsp;<kbd>\ud83d\ude21<\/kbd>&nbsp;or&nbsp;<kbd>ZZ<\/kbd>&nbsp;&#8211; write (save) and quit<\/li><li><kbd>:q<\/kbd>&nbsp;&#8211; quit (fails if there are unsaved changes)<\/li><li><kbd>:q!<\/kbd>&nbsp;or&nbsp;<kbd>ZQ<\/kbd>&nbsp;&#8211; quit and throw away unsaved changes<\/li><li><kbd>:wqa<\/kbd>&nbsp;&#8211; write (save) and quit on all tabs<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Search and replace<\/h2>\n\n\n\n<ul><li><kbd>\/pattern<\/kbd>&nbsp;&#8211; search for pattern<\/li><li><kbd>?pattern<\/kbd>&nbsp;&#8211; search backward for pattern<\/li><li><kbd>\\vpattern<\/kbd>&nbsp;&#8211; &#8216;very magic&#8217; pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)<\/li><li><kbd>n<\/kbd>&nbsp;&#8211; repeat search in same direction<\/li><li><kbd>N<\/kbd>&nbsp;&#8211; repeat search in opposite direction<\/li><li><kbd>:%s\/old\/new\/g<\/kbd>&nbsp;&#8211; replace all old with new throughout file<\/li><li><kbd>:%s\/old\/new\/gc<\/kbd>&nbsp;&#8211; replace all old with new throughout file with confirmations<\/li><li><kbd>:noh[lsearch]<\/kbd>&nbsp;&#8211; remove highlighting of search matches<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Search in multiple files<\/h2>\n\n\n\n<ul><li><kbd>:vim[grep] \/pattern\/ {`{file}`}<\/kbd>&nbsp;&#8211; search for pattern in multiple files<\/li><\/ul>\n\n\n\n<p>e.g.&nbsp;<kbd>:vim[grep] \/foo\/ **\/*<\/kbd><\/p>\n\n\n\n<ul><li><kbd>:cn[ext]<\/kbd>&nbsp;&#8211; jump to the next match<\/li><li><kbd>:cp[revious]<\/kbd>&nbsp;&#8211; jump to the previous match<\/li><li><kbd>:cope[n]<\/kbd>&nbsp;&#8211; open a window containing the list of matches<\/li><li><kbd>:ccl[ose]<\/kbd>&nbsp;&#8211; close the quickfix window<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Tabs<\/h2>\n\n\n\n<ul><li><kbd>:tabnew<\/kbd>&nbsp;or&nbsp;<kbd>:tabnew {page.words.file}<\/kbd>&nbsp;&#8211; open a file in a new tab<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wT<\/kbd>&nbsp;&#8211; move the current split window into its own tab<\/li><li><kbd>gt<\/kbd>&nbsp;or&nbsp;<kbd>:tabn[ext]<\/kbd>&nbsp;&#8211; move to the next tab<\/li><li><kbd>gT<\/kbd>&nbsp;or&nbsp;<kbd>:tabp[revious]<\/kbd>&nbsp;&#8211; move to the previous tab<\/li><li><kbd>#gt<\/kbd>&nbsp;&#8211; move to tab number #<\/li><li><kbd>:tabm[ove] #<\/kbd>&nbsp;&#8211; move current tab to the #th position (indexed from 0)<\/li><li><kbd>:tabc[lose]<\/kbd>&nbsp;&#8211; close the current tab and all its windows<\/li><li><kbd>:tabo[nly]<\/kbd>&nbsp;&#8211; close all tabs except for the current one<\/li><li><kbd>:tabdo<\/kbd>&nbsp;command &#8211; run the&nbsp;<code>command<\/code>&nbsp;on all tabs (e.g.&nbsp;<code>:tabdo q<\/code>&nbsp;&#8211; closes all opened tabs)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Working with multiple files<\/h2>\n\n\n\n<ul><li><kbd>:e[dit] file<\/kbd>&nbsp;&#8211; edit a file in a new buffer<\/li><li><kbd>:bn[ext]<\/kbd>&nbsp;&#8211; go to the next buffer<\/li><li><kbd>:bp[revious]<\/kbd>&nbsp;&#8211; go to the previous buffer<\/li><li><kbd>:bd[elete]<\/kbd>&nbsp;&#8211; delete a buffer (close a file)<\/li><li><kbd>:b[uffer]#<\/kbd>&nbsp;&#8211; go to a buffer by index #<\/li><li><kbd>:b[uffer] file<\/kbd>&nbsp;&#8211; go to a buffer by file<\/li><li><kbd>:ls<\/kbd>&nbsp;or&nbsp;<kbd>:buffers<\/kbd>&nbsp;&#8211; list all open buffers<\/li><li><kbd>:sp[lit] file<\/kbd>&nbsp;&#8211; open a file in a new buffer and split window<\/li><li><kbd>:vs[plit] file<\/kbd>&nbsp;&#8211; open a file in a new buffer and vertically split window<\/li><li><kbd>:vert[ical] ba[ll]<\/kbd>&nbsp;&#8211; edit all buffers as vertical windows<\/li><li><kbd>:tab ba[ll]<\/kbd>&nbsp;&#8211; edit all buffers as tabs<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>ws<\/kbd>&nbsp;&#8211; split window<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wv<\/kbd>&nbsp;&#8211; split window vertically<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>ww<\/kbd>&nbsp;&#8211; switch windows<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wq<\/kbd>&nbsp;&#8211; quit a window<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wx<\/kbd>&nbsp;&#8211; exchange current window with next one<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>w=<\/kbd>&nbsp;&#8211; make all windows equal height &amp; width<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wh<\/kbd>&nbsp;&#8211; move cursor to the left window (vertical split)<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wl<\/kbd>&nbsp;&#8211; move cursor to the right window (vertical split)<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wj<\/kbd>&nbsp;&#8211; move cursor to the window below (horizontal split)<\/li><li><kbd>Ctrl<\/kbd>&nbsp;+&nbsp;<kbd>wk<\/kbd>&nbsp;&#8211; move cursor to the window above (horizontal split)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Diff<\/h2>\n\n\n\n<ul><li><kbd>zf<\/kbd>&nbsp;&#8211; manually define a fold up to motion<\/li><li><kbd>zd<\/kbd>&nbsp;&#8211; delete fold under the cursor<\/li><li><kbd>za<\/kbd>&nbsp;&#8211; toggle fold under the cursor<\/li><li><kbd>zo<\/kbd>&nbsp;&#8211; open fold under the cursor<\/li><li><kbd>zc<\/kbd>&nbsp;&#8211; close fold under the cursor<\/li><li><kbd>zr<\/kbd>&nbsp;&#8211; reduce (open) all folds by one level<\/li><li><kbd>zm<\/kbd>&nbsp;&#8211; fold more (close) all folds by one level<\/li><li><kbd>zi<\/kbd>&nbsp;&#8211; toggle folding functionality<\/li><li><kbd>]c<\/kbd>&nbsp;&#8211; jump to start of next change<\/li><li><kbd>[c<\/kbd>&nbsp;&#8211; jump to start of previous change<\/li><li><kbd>do<\/kbd>&nbsp;or&nbsp;<kbd>:diffg[et]<\/kbd>&nbsp;&#8211; obtain (get) difference (from other buffer)<\/li><li><kbd>dp<\/kbd>&nbsp;or&nbsp;<kbd>:diffpu[t]<\/kbd>&nbsp;&#8211; put difference (to other buffer)<\/li><li><kbd>:diffthis<\/kbd>&nbsp;&#8211; make current window part of diff<\/li><li><kbd>:dif[fupdate]<\/kbd>&nbsp;&#8211; update differences<\/li><li><kbd>:diffo[ff]<\/kbd>&nbsp;&#8211; switch off diff mode for current window<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Global :h[elp] keyword&nbsp;&#8211; open help for keyword :sav[eas] file&nbsp;&#8211; save file as :clo[se]&nbsp;&#8211; close current pane :ter[minal]&nbsp;&#8211; open<\/p>\n","protected":false},"author":1,"featured_media":1005,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[11,3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/956"}],"collection":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=956"}],"version-history":[{"count":2,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/956\/revisions"}],"predecessor-version":[{"id":958,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/956\/revisions\/958"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/media\/1005"}],"wp:attachment":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}