Skip to content

julian7/dotfiles

Repository files navigation

Julian7's dotfiles

This is my more or less educated guess on how to use a unix system. I use ZSH and FISH, therefore you won't find any other configurations (maybe bash later, as a fallback).

ZSH config

Most parts of the config is separated into various .zsh files in ~/.zsh.d. Notable settings:

  • editor: finds proper EDITOR var, creates some convenience aliases
  • osx-proxy-icons: adds proxy icon support to OSX Terminal
  • paths: extra path settings for rust, rbenv, Rancher Desktop
  • ruby: some ruby and ruby on rails aliases, sets up chruby / rbenv
  • settings: ZSH settings
  • ssh: GnuPG / Secretive agent support, Updates terminal titles on SSH
  • tmux: aliases and ssh title replacer function

FISH config

Fish settings are in ~/.config/fish/conf.d directory, which is 100% controlled by this repository. Notable settings:

  • paths: it adds a lot of convenience paths such as $HOME/bin and $HOME/.bin, keybase, homebrew, etc.
  • chefdk: aliases
  • direnv: loads fish hooks for direnv
  • docker: convenience aliases
  • editor: selects best editor, sets EDITOR environment variable, convenience aliases
  • fisher-bootstrap: downloads and runs fisher package manager
  • go: best practice variables
  • k8s: convenience aliases
  • node: yarn settings
  • python: python settings, pyenv (if installed).
  • ruby: convenience aliases, chruby-fish (if installed).
  • ssh: yubikey's OpenPGP ssh agent handling
  • tmux: aliases
  • tools: modern unix tool alternatives
  • vault: auth alias
  • wsl2: Yubikey support on Windows WSL2 environment: connects gpg-agent and ssh-agent with gpg4win, if wsl2-ssh-pageant.exe is available

Fish plugins are managed by fisher, and installed fisher plugins are controlled by this repository.

Plugins

  • fisher: package manager for fish

Other dotfiles

  • ack
  • git: global gitconfig and gitignore
  • terraform/tofu: to have a central plugin cache. Set TF_CLI_CONFIG_FILE variable to a different file if you want to modify it.
  • tmux

aliases and functions

  • ack: ack-grep (if ack-grep is installed)
  • b: bundle (ruby)
  • be: bundle exec (ruby)
  • ce: chef exec (chefdk)
  • cbe: chef exec bundle exec (chefdk)
  • dex: docker exec -ti, running sh by default
  • dstat (dip) shows docker images' IP addresses and memory consumption
  • dps: nicer docker ps
  • grep: grep -a --color=always (general)
  • gvim: set to mvim (if installed)
  • joe: set to 'vim' on systems where joe is not installed
  • k: kubectl
  • killagent: more drastic gpg-agent restarter, when reagent is not enough
  • kubesh: runs a docker image on kubernetes interactively
  • ls: uses exa if available
  • mate_wait: non-forking textmate
  • r: script/rails (ruby)
  • reagent: re-runs gpg-agent in case it becomes unavailable
  • serve: simple ruby-based static webserver
  • t: tmux -u (tmux)
  • tax: tofu apply x
  • tf: tofu
  • tpx: tofu plan -out x
  • vaultauth: runs userpass authentication to vault
  • vi: set to nvim, vim or mvim (if installed)
  • vim: set to nvim (if installed)

GIT aliases

  • aa: add --all
  • br: branch
  • ci: commit
  • co: checkout
  • cp: cherry-pick
  • dc: diff --cached
  • di: diff
  • fm: full merge (merge --no-ff)
  • h: pretty oneline history
  • largest: shows largest n (default: 10) files in git repository
  • man: help
  • s: switch (replacing checkout)
  • st: status -sb (shorter status)
  • unadd: reset HEAD
  • upstream: shows current branch's default remote

scripts

  • colorcolumn: just like 'column', but ANSI-colors-aware
  • kcx: kubernetes context switcher
  • kns: kubernetes namespace switcher
  • repostat: finds git repos in your path, and shows repo cleanliness
  • set-ssh-auth-sock: changing current SSH_AUTH_SOCK value. Currently 1pw (1Password), gpg and secretive are supported.

Installation

  • Clone repo: git clone https://github.com/julian7/dotfiles.git
  • Change to dotfiles dir
  • Run ./INSTALL.sh
  • Modify your ~/.config/git/config file to reflect your personal setup (like user.name and user.email settings), as ~/.gitconfig is managed by dotfiles.

Example ~/.config/git/config file:

[user]
  name = Random J. Hacker
  email = [email protected]
[includeIf "gitdir:/Volumes/Work/**"]
  path = /Volumes/Work/.gitconfig
  • Set default SSH_AUTH_SOCK setter: if the system-provided SSH_AUTH_SOCK is not enough, you can choose from extra sockets (see ~/.ssh/sockets.conf). The file format is <NAME> <Path to socket>. No comments allowed.

    Create the file ~/.ssh/defaultsocket.conf with a single line containing the name of your chosen socket provider, like 1pw, gpg or secretive.

  • Install vim-plug for vim plugins. Neovim config uses git to install lazy.nvim on first run.

Making changes

These changes are good for me, but you might want to have other settings (you don't want to publish your changes into git using my email address, do you?). This is where git comes handy.

  • Clone the repo and install (see above)
  • Make your changes
  • Commit changes (creating a local branch is a bonus)

Local changes can go to

  • ~/.zshrc.local
  • ~/.zshenv.local
  • ~/.zlogin.local
  • ~/.config/fish/config.fish (in case of using fish shell)
  • ~/.gitconfig.local (local git config)
  • ~/.config/nvim/lua/local/init.lua (local neovim config)
  • ~/.config/wezterm/local.lua (local wezterm config)

which are loaded at the end of the respective original scripts.

Upgrading

  • Fetch changes from GitHub
  • Merge changes with your changes (rebase works pretty well if you don't want to publish your repo anywhere)
  • Enjoy

Requirements

  • zsh / fish
  • git

MacOS-specific

An independent script, MAC.sh is provided to do the first steps for installing basic applications. It

  • Installs Homebrew. This is the easiest way of managing packages.
  • Runs brew bundle install to install all taps, brews, and casks, defined in Brewfile.
  • Installs Mac AppStore apps with mas CLI.
  • Sets sensible defaults to the Dock, and restarts it.

Extensions in mind

  • chruby: ruby selector environment: install with brew install chruby.
  • chruby-fish: wrapper around chruby for fish shell. Install with brew install chruby-fish.
  • direnv: Environment switcher for shell (included).
  • dust: a more intuitive du, written in rust (included).
  • eza: Modern ls replacement, written in rust (included).
  • fzf: command line fuzzy finder in shell history (included).
  • GNU Privacy Guard: OpenPGP implementation. Currently requires a MacOS-only pinentry program (included)
  • lazygit: CLI UI for git. Its neovim plugin allows lazygit integration, which makes fugitive basically obsolete (included).
  • Neovim: Vim-based text editor, successor of Vim (included).
  • Neovide: Simple cross-platform GUI for Neovim (included).
  • lazy.nvim: Neovim plugin manager. Installs automatically using git.
  • pinentry-mac: GUI-based pinentry app for MacOS. Currently this is the pinentry application for GnuPG (included).
  • rbenv: ruby selector environment: brew install rbenv / see README
  • ripgrep: blazing fast grep -r replacement (included).
  • ruby-install: ruby builder for chruby: see README
  • ruby-build: ruby builder for rbenv: see README
  • rust: Environment setup for the Rust programming language. Run rustup-init to install rust packages. Subsequent updates can be done running rustup update (included).
  • Secretive: stores SSH keys in Secure Enclave (mac only; included).
  • starship: blazing-fast multi-shell command prompt (included).
  • tmux: terminal multiplexer. You will love it, especially if you use PuTTY or any non-tabbed terminal clients (included).
  • vim-plug: Minimalist Vim Plugin Manager, used for vim installations (not for Neovim!). Run curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim to install, and then run vim -c PlugInstall -c exit -c exit to configure.
  • wezterm: cross-platform terminal emulator and multiplexer written in rust (included).
  • wsl2-ssh-pageant: tunnels gpg4win's gpg agent into wsl2. To install, put the windows executable into your $HOME/.ssh in your wsl2 environment.

Text font recommendations

The following fonts are all available in homebrew/cask (default) cask. Install individual fonts with brew install --cask font-XXX (where font-XXX is the font name).

Shell Prompt generators, Vim statuslines require extra characters, Nerdfonts are recommended.

  • Comic Mono: only for the lulz. Cask font name: font-comic-mono (included). Unfortunately, its Nerdfont version doesn't have a convenient install, it has to be installed manually from xtevenx/ComicMonoNF repo.
  • FiraCode: the first code font with ligatures (included). Font names: font-fira-code, font-fira-code-nerd-font.
  • Iosevka font. Narrow, but well-readable. It has ligatures and powerline support. Font names: font-iosevka, font-iosevka-nerd-font (included).
  • JetBrains Mono: monospace font from JetBrains. Font names: font-jetbrains-mono, font-jetbrains-mono-nerd-font. Note: this is the default font in all GUI settings (included).
  • Source Code Pro / Sauce Code Pro Nerd font: Font names: font-source-code-pro, font-sauce-code-pro-nerd-font.

Copyright

Creative Commons Licence This work is licensed under a Creative Commons Attribution 3.0 Unported License.