Vim

Customize Your Vim Setup; Thank Me Later

Create a Leader Command for Vim Paste Mode

Andy Huynh

1 minute read

Ever copy something to your clipboard to NOT have it appear as you would expect in Vim? Pasting from another application to Vim yields wonky results because Vim doesn’t know how to handle the clipboard’s content. Vim has a paste mode you can toggle on or off using :set paste and :set nopaste. Vim has a one liner you can add to vimrc to transform into a Vim paste toggle: set pastetoggle=<F2>.

Typo All You Want with Vim

Just a trick for more accurate spelling with Vim

Andy Huynh

1 minute read

I like to code recklessly. Spelling errors aren’t uncommon when this happens. Defining variables and calling them in different places where I expect them to work and they DON’T work is a problem. There’s a command with Vim that’s handy for this situation. Hover your Vim cursor over the variable you instantiate and SHIFT * over it. This will highlight each variable with the same variable name, one by one. It allows you to visually see each variable and if it’s defined with accurate spelling or if you fucked up!

WTF are Affiliate Links?

Tutorial - Create Affiliate Links for User Accounts

Andy Huynh

2 minute read

Your SaaS project is taking off and you’re making $$. Customers want to sell your product. Let’s utilize Rails to create affiliate links so customer accounts will sell for you. We’ll want to generate an affiliate link akin to: https://<your_hostname>/r/<affiliate_token> This is made up of a protocol, your hostname and affiliate token - in that order. Rails url helpers will pick up current request protocol and hostname for us. This will make life easier.

To :wq or :x, that is the question

Save Vim Keystrokes when Saving

Andy Huynh

1 minute read

If your workflow consists of using Vim and commiting code with Github, you’ll often see THIS screen: AND you’ll use :wq to save and quit Vim. Awesome! Apparently :x does the EXACT.. SAME.. THING! Ugh. Save some keystrokes, folks.