Emphasize access to the frequently used

2019-11-04 @Technology
By Vitaly Parnas

Contents

The merits

It makes much sense to streamline access to those most frequently used (MFU) elements of your life.

Most frequent contacts often appear above others in your address book. You may even assign frequent phone numbers to speed-dial digits.

Frequently worn garments should appear within quickest reach in the wardrobe. Similar care goes for mechanical tools and kitchen utensils in their respective housing.

Your wallet (or purse) should yield the most frequent cards/items on top.

Most frequently accessed books unlikely collect dust on the back row of the lowest shelf.

Index cards for note taking

I still heavily appeal to analog tools, which includes heavy usage of paper notebooks and index cards.

My index cards fall into several divided sections, which include 1) principles/techniques/inspirations, 2) publications and drafts, 3) projects, 4) independent lists.

Most frequently accessed cards typically appear at the top of each section. However, I maintain a separate stack (‘cache’) of ~10 binder-clipped cards that I carry with me. These include the MFU material from any category.

And as you suspect, the two outer cards of this stack represent the most frequent and immediate of all. Presently, the two cards are 1) generic idea list, and 2) ideas for publications.

As you can see, I maintain the MFU layers similarly to the modern CPU architecture memory hierarchy (Registers->L1 cache->…->Lncache->RAM->2ry storage.)

The same MFU paradigm should apply to everything you do digitally, considering the amount of time you may spend on the computer. Here I demonstrate some strategies.

Shell aliases

The main idea is to identify your MFU files, directories and operations, facilitating their access via the minimal amount of keystrokes. The alias shell feature is one example.

If you spend much time in the ~/.notes document, the following might make sense:

alias n="$EDITOR ~/.notes"

If you mostly live in ~/work/projects, similarly:

alias p="cd ~/work/projects && ls -tra"

You’ll soon find that many of such aliases begin to replicate the common $EDITOR, alias, cd and ls directives. To avoid the repetition and emphasize the unique files/directories/etc, explore my repository Automations.

There you’ll find alias-gen, a utility to streamline the generation of aliases of varying categories. The instructions appear in the README, but for a quick understanding, glance at aliases.example. The compact version looks like the following:

[defs]
OUTPUT = $HOME/.shortcuts

[cmd_templates]
dirs = cd %s && ls -tra
files = $EDITOR %s

[dirs]
w = ~/work
a = ~/work/automations
b = ~/my_blog
d = ~/Documents
r = ~/Documents/Research

[files]
cfa = ~/.aliases
cfA = ~/.config/awesome/rc.lua
cfb = ~/.bashrc
cfj = ~/.jrnl2.rc
nn = ~/.notes

Create whatever section of aliases you wish and define a command template for each in the section ‘cmd_templates’. You’ll find further use cases in the README.

Once you invoke alias-gen with the file .aliases of the above structure, the program generates ~/.shortcuts consisting of all the verbose shell aliases. It then remains to source that file in your shell config, ie . ~/.shortcuts.

Shorthand/speedwords

In the VIM Abbreviations and Short-Hand publication I demonstrate a handful (and continuously evolving) abbreviations I use to streamline typing. Many of these borrow from official Shorthand systems, including the Dutton Speedwords. The very idea concerns the ease of written expression for the most frequently used elements in language.

Now, rather than centralize my Speedword definitions in the VIM-centric abbreviation file, I wanted to abstract them to a generic definition list, at the same time enabling comments, multiple definitions, and general forward compatibility in case I choose to adapt the list to some other mechanism. See, for example, my letter-D section of shorthand.txt:

d from, of # French de
da give, donate # Latin dare
de day
dt don't
ddt didn't
deb should, debt, own
des want, desire, wish
di say # diction, French dire
dok document
dor sleep
dy since # French depuis, see after
du difficult
dif different
dir direction

Having established this simple convention, I automate the conversion process to the VIM abbreviation file as follows in ~/.vimrc:

autocmd BufWritePost shorthand.txt silent !sed -r '/^(\#|\s*$)/d; \
    s/\s*\#.*//; s/^(\S+)\s+([^,;]+).*/iab \1 \2/' % \
    > ~/.vim/scripts/abbrev.vim

Make sure the abbreviations load somewhere within your .vimrc. I opt to load all scripts as such:

" Load all available scripts
:runtime! scripts/*.vim

Git aliases

You can severely expedite access to frequently used git invocations. Here’s the section of git aliases I presently use. These constitute at least 95% of what I do with git.

alias \
    gicl='git clone' \
    gis='git status' \
    gic='git commit' \
    gica='git commit -a' \
    gia='git add' \
    gil='git log' \
    gilf='git log --follow' \
    gilp='git log -p' \
    gilfp='git log -p --follow' \
    gils='git log --compact-summary' \
    gilfs='git log --compact-summary --follow' \
    gid='git diff' \
    gip='git push' \
    gipl='git pull' \
    gim='git mv'

Search content

grep

I maintain myriads of disparate text documents at varying locations that I frequently query for content. These include journal entries, idea lists, notes files, calendar notes, and web bookmarks even.

Traditionally I would search each source independently, using something like grep -irl (case-insensitive, recursive, list-files-only) or grep -irc (for match counts next to matching filenames) to get a gauge of which files are the likely candidates for content I seek.

I would also need to recollect each possibly relevant content source. Sometimes I may forget having made a specific note in a calendar entry, meticulously searching the journal!

srchx to search disparate content

To address the above, I automated the search procedure to more seamlessly explore disparate sources of content. Once again, I defer you to the Automations repository. This time examine the srchx utility. See the README and example configuration for usage.

To briefly demonstrate, having defined the appropriate content sources and search abstractions in the configuration, you can then execute searches as follows:

srchx linux notes bookmarks

The above searches all my disparate notes as well as bookmarks for any of the defined terms related to ‘linux’. Here, ‘linux’ is a tag (srchx also accepts free search terms), while ‘notes’ and ‘bookmarks’ are content definitions.

Quick notes, quick bookmarks

We probably wish to compose quick notes with the same ease as we search for them. The modular and CLI-friendly jrnl2 provides a flexible journaling/record-searching/note-taking solution.

But how about those quick, dirty, spontaneous notes we want to immediately capture without as much as a clue to their ultimate destination? Paper often serves this purpose. But I sometimes want something longer-lasting and, most importantly, searchable!

I maintain one such file in my home directory: ~/.notes, defined by the environment variable $NOTES in ~/.profile:

export NOTES="$HOME/.notes"

Furthermore, I created a number of quick shortcuts from varying apps to amend this file:

  1. The command-line alias ‘nn’ to open the file for editing. See above.

  2. In ~/.vimrc I maintain the following set of mappings. This enables me to immediately direct either the current line or the selection to that notes document.

    The mappings can serve to note an important section of the currently viewed file, or to immediately take unrelated notes (ie from an unexpected phone call) in the very buffer we’re editing without further consideration. How often do we capture spontaneous information in unrelated paper sources? This is the digital equivalent.

    " Append the line or selection to the notes file in env $NOTES
    nmap ,n :.w! >> $NOTES \| echo "Line written to notes"<CR>
    vmap ,n :w! >> $NOTES \| echo "Selection written to notes"<CR>
    
  3. Quick W3M bookmark. In ~/.w3m/config I have the following. It enables me to direct the currently viewed or linked url (prefixed with a tag ‘@url’ for creative use) via keystrokes ‘3O’ or ‘3o’, respectively.

    extbrowser3 url=%s out_file=$NOTES && echo @url $url >> $out_file \
        && echo $url saved to $out_file && read he
    
  4. A newsboat RSS feed reader macro to append the currently selected feed URL to the notes file, defined in ~/.newsboat/config:

    macro n set browser "cat >> $NOTES <<<" ; \
        open-in-browser ; set browser xdg-open
    

Important documents folder

I lastly designated a folder with symlinks to all the disparate files (and folders) I wish to maintain in my field of attention. These can include drafts of writings, important annotations, lists of ideas, principles, and generally any documents I don’t wish to forget.

The folder, which you can setup in something as simple as ~/important_docs, is especially handy for symlinks to those documents buried within deep directory hierarchy.

Questions, comments? Connect.