Adventures in the terminal

So I've been a bit obsessed with the terminal lately. I'm on the cusp of even moving away from VSCode!

It all started when I was watching a video on YouTube about alternate terminals to iTerm2 on macOS (also was using tmux), and I came across Wezterm. Suddenly, obsessed! The beauty is that it's multi-platform. I've just started at a new client running Windows machines (ugh). But a quick trip into WSL, and Wezterm, and it's almost like I'm home (except I keep hitting Alt-C - first key to the left of the space bar - rather than Ctrl-C to copy... damn that muscle memory).

Wezterm has some real niceties that I'm used to from tmux, so I'm able to drop that. The main thing is configuring a "Leader" key. So in my case it's Ctrl-B. So if I want to split my pane into two next to each other Ctrl-B ' or create a new tab Ctrl-B t. Jumping between tabs is just Cmd-<Number> on my Macbook. Or I can use the mouse if I like too.

But it's not just Wezterm that has me obsessed. I started playing with Chezmoi for managing my dotfiles (feel free to have a look at my configs). I saw this one quite a while ago, but I figured if I'm going to be using Wezterm everywhere, I may as well start scripting it all. And yes, I love it. I already had my dotfiles on GitHub previously, but Chezmoi lets me script different parts of the files depending on which computer I'm on (I'm often switching based on operating system - linux/darwin - or location - home/work/server).

One very cool thing about Chezmoi is that you can make it ask a few questions on first start, so mine does email address (depends on client/home), name (I should probably just hardcode this one), location (gives an option to select home, work or server - for any servers I'm running), and finally my 1Password Secret key (see below).

So then Chezmoi lead me to the 1Password CLI tool, so I'm scripting all my SSH keys from 1Password now, very convenient.

So now, when I set up a new machine (surprisingly often as a consultant), all I need to do is install Chezmoi, and then chezmoi init --apply JazzXP and it installs everything else I typically use along with all my configs and keys.

To top it all off, while reading about configuring Wezterm, I've come across NeoVim. I had heard of it before, but never tried it, typically I just ran with the default Vim install on a system (the trick with Vim is to hit Escape after editing any text to drop back to normal mode - and for the memes, to quit is :q!), or upgrading it regularly using homebrew.

But once you dive into NeoVim, you're sure to come across LazyVim. And what can I say, this is a game changer! It basically turns Vim - a basic text editor - into a full IDE through plugins and sane default settings. Now Vim is not easy to use, but once you learn the basics, you can do a lot very quickly - there's also a very nice LazyVim tutorial available. Want to delete 20 lines? just type d20d on your keyboard when in Normal mode (Vim has two main modes - plus a couple of other less used ones, Normal and Insert). Want to go to the end of a line and start editing, A. Add a line above and start editing O or below o. Delete a word dw. Delete 3 words d3w, etc.

So that's basic Vim, but LazyVim adds a full file explorer (much like the one in VSCode), an extra set of functions by starting with a space (eg. to bring up the file explorer <Space>e or format code <Space>cf) and it also brings up a list of what you can do after a short timeout (300ms or so) so that if you know the command and just type it, nothing shows up and distracts you.

I've been playing with Amazon Q for my AI autocomplete in VSCode, but unfortunately it's not available for Vim/NeoVim, but what I have come across is Fitten Code. Another fairly free option, and there is a plugin that's pretty easy to install. So far it works quite well. If a company ever pays for GitHub Copilot for me, there's plugins available for that too.

So all of this has made me feel extra nerdy, but not just that, I'm starting to feel like a "hacker" from a movie working in text based terminals!