{"componentChunkName":"component---src-templates-post-js","path":"/pensieve/vim-cheatsheet","result":{"data":{"markdownRemark":{"html":"<p><img src=\"https://www.ubuntupit.com/wp-content/uploads/2019/03/Vim-Commands.jpg\" alt=\"Draft fail\"></p>\n<h2>Generally helpful stuff</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Open a file for editing             :e path/to/file.txt\nReturn to Normal mode               ESC   or &lt;CTRL>+C</code></pre></div>\n<h2>Navigating around text</h2>\n<p>You have to be in Normal mode. Use ESC to get out of Visual, Replace, or Insert mode.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">(left)                       h\n(down)                       j\n(up)                         k\n(right)                      l\nnext word                    e\nJump to the first line       gg\nJump to the last line        G</code></pre></div>\n<h2>Entering Text</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Insert text before cursor               i\nInsert text after cursor                a</code></pre></div>\n<h2>Working with multiple files</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Open a file in a horizontal split   :sp path/to/file.txt\nOpen a file in a vertical split     :vsp path/to/file.txt\nMove to a split window page         &lt;CTRL>+w and a direction key (h, j, k, or l)\nMove to next window pane            &lt;CTRL>w w\nMake selected pane bigger           CTRL>w +  (yes, you need the shift key for the plus)\nMake selected pane smaller          &lt;CTRL>w -</code></pre></div>\n<h2>Searching</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Search for a word                           /&lt;word>\nGo to next match                            n\nFind and replace on line                    :s/&lt;find>/&lt;replace>\nFind and replace globally                   :%s/&lt;find>/&lt;replace>//gc\nGo to first quote, replace text in quotes:  ci\"</code></pre></div>\n<h2>Manipulating text</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">cut the current line                dd\ncopy the current line               yy\npaste below current line            p\npaste above current line            P\nRemove the character under cursor   x\nRemove the character before cursor  X\nDelete the word under cursor        de\nDelete to the end of the line       d$\n\nRemove five lines starting here     5dd\nCopy five lines starting here       5yy\n\nindent this line                    >>\nindent five lines starting here     5>>\n\nReplace mode (overtype)             r</code></pre></div>\n<h2>Visual Advanced selection</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Visual mode                         v\nVisual Line mode                    V\nVisual Block mode                   &lt;CTRL>v</code></pre></div>\n<h2>Working with NERDTree</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Open the NERDTree                   :NERDTree\nToggle the NERDTree on and off      :NERDTreeToggle\nOpen selected file                  &lt;ENTER>\nOpen selected file in horiz. split  i\nOpen selected file in vert. split   v\nFile menu                           m\nHelp                                ?</code></pre></div>\n<h2>Commands:</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Run a command                           :!&lt;command>\nOpen a shell                            :sh</code></pre></div>\n<p>For interactive tutorial, try <a href=\"https://openvim.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">openvim.com</a></p>\n<p>Follow me on <a href=\"https://github.com/rubiin\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Github</a></p>","frontmatter":{"title":"Vim quickies/ cheatsheet","description":null,"date":"2019-11-24","slug":"/pensieve/vim-cheatsheet","tags":["Vim","Editor","Linux"]}}},"pageContext":{}},"staticQueryHashes":["3115057458"]}