When I first discovered Vim I wasted a lot of time trying to bend it backwards into a traditional editor. The below quote sums it up perfectly:
Vim is not TextMate or whatever other editor you have used before. There is no way to transfer all your old habits seamlessly, point blank.
Instead of wasting your time trying to make Vim and your terminal into something that it’s not and can’t be you should learn how to use and customize Vim wisely. All your
Alt combos won’t lead you anywhere. Especially in a terminal where
Alt is often problematic and
Consider using leader
- it’s portable on every platform
- it’s less prone to conflicts with your OS or terminal emulator
- it opens a lot of easy to remember possibilities
Adding gobs of plugins instead of learning Vim’s native functionality is another common trap, so I maintain a secondary lightweight Vim config called Ninjarc with minimal plugins to keep me sharp.
Finally, Tim Pope’s philosophy of favouring commands over leader key combos yields a more cohesive configuration. I’m experimenting with Spacemacs-style command mnemonics in my Aetherwolf Vim config. For example, instead of binding
T to open NerdTree,
:tn is used (Toggle NerdTree). This allows
:tt for Toggle Tagbar and so on – a nice memorable taxonomy rather than a flat multitude of somewhat arbitrary leader combos.
I might eventually move this into Denite menus à la SpaceVim, but for now I’m digging the simplicity of using
Fold current function:
- mb – mark b
- % – jump to end of block
- zf’b – fold back to marker b
The three Ds of software Project Management:
(this list may or may not be tongue-in-cheek)
Regex snippet to extract the cn value from a dn string for LDAP:
match = /^cn=([^,]+)/.match(cname)
return match if match.is_a?(MatchData) && match.length > 0
Snippet to convert a list of attributes to a Ruby hash.
"cn" => "ID",
"sn" => "Surname",
"fn" => "FirstName",
/(.+?)(?=\:):(.*$)/"$1" => "$2",/
As is often the case, the nix defaults for ls are spartan. I finally got around to wrestling my ls color settings into submission. On macos/zsh, gdircolors gave inconsistent results, so I set the LS_COLORS environment var directly.
brew install coreutils
if [[ "$(uname)" = "Darwin" ]]; then # macos uses a different 'ls'
alias l="gls -ahF --group-directories-first --color=always"
alias l="ls -ah --color --group-directories-first"
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
The full goodies:
Just switched from rbenv to chruby using this guide, and my zsh startup time improved by about 10 seconds. I’d been meaning to debug why it was taking so long — bonus!
Here’s the offending lines that were removed from ~/.zlogin:
eval "$(rbenv init -)"
Internet-connected devices are increasingly supplied without a USB tethering option. While I presume this cuts down on manufacturing complexity and improves form factor, the wifi setup user experience is often terrible.
I recently acquired a FitBit Aria scale which has the completely undocumented quirk of only being able to connect to 802.11b wifi. My router defaults to n. I had to dig through the router settings and enable dual-band. There is absolutely no way a muggle would ever figure this out.
To compound the issue, their activation API was suffering a bug that returned a cryptic JSON error when using a Mac or iOS Safari to register the scales. I have no Wintel, so I finally got it working using iOS Chrome.
Googling revealed loads of posts by angry consumers who had returned the product as defective. I wonder how much this poor design choice cost FitBit’s bottom line? Omitting a USB setup option might have seemed clever but it backfired badly – perhaps it would have been fine if their wifi onboarding experience wasn’t so flawed.
And after enabling dual-band support on my router my Kindle Paperwhite would no longer connect to the wifi network. I had to manually enable WPS discovery mode on the router to pair it again. Oy!
It seems that byobu triggers a known bug with tpm which then fails to load any plugins. Fortunately there is a simple fix, in byobu’s .tmux.conf change your plugin formatting like so:
set -g @tpm_plugins ' \
If using the XDG directory convention, this line is also needed in .tmux.conf:
set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.config/byobu/plugins/"
So it looks like MacOS Sierra broke pbcopy/pbpaste for tmux. This manifests as clipboard errors when using netrw/vinegar in neovim under tmux. (Dunno why netrw is writing to the clipboard but anyways).
The solution is to use Homebrew to reinstall a patched version of reattach-to-user-namespace:
brew uninstall reattach-to-user-namespace
brew install reattach-to-user-namespace --with-wrap-pbcopy-and-pbpaste
Although this was annoying, it did lead to running brew cleanup which reclaimed 3.8GB of disk space. Jinkies!