Fish shell is my shell of choice and having it setup
as default on the Mac requires some extra steps.
When homebrew is installed, run brew install fish
.
After that, edit /etc/shells
and add fish to it:
# sudo edit /etc/shells
Add the bottom of the file add:
/opt/homebrew/bin/fish
Then set the shell as default with:
chsh -s /opt/homebrew/bin/fish
It does require logging again to be activated.
Permalink
I’m using Alacritty on the Mac and I noticed how the
font rendering is much thicker than I’m used to on iTerm. On iTerm I use the
“thin strokes” setting, which is not available in Alacritty.
Turns out, you can set it with:
defaults write org.alacritty AppleFontSmoothing -int 0
If you then log in and logout again, your Alacritty will be similar to the
crispness you find in iTerm.
If you want to restore it back to the default, do:
defaults delete org.alacritty AppleFontSmoothing
And if you like to have this kind of crispness across the entire OS. Do:
defaults write -g AppleFontSmoothing -int 0
Permalink
I like to have my key repeat set high, because I still browse my code line,
by line; yes, I know there are better ways to browse.
On the Mac, if you go through the “System Preferences”, there is only so much
you can do. Luckily, you can get the right settings if you use the terminal.
First, make sure that you have disabled “Slow keys” in “System Preferences > Accessibility > Keyboard > Slow keys”.
Then go into your Terminal of choice and type:
defaults write -g KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 12
The normal minimum of KeyRepeat
is 2. Setting it to 1 will have a key repeat
delay of 15ms.
For the InitialKeyRepeat
, the minimum is 10; 15 if you use system settings. I
prefer to set it to 12.
If you want to restore the defaults, just go through the system settings and set
it to a value you prefer.
Permalink
Recently I wrote down how to get Java installed on MacOS with the help of Adoptium. Well, it turns out, I also use Linux (Pop!_OS if you were wondering).
To install Java on Linux, go to the Adoptium page and download the tarball according to the version and your architecture. I downloaded the LTS 19 for x64:
tar xfz OpenJDK19U-jdk_x64_linux_hotspot_19.0.2_7.tar.gz
sudo mv jdk-19.0.2+7 /opt/
And now make sure that your shell can find it, my shell is Fish, so I added this snippet:
# Java installation through Adoptium
set -l java_version "19.0.2+7"
if test -d "/opt/jdk-$java_version"
set -x JAVA_HOME "/opt/jdk-$java_version"
fish_add_path -aP "$JAVA_HOME/bin"
end
Now you have Java, quickly go install Clojure :)
Permalink
I love the smart dashes – and I use them heavily – on the Mac and it’s something I missed on PopOS!.
Luck be it, Espanso comes along. Installation on a Debian system is easy.
Configuration of Espanso is done by editing configuration files located in ~/.config/espanso
directory. You can also find it by tying espanso path
. The files contained in the match
directory define what Espanso should do. The files contained in the config
directory define how Espanso should perform its expansions.
To replace our double dashes with a long dash we are going to edit $CONFIG/match/base.yml
add change it to:
matches:
- trigger: "--"
replace: "—"
However, now this also happens in our terminal, which is annoying, so we are going to disable Espanso completely in the terminal with an app specific configuration.
We’ll disable it in Alacritty, my terminal of choice by creating a config/alacritty.yml
and match on the class name:
filter_class: Alacritty
enable: false
That’s it, Espanso is super powerful and I can recommend reading the docs on what else it can do. Oh, and it also works on MacOS or Windows.
Permalink
Often when I start a new project, I also need to have a .gitignore
for the specific language that I’m working in.
To easily do this, I added the following alias to my git, which pulls a template from gitignore.io:
git config --global alias.ignore \
'!gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}; gi'
Now you can do git ignore zig
and it will show you the default ignore file for a Zig project.
To automatically put it in your gitignore, just redirect the output:
git ignore zig >> .gitignore
Permalink
I used to manage my Zig installation by installing the binary and copying to my path. Not too hard, but now there is even an easier way by using zigup
.
To install zig, it enables you to simply type zigup master
I would recommend to get the latest binary from the Github releases page. Or if
you already have Zig, install it from source:
# Install the binary
git clone [email protected]:marler8997/zigup.git
cd zigup
zig build -Dfetch
cp zig-out/bin/zigup ~/.local/bin/
Permalink
I have been trying out Helix as my daily editor and the editor has built in support for LSP. However, it does not install the Language Servers, so you have to do that yourself.
Below are the language servers I installed for writing my code in HTML, CSS and Markdown.
You can always check if a language is setup by doing:
hx --health <lang>
So for example this will tell you if your HTML is supported:
hx --health html
HTML, CSS and SCSS
Both HTML, CSS and SCSS use the language server from Visual Studio Code:
npm i -g vscode-langservers-extracted
Markdown
For Markdown it uses marksman and to install it you can download the latest version from their releases page
wget <link from releases page>
# Make it executable
chmod +x marksman-<dist>
# Move it to a directory in your path, in my case `~/.local/bin`
mv marksman-<dist> ~/.local/bin/marksman
Move it to somewhere in your $PATH
and you should be good to go.
Permalink
I have been tinkering with Zig lately and to get a grasp on the language
I have been using the excellent Ziglings quizes.
In Quiz #58 there is a great comment which lists the different types for Zig:
//
// We've absorbed a lot of information about the variations of types
// we can use in Zig. Roughly, in order we have:
//
// u8 single item
// *u8 single-item pointer
// []u8 slice (size known at runtime)
// [5]u8 array of 5 u8s
// [*]u8 many-item pointer (zero or more)
// enum {a, b} set of unique values a and b
// error {e, f} set of unique error values e and f
// struct {y: u8, z: i32} group of values y and z
// union(enum) {a: u8, b: i32} single value either u8 or i32
//
// Values of any of the above types can be assigned as "var" or "const"
// to allow or disallow changes (mutability) via the assigned name:
//
// const a: u8 = 5; // immutable
// var b: u8 = 5; // mutable
//
// We can also make error unions or optional types from any of
// the above:
//
// var a: E!u8 = 5; // can be u8 or error from set E
// var b: ?u8 = 5; // can be u8 or null
Permalink
Github has their own CLI tool which enables you
to interact with Github through the command line.
I often start new repositories and started using the following command to
quickly create a accompanying, private repo on Github:
gh repo create <name> --private --source=. --remote=origin
Permalink