Reducing the Cost of Context Switching
Context switching at work is often inefficient and mentally exhausting. Over time I've slowly built up a workflow that helps me deal with this, and might be of use to someone else.
Tmux & Neovim
Tmux's sessions are invaluable for organizing work. Whenever I get a new ticket (or a new personal project), I will spin up a new session, named after the ticket (or project). For work, I've created a script to automate parts of this. A common setup I use is Neovim in the first window, and just a plain terminal in the second window for commands. If I have to make changes to both the frontend and backend, I'll have the frontend code in the first window, backend in the second, then a split window in the third for both frontend and backend to run commands. If at any point I need to jump back to another ticket, I simply load that session which will be exactly how I left it.
Git Worktrees
Worktrees allow me to have folders for each ticket. I have my work repos set up to be bare repos, then add worktrees as needed. I use the script from here to handle cloning as a bare repo. Combining this with Tmux sessions means I have my work completely isolated per ticket. If I'm asked to demo a different ticket than the one I'm working on and this ticket involves a handful of package removals and additions, I don't have to worry about this, because they're isolated and loading that ticket's session will include all the appropriate packages.
Local Servers
As you may have realized, local servers can still be a bit of an issue with this setup. My current solution is to have a session dedicated to running servers, so that I have a central place for them and don't lose them in ticket sessions. To load a different ticket's servers, I'll switch to this session, shut down any running ones, then swap worktrees and boot them back up. It's not ideal, and I'm still looking into better solutions.
Notes
I've found a loose Bullet Journal type of setup to be ideal for this, but any type of notes system should work. I use it as somewhat of a brain/task dump. If I'm in a meeting and something comes up that I'll need to address at some point, I can quickly jot it down and not worry about remembering it.