Ctags Dotfiles

Something I took for granted at Hashrocket was the file that configures Exhuberant Ctags. Without configuration, recursive tag generation will tag many things and cause problems. overindex badly. Here’s how you configure Ctags to ignore things: /ctags.cnf (on MSDOS, MSWindows only) /etc/ctags.conf /usr/local/etc/ctags.conf $HOME/.ctags $HOME/ctags.cnf (on MSDOS, MSWindows only) .ctags ctags.cnf (on MSDOS, MSWindows only) If any of these configuration files exist, each will be expected to contain a set of default options which are read in the order listed when ctags starts, but before the CTAGS environment variable is read or any command line options are read. This makes it possible to set up site-wide, personal or project-level defaults. Here’s the head of my root .ctags, which even this far in is excluding a lot: ...

March 18, 2022

Refining Your Terminal Aliases

Any command you type out manually, or even tab-complete a few times, can be shortened. A common shortening technique is the terminal alias. Here are some tips that help me write better aliases and cut my terminal keystrokes. ...

February 10, 2022

Save Size Change to iTerm Profile

The longer I program (ahem), the bigger I want my terminal fonts. I think most programmers should be using a bigger font than they are. Complicating matters, the standard font for iTerm is miniscule on a computer monitor. Today I discovered iTerm’s ‘View > Size Changes Update Profile’ feature. When enabled, changes to your font size via ⌘ + and ⌘ - will be applied to your iTerm profile. The next time you open iTerm, the new font size will persist.

November 13, 2021

Autojump and Open

I love autojump. I use it because I think that remembering my location in a directory structure relative to other directories, so I can navigate with cd, is mental energy I could be using for something else. Today I learned that autojump has a jo command, which jumps to a directory and opens it in your file explorer. jo Desktop This might be a throwaway lesson if I wasn’t regularly sidetracked by the MacOS file explorer. Finding a file using the file explorer is a routine operation I have yet to do fluidly on a Mac. This helps!

November 6, 2021

Command Line Subshell

When chaining commands in the terminal, you may need to do things that affect the shell’s environment, like change directories. Here’s an example: $ yarn install && cd ios && pod install && cd .. && yarn build These cd’s can clutter up a script, and they’re incidental. My solution is to use a subshell (here’s the explanation from man bash): (list) list is executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT below). Variable assignments and builtin commands that affect the shell’s environment do not remain in effect after the command completes. The return status is the exit status of list. ...

August 2, 2021

Directional Commands

You can move the cursor without arrow keys. Here is the keyboard equivalent for each. Up (‘previous’): CTRL + P Down (’next’): CTRL + N Left (‘back’): CTRL + B Right (‘forward’): CTRL + F Mapping caps lock to CTRL makes these combinations very accessible.

April 21, 2021

Finding Getters

After writing the other day about why you might not want to use simple getters, I decided that I wanted to eliminate all such methods from a project. Here is the regex I wrote to isolate the pattern: ag 'def (\w+);?\s+@\1;?\s+end' The semicolon catches one-line getter methods as well as the more common three-line.

April 21, 2021

MD5 File Signatures

The command md5 <file> generates a unique 32-digit hexadecimal number. This can serve as a signature for a file in its particular state, letting you know when it has changed. Example usage: $ touch test.txt $ md5 test.txt MD5 (test.txt) = d41d8cd98f00b204e9800998ecf8427e $ echo 'some content' > test.txt $ md5 test.txt MD5 (test.txt) = eb9c2bf0eb63f3a7bc0ea37ef18aeba5

April 21, 2021

Printing with lpr

Recently while trying to fix a printer I used lpr a bunch of times. It’s not exactly new to me, but never fails to surprise people when I use it. lpr submits files for printing to your default printer in OSX. Print a file: lpr README.md Print the current file in your Vim session, with a cool job name: :! lpr -T 'cool job name' % Print two copies to a specific printer: ...

April 21, 2021

Reverse a String

Reverse a string with the rev command. $ echo 'test' | rev tset It also works with files. $ rev Procfile br.amup/gifnoc C- amup cexe eldnub :bew

April 21, 2021

Don’t miss my next essay

Hear from me immediately when I post: no ads, unsubscribe anytime.