brhfl.com

Dotfile highlights: .vimrc

I use zsh, and portability across Darwin, Ubuntu, Red Hat, cygwin, WSL, various gvims, etc. means I may have pasted something in that’s system-specific by accident.

New series time, I guess! I thought for the benefit of my future self, as well as anyone who might wander through these parts, there might be value in documenting some of the more interesting bits of my various dotfiles (or other config files). First up is .vimrc, and while I have plenty of important yet trivial things set in there (like set shell=zsh and mitigating a security risk with set modelines=0), I don’t intend to go into anything that’s that straightforward. But things like:

"uncomment this on a terminal that supports italic ctrl codes
"but doesn't have a termcap file that reports them
"set t_ZH=^[[3m
"set t_ZR=^[[23m

…are a bit more interesting. I do attempt to maintain fairly portable dotfiles, which means occasionally some of the more meaningful bits start their lives commented out.

Generally speaking, I leave word wrapping on, and I don’t hard wrap anything1. I genuinely do not understand the continuing practice of hard wrapping in 2018. Even notepad.exe soft wraps. I like my indicator to be an ellipsis, and I need to set some other things related to tab handling:

"wrap lines, wrap them at logical breaks, adjust the indicator
set wrap
if has("linebreak")
	set linebreak
	set showbreak=…\ \ 
	set breakindentopt=shift:1,sbr
endif

Note that there are two escaped spaces after the ellipsis in showbreak. I can easily see this trailing space because of set listchars=eol:↲,tab:→\ ,nbsp:·,trail:·,extends:…,precedes:…. I use a bent arrow in lieu of an actual LFCR symbol for the sake of portability. I use ellipses again for the ‘more stuff this way’ indicators on the rare occasions I turn wrapping off (set sidescroll=1 sidescrolloff=1 for basic unwrapped sanity). I use middots for both trailing and non-breaking spaces, either one shows me there’s something space-related happening. I also only set list if &t_Co==256, because that would get distracting quickly on a 16 color terminal.

Mouse handling isn’t necessarily a given:

if has("mouse") && (&ttymouse=="xterm" || &ttymouse=="xterm2")
	set mouse=a "all mouse reporting.
endif

I’m not entirely sure why I check for xterm/2. I would think it would be enough to check that it isn’t null. I may need to look into this. At any rate, the variable doesn’t exist if not compiled with +mouse, and compiling with +mouse obviously doesn’t guarantee the termcap is there, so two separate checks are necessary.

I like my cursors to be different in normal and insert modes, which doesn’t happen by default on cygwin/mintty. So,

"test for cygwin; not sure if we can test for mintty specifically
"set up block/i cursor
if has("win32unix")
	let &t_ti.="\e[1 q"
	let &t_SI.="\e[5 q"
	let &t_EI.="\e[1 q"
	let &t_te.="\e[0 q"
endif

Trivial, but very important to me:

"make ctrl-l & ctrl-z work in insert mode; these are crucial
imap <C-L> <C-O><C-L>
imap <C-Z> <C-O><C-Z>

I multitask w/ Unix job control constantly, and hugo server’s verbosity upon file write means I’m refreshing the display fairly often. Whacking Ctrlo before Ctrll or Ctrlz is easy enough, but I do it enough that I’d prefer to simplify.

I have some stuff in for handling menus on the CLI, but I realize I basically never use it… So while it may be interesting, it’s probably not useful. Learning how to do things in vim the vim way is generally preferable. So, finally, here we have my status line:

if has("statusline")
	set laststatus=2
	set statusline=%{winnr()}%<:%f\ %h%m%r%=%y%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P
endif

I don’t like my status line to be too fancy, or rely on anything nonstandard. But there are a few things here which are quite important to me. First, I start with the window number. This means when I have a bunch of splits, I can easily identify which I want to switch to with (say) 2Ctrlww. I forget what is shown by default, but toward my right side I show edited/not, detected filetype, file encoding, and presence or lack thereof of BOM. Here’s a sample:

2<hfl.com/content/post/2018-02/vimrc.md [+][markdown][utf-8]  65,6           Bot

That’s about everything notable from my .vimrc. Obviously, I set my colorscheme, I set up some defaults for printing, I set a few system-dependent things, I set some things to pretty up folds. I set spell; display=lastline,uhex; syntax on; filetype on; undofile; backspace=indent,eol,start; confirm; timeoutlen=300. I would hesitantly recommend new users investigate Tim Pope’s sensible.vim, though I fundamentally disagree with some of his ideas on sensibility (incsearch? autoread? Madness).


  1. This is a lie, as already evidenced in this post. I will hard wrap comments and potentially code if I believe it may be distributed beyond my control. I hard wrap comments in my .vimrc partly because I may need to investigate it on a poorly-configured vim. ↩︎

Personal Log

For reasons that are not really relevant to this post, I am in search of a good solution for a personal log or journal type thing. Essentially, my goal is to be able to keep a record of certain events occurring, with a timestamp and brief explanation. Things like tags would be great, or fields for additional circumstances. Ideally, it’ll be portable and easily synced between several machines. Setting up an SQLite database would be a great solution, except that merge/sync issue sounds like a bit of a nightmare. jrnl looks really neat, but I haven’t been able to try it yet due to a borked homebrew on my home Mac1 and a lack of pip on my main Win machine. While syncing this could also be a chore, and there would be no mobile version, the interface itself is so straightforward that writing an entry could be done in any text editor, and then fed line-by-line into the command.

But I haven’t settled on anything yet, so I was just kind of maintaining a few separate text files using vim (Buffer Editor on iOS), and figuring I’d cat them together at some point. But I got to thinking about ways I can make my life easier (not having to manually insert entries at the right spot chronologically, etc.), and came to a few conclusions about ways to maintain a quick and dirty manual log file.

First thing was to standardize and always use a full date/timestamp. Originally I was doing something like:

2018-01-29:
    8.05a, sat on a chair.
    10.30p, ate a banana.

2018-01-30:
    [...]

…which is very hard to sort. So I decided to simply preface every single entry with an ISO-formatted stamp down to the minute, and then delimit the entry with a tab (2018-01-29T22.30 ate a banana.). As a matter of principal, I don’t like customizing my environment too much, or in ways that will lead to my forgetting how to do things without customization. I don’t, therefore, have many custom mappings in vim, but why not simplify adding the current date and/or time:

"insert time and date in insert mode
imap <Leader>d <C-R>=strftime('%F')<CR>
imap <Leader>t <C-R>=strftime('%R')<CR>
imap <Leader>dt <C-R>=strftime('%FT%R')<CR>

Leaderd for ISO-formatted date, Leadert for ISO-formatted time (down to minutes), Leaderdt for both, separated by a ’T’. If everything is formatted the same, with lines beginning in ISO time formats, then every entry can readily be sorted. Sorting is simple in vim, :sort or, to strip unique lines, :sort u. I think that it’s more likely that the merge operation would happen outside of vim, in which case we’d use the sort command in the same way: cat log1.tsv log2.tsv >> log.tsv && sort -u -o log.tsv log.tsv. sorting in place like this was a new discovery for me; I had always used temporary files before, but apparently if the output file to sort (specified by -o) is the same as the input file, it handles all the temporary file stuff on its own.

I think it’d be neat to establish a file format for this in vim. Sort upon opening (with optional uniqueness filtering). Automatically timestamp each newline. Perhaps have some settings to visually reformat the timestamp to something friendlier while retaining ISO in the background (using conceal?). The whole thing is admittedly very simple and straightforward, but it’s a process that seems worthwhile to think about and optimize. While most journaling solutions are much more complicated, I think there is a lot of value in a simple timestamped list of events for tracking certain behaviors, etc. I’m a bit surprised there isn’t more out there for it.


  1. The joys of a package manager written in a scripting language. ↩︎

The death of Miitomo

Well, damn. Come May 9, Nintendo is shuttering Miitomo. I don’t know that it was ever terribly popular – it was Nintendo’s earliest venture onto mobile, but it wasn’t really a game. There were some game-like elements, primarily throwing your body into a pachinko machine to win clothes, but ultimately it was a dollhouse. A game of dress-up.

Entertainment, in all forms and across all media, is often a tool for escape. Some wish to lose themselves in a setting, others as a passive bystander in a plot, still others seeing pieces of themselves in fictional characters. A dollhouse experience is largely concentrated on this third aspect – expressing yourself, consequence-free, as this blank canvas of a person. While certainly a valid means of escape for anyone, this seems especially valuable to trans folks and people questioning their gender identity. The answers and comments on in-game questions revealed a staggering number of trans Miitomo users. I don’t really know of another game of dress-up that will serve as a viable replacement to Miitomo, and this is heartbreaking.

The May 9 date will put Miitomo’s lifespan at just over two years. Unfortunately, the app is entirely dependent upon the service, and assets users have acquired will not be retained locally, etc. While it seems plausible that local copies could be downloaded so that users could still fire up the app and change into any number of outfits they had previously purchased1, this will not be the case2. This is not a matter of ‘no more updates’, this is ‘no more app’. And that’s… a fairly short lifespan, even for a niche non-game. This absolute dependence on hosted assets makes me wonder about some of Nintendo’s other mobile forays. When Super Mario Run stops being worth the upkeep, will there be no more updates, or will the game cease to function altogether? Nintendo is in a weird spot where a lot of their casual gaming market has been overtaken by mobile. Obviously they want to get in on that and reclaim some market, but they just haven’t proven that they quite ‘get it’ yet. Or perhaps rendering a game entirely ephemeral is meant to prove to us the value of a cartridge. I… doubt it.

On January 24, Nintendo stopped selling in-game coins and tickets3 for real-world money. Daily bonuses, which used to be a handful of coins or a single ticket, are now 2,000 coins and 5 tickets every day. That’s a lot of in-game purchasing power for the next few months, and I’m glad that Nintendo is saying ‘here, just go nuts and have fun while it lasts’. Better than making this announcement on May 1, and operating as usual (including in-app purchases) until then.

I am truly sad about this; Miitomo has been oddly important to me. There is a lot of sadness and anger in the answers to the public in-game question running until May 9, ‘What was your favorite outfit in Miitomo? Show it off when you answer!’ Users are elaborately staging Miifotos with dead-looking Miis stamped ‘DELETED’, Miis crying on their knees, demonic-looking Miis labeled ‘Nintendo’ standing over innocent-looking Miis labeled ‘Miitomo’ with table knives sticking out of them. Ouch. We have #savemiitomo, #longlivemiitomo, #justice4miitomo (bit extreme, that) hashtags popping up. Suffice it to say, there is a frustrated community. I’ll be the first to admit that it never would have had the prominence of a Super Mario Bros. or Animal Crossing game, but Miitomo has been very meaningful to a lot of people.


  1. Purchased, here, referring to in-game — not necessarily tied to real-world currency. ↩︎
  2. I guess this would defeat the ‘social’ aspect. But, assuming the technical hurdles were not extreme, it would still be a nice gesture. And Nintendo has yet to successfully pull off anything resembling ‘social’, so I imagine this would calm a lot of us for a while. ↩︎
  3. Coins are used to buy clothing. Tickets are used to play the aforementioned pachinko-style games for the sake of winning clothing and/or room decorations. ↩︎

Firefox mobile

Well, I finally downgraded upgraded to iOS 11, which means trying out the mobile version of Firefox1 and revisiting the Firefox experience as a whole. While Quantum on the desktop did show effort from the UI team to modernize, my biggest takeaway is that both the mobile and desktop UIs still have a lot of catching up to do. I mentioned previously how the inferiority of Firefox’s URL bar might keep me on Chrome, and the reality is that this is not an outlier. Both the desktop and mobile UI teams seem to be grasping desperately at some outdated user paradigms, and the result is software that simply feels clumsy. While I have always been a proponent of adhering to OS widgets and behaviors as much as possible, this is only strengthened on mobile where certain interaction models feel inextricable from the platform.

All of this to bring me to my first and most serious complaint about Firefox Mobile: no pull-to-refresh. I believe this was a UI mechanism introduced by Twitter, but it’s so ingrained into the mobile experience at this point that I get extremely frustrated when it doesn’t work. This may seem petty, but to me it feels as broken as the URL bar on desktop.

A UI decision that I thought I would hate, but am actually fairly ambivalent on, is the placement of navigation buttons. Mobile Chrome puts the back button with the URL bar, hiding it during text entry, and hides stop/refresh in a hamburger menu (also by the URL bar). Firefox Mobile has an additional bar at the bottom with navigation buttons and a menu (much like mobile Safari). I don’t like this UI, it feels antiquated and wasteful, but I don’t hate it as much as I expected to. One thing that I do find grating is the menu in this bar. I have a very difficult time remembering what is in this menu vs. the menu in the URL bar. The answer often feels counterintuitive.

In my previous post about desktop Firefox, I was ecstatic about the ability to push links across devices, something I’ve long desired from Chrome. It worked well from desktop to desktop, and it works just as well on mobile. This is absolutely a killer feature for folks who use multiple devices. Far superior to syncing all tabs, or searching another device’s history. On the subject of sync, mobile Firefox has a reader mode with a save-for-later feature, but this doesn’t seem to integrate with Pocket (desktop Firefox’s solution), which makes for a broken sync experience.

Both Chrome and Firefox have QR code detection on iOS, and both are quick and reliable (much quicker and more reliable than the detection built into the iOS 11 camera app). Chrome pastes the text from a read QR code into the URL bar; Firefox navigates to the text contained in the code immediately. That’s a terrifyingly bad idea.

A few additional little things:

Finally, a few additional thoughts on desktop Firefox (Quantum), now that I’ve gotten a bit of additional use in:


  1. I’m not going to go out of my way to test Firefox on Android. This post only refers to Firefox on iOS as far as the mobile version is concerned. ↩︎

Boing Boing is being sued over a hyperlink (external)

Well, this is bad. Playboy is suing Happy Mutants, LLC (parent company of Boing Boing) because Boing Boing linked to an article containing (Playboy’s unlicensed) copyrighted content. I know about this because I generally like the writing at Boing Boing, and I follow a handful of current and former staff. But this has nothing to do with liking Boing Boing or not – the linked article rightfully states that this ‘would end the web as we know it’. The web is built on guiding people from point A to point B, the hyperlink is a defining feature of the web. If content creators are afraid to use the power of the hyperlink to guide their viewers elsewhere… the web dies.

As a socialist content creator, my feelings on intellectual property are rather complex, but I know one thing to be true – if I violate intellectual property laws, that is my responsibility. Nobody who shows others my misdoings should be culpable. Happy Mutants, LLC has filed a motion to dismiss; lets hope the courts have some sense.