How To Set Vim To Your (remote) Login Shell

Recently at my job, one of the other software developers was talking about how they had a trick where you’d land in a vim session on every login.

This got me thinking - could you live with vim as your login shell?

I quickly discovered that vim couldn’t be set as a proper login shell, because it doesn’t know about path or anything. So I left bash as the login shell on my linux server, and set about making vim launch every time I access it.

It’s simple! Add the following snippet to your ~/.ssh/authorized_keys file, and you’re good to go.

command="/usr/bin/vim",no-port-forwarding,no-X11-forwarding, < YOUR SSH KEY HERE>

Every time you log in, you will land in a vim session. If you ! <command> your way out of that vim session, you have the full path of bash, so you can tmux, emacs (?!) and apt-get to your hearts content.

Or, I suppose, launch a bash shell. Like a normal person.