Editors and Tools

Editor

My editing workflow starts with sshing into a box and reattaching to a tmux session:

ssh myhost
tmux attach

I have an ssh alias set up to forward certain ports as well:

$ cat ~/.ssh/config
Host myhost
  User ashermancinelli
  HostName myhost.domain.com
  LocalForward 6666 localhost:6666
  LocalForward 6667 localhost:6667
  LocalForward 6668 localhost:6668
  LocalForward 6669 localhost:6669

From inside the tmux session, I usually have several sessions each with a few shell windows and a neovim server running:

nvim --headless --listen localhost:6666

Then I can attach my editor1 to the remote editing session from my local terminal:

neovide --no-multigrid --fork --server localhost:6666

Tools

I use Spack2 for nearly everything.

I have a set of tools I need on every machine, which I install with Spack. At the time of writing, this is the list:

  • ripgrep
  • the-silver-searcher
  • bat
  • fzf
  • fd
  • rlwrap
  • neovim@master
  • lua
  • vim
  • perl
  • python
  • py-pip

I install all of these like so:

spack \
  --config concretizer:targets:granularity:generic \
  install -j `nproc` \
  ripgrep the-silver-searcher bat fzf fd rlwrap neovim@master lua vim perl python py-pip \
  --fresh

Setting the target granularity to generic means I can usually install once for each architecture in the cluster I’m working on, however sometimes OS incompatibilities mean I need to reinstall a few times.

From a script, I load all the default packages I need by just choosing the first one that matches my current generic architecture.

garch=`spack arch --platform`-`spack arch --operating-system`-`spack arch --generic-target`
for pkg in ${packages[@]}; do eval `spack load --sh --first $pkg arch=$garch`; done

The better way to do this would be to use environments3, but installing them as individual packages makes it easier to reuse all my scripts for different architectures and operating systems rather than creating environments for each. I can just update my list of default packages and reinstall as-needed without activating an environment, reconcretizing and reinstalling every time.