Skip to content

Instantly share code, notes, and snippets.

@zstix
Created April 26, 2021 21:22
Show Gist options
  • Save zstix/3a1d1e48a71a6db1a5849aeed975232f to your computer and use it in GitHub Desktop.
Save zstix/3a1d1e48a71a6db1a5849aeed975232f to your computer and use it in GitHub Desktop.
  1. Learn how to learn
  • vimtutor
  • :help user-manual
  • Never stop learning
  • Pick up one new thing each week

What does Control-R do? :help <C-r>

How do I use completion in insert mode? :help ins-completion

How do I split the window? :help :split / :help usr_08.txt

How do I enable / use spellchecking? :help spell

T.I.L. :helpgrep [search_term] exists!

  1. Stick with it
  • vim can really suck in the beginning
  • 30 min to work, 1 week for basic proficiency, 1 month to exceed
  • Constant improvement after that!
   Learning curve meme
   |  _________
   | |
   | |
   |_|_________

   More realistic curve
   |      /
   |   .-'
   |  /
   |_|_________
  1. Keep an eye out for repetition
  • Always ask, is there a way to do this better?
  • Repeat with .
  • Record a macro with q[register]
  • Add a [count] to your actions
  • Visual Block

:help . / :help single-repeat :help q / :help macro :help count

const id = user.get('id');
const name = user.get('id');
const age = user.get('age');
  1. Roll your own vimrc
  • Start simple and build it up over time
  • Look at others, but don't copy a full configuration
  • Great way to encourage learning

:help usr_05.txt

My Configuration

  1. Learn how to move around
  • Arrow keys aren't that helpful
  • Find the right motion for the desired outcome
  • Take time to think about what you want to do
import React from 'react';

const greeter = (lang) =>
  lang.toLowerCase() === 'spanish' ? 'Hola' : 'Hello';

const MyComponent = ({ name }) => (
  <div>
    <h1>{geeter()}!</h1>
    <p>Your name is {name}</p>
  </div>
);

export default MyComponent;
  1. Learn vim's language
  • [command][quantity][motion]
  • :help text-objects
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec at orci sit amet orci auctor elementum blandit ac justo. Praesent volutpat leo quis pharetra mollis. In bibendum ante ornare pellentesque auctor.

Aliquam erat volutpat. Nam blandit ligula at mauris interdum, ac scelerisque nibh accumsan. Sed in nibh diam. Integer ullamcorper et nisl et placerat. Nam rutrum ac tellus at finibus. Etiam tincidunt vestibulum nulla quis molestie. Aliquam erat volutpat. Nam consectetur eleifend diam in lobortis.
<div>
  <h1>List</h1>
  <ul>
    <li>One</li>
    <li>Two</li>
    <li>Three</li>
  </ul>
</div>

You got this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment