Skip to content

Commit

Permalink
Improve setup script
Browse files Browse the repository at this point in the history
It now works better with an existing installation of fish with default
options. Various other fixes were applied as well.
  • Loading branch information
mbd-s committed May 16, 2024
1 parent 347ba15 commit fde9065
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 43 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SYMLINK_DIRS := \
tmux \
vim

export __fish_config_dir := $(shell fish -c 'echo $$__fish_config_dir')
export __fish_config_dir := ${HOME}/.config/fish

asdf: ## Installs asdf plugins. Usage: `make asdf`.
$(info Installing asdf plugins)
Expand Down Expand Up @@ -89,16 +89,16 @@ link: ## Symlinks config files. Usage: `make link`.
$(info Linking config files)
@brew list stow > /dev/null 2>&1 || brew install stow
@for dir in $(SYMLINK_DIRS); do \
stow --verbose $$dir; \
stow --verbose --no-folding $$dir; \
done

mac: ## Applies new macOS settings. Usage: `make mac`.
$(info Setting new macOS defaults)
@./scripts/set-macos-defaults.fish
@./scripts/set-macos-defaults.sh

mac-reset: ## Resets macOS defaults. Usage: `make mac-reset`.
$(info Resetting macOS defaults)
@./scripts/reset-macos-defaults.fish
@./scripts/reset-macos-defaults.sh

omz: ## Installs Oh My Zsh. Usage: `make omz`.
$(info Installing Oh My Zsh)
Expand All @@ -108,6 +108,6 @@ omz: ## Installs Oh My Zsh. Usage: `make omz`.
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"; \
fi

setup: chip mac brew asdf omz dracula fonts link ## Symlinks config files and installs tools. Usage: `make setup`.
setup: chip mac link brew asdf omz dracula fonts ## Symlinks config files and installs tools. Usage: `make setup`.

.DEFAULT_GOAL := help
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

![Screenshot of my shell prompt](https://user-images.githubusercontent.com/13588399/248551301-5a08c7ba-de5c-4e3b-aafb-4dfaa27fcccd.png)

My personal dotfiles for a `fish` shell on an ARM-based Mac, including essential tools and opinionated settings. You
probably don't want to adopt these wholesale, but feel free to take what you like.
These are my personal dotfiles for a `fish` shell on an ARM-based Mac, including essential tools and opinionated
settings.

## 🧭 Prerequisites

Expand Down Expand Up @@ -31,8 +31,9 @@ git clone https://github.com/mbd-s/dotfiles.git ~/dotfiles
cd ~/dotfiles
```

The setup script bootstraps a new Mac. It will symlink the config files and install a bunch of tools (iTerm2, Visual
Studio Code, Go, Terraform, Starship, etc.) via Homebrew and [asdf](https://github.com/asdf-vm/asdf):
The setup script bootstraps a fresh installation of macOS. It will set sane defaults, symlink config files, and install
a bunch of tools (iTerm2, Visual Studio Code, Go, Terraform, Starship, etc.) via Homebrew and
[asdf](https://github.com/asdf-vm/asdf):

```shell
make setup
Expand Down Expand Up @@ -83,22 +84,12 @@ files are ignored by `git`.) The common packages are installed in any case.

### iTerm2

#### Profile

1. Open iTerm2
2. Select `iTerm2 > Preferences`
3. Select `Profiles`
4. Select the `Other Actions...` dropdown menu and click `Import JSON profiles...`
5. Choose the profile you want to use from the ones in `$DOTFILES/iterm/`

#### Key mappings

1. Open iTerm2
2. Select `iTerm2 > Preferences`
3. Select `Profiles`, then `Keys`
4. Select the `Presets...` dropdown menu and click `Import...`
5. Choose `$DOTFILES/iterm/custom.itermkeymap`

### Visual Studio Code

I find it's best to manage your VS Code settings with profiles and settings sync. The config here is just for reference.
Expand Down
5 changes: 0 additions & 5 deletions fish/.config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ if command -v starship >/dev/null
starship init fish | source
end

# Configure 1password-cli
if command -v op >/dev/null
source ~/.config/op/plugins.sh
end

# Configure fzf
if command -v fzf >/dev/null
fzf --fish | source
Expand Down
1 change: 0 additions & 1 deletion iterm2/custom.itermkeymap

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env fish
#!/bin/bash

sudo -v

Echo $GREEN"• Don't show hidden files in the Finder"
echo "• Don't show hidden files in the Finder"
defaults write com.apple.finder AppleShowAllFiles false

echo "• Hide all filename extensions"
Expand All @@ -18,7 +18,7 @@ echo "• Enable warning before emptying the Trash"
defaults write com.apple.finder WarnOnEmptyTrash -bool true

echo "• Always show scroll bars"
defaults write -g AppleShowScrollBars -string Always
defaults write -globalDomain AppleShowScrollBars -string Always

echo "• Click in the scroll bar to jump to the next page"
defaults write -globalDomain AppleScrollerPagingBehavior -bool false
Expand All @@ -29,25 +29,26 @@ defaults write com.apple.dock autohide -bool false
echo "• Display recent applications in the Dock"
defaults write com.apple.dock show-recents -bool true

echo $YELLOW"• Resetting the default Finder location to the virtual Recents folder has to be done manually. Open Finder settings, select \"Sidebar\", and check \"Recents.\""$NORMAL
echo "• Resetting the default Finder location to the virtual Recents folder has to be done manually. Open Finder settings, select \"Sidebar,\" and check \"Recents.\""

echo $GREEN"• Don't change the Appearance automatically (takes effect after the next restart)"
defaults write -g AppleInterfaceStyleSwitchesAutomatically -bool false
echo "• Don't change the Appearance automatically (takes effect after the next restart)"
defaults write -globalDomain AppleInterfaceStyleSwitchesAutomatically -bool false

echo "• Reset the screenshot location to ~/Desktop"
defaults delete com.apple.screencapture location

echo "• Hide full URLs in Safari"
defaults write com.apple.safari ShowFullURLInSmartSearchField -bool false
sudo defaults write com.apple.safari ShowFullURLInSmartSearchField -bool false

echo "• Don't ask websites not to track"
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool false
sudo defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool false

echo "• Show a warning when changing the file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool true

echo "• Enable auto-correct"$NORMAL
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool true
echo "• Enable auto-correct"
defaults write -globalDomain NSAutomaticSpellingCorrectionEnabled -bool true

# Restart Finder and Dock to apply changes
killall Finder
killall Dock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env fish
#!/bin/bash

sudo -v

echo $GREEN"• Show hidden files in the Finder"
echo "• Show hidden files in the Finder"
defaults write com.apple.finder AppleShowAllFiles true

echo "• Show all filename extensions"
Expand All @@ -18,7 +18,7 @@ echo "• Disable warning before emptying the Trash"
defaults write com.apple.finder WarnOnEmptyTrash -bool false

echo "• Show scroll bars only when scrolling"
defaults write -g AppleShowScrollBars -string WhenScrolling
defaults write -globalDomain AppleShowScrollBars -string WhenScrolling

echo "• Click in the scroll bar to jump to the spot that's clicked"
defaults write -globalDomain AppleScrollerPagingBehavior -bool true
Expand All @@ -33,23 +33,24 @@ echo "• Set the default Finder location to the Home folder"
defaults write com.apple.finder NewWindowTarget -string PfLo && defaults write com.apple.finder NewWindowTargetPath -string "file://$HOME"

echo "• Set the Appearance to Auto (takes effect after the next restart)"
defaults write -g AppleInterfaceStyleSwitchesAutomatically -bool true
defaults write -globalDomain AppleInterfaceStyleSwitchesAutomatically -bool true

echo "• Set the screenshot location to ~/Documents/Screenshots"
mkdir -p ~/Documents/Screenshots
defaults write com.apple.screencapture location -string "~/Documents/Screenshots"

echo "• Show full URLs (apart from the scheme) in Safari"
defaults write com.apple.safari ShowFullURLInSmartSearchField -bool true
sudo defaults write com.apple.safari ShowFullURLInSmartSearchField -bool true

echo "• Ask websites not to track"
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
sudo defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true

echo "• Don't show a warning when changing the file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

echo "• Disable auto-correct"$NORMAL
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
echo "• Disable auto-correct"
defaults write -globalDomain NSAutomaticSpellingCorrectionEnabled -bool false

# Restart Finder and Dock to apply changes
killall Finder
killall Dock

0 comments on commit fde9065

Please sign in to comment.