• Show channels: sudo nix-channel --list
  • add unstable channel: sudo nix-channel --add unstable
  • update repos: sudo nix-channel --update; sudo nix search -u


  • Sort selected lines: :sort
  • Open man page: :man [command] or \K
  • Open URL: gx
  • Move between splits: ctrl+w [direction]
  • vim-commentary: gc [motion] to comment out
  • Case switching:
    • gU to uppercase
    • gu to lowercase -g~ to toggle
  • Substitute:
    • /g global - sub all in line
    • :%s/ - substitute in all lines
    • :5,12s/ substitute from lines 5 to 12
    • :.,+2s/ substitute this line (.) and the next 2
    • :g/^foo/s/bar/baz/g substitute all instances of bar with baz on lines beginning with foo
    • /c - ask for confirmation
  • Windows
    • :sp [filename] horizontal split, optionally open file
    • vsp vertical split
    • ctrl+w w move between windows
    • ctrl+w = resize windows to be equal
    • ctrl+w q close window
    • ctrl+w <direction> move window



  • Set up port forwarding in existing connection:
$ ~C
ssh> -D [port number]


  • !!:s/foo/bar/, replace first instance of foo with bar in the previous command
  • ^foo^bar same thing but shorter and less flexible
  • !foo rerun last command containing foo