Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 184 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
export ZSH="$HOME/.oh-my-zsh"

set -o vi

# https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"

plugins=(
bundler
fzf
git
brew
bun
you-should-use
zsh-vi-mode
fast-syntax-highlighting
rust
zsh-autocomplete
)

source $HOME/.import-secrets.sh
source $ZSH/oh-my-zsh.sh
source $HOME/.cargo/env
source "$HOME/.cargo/env"

[[ -f local_zsh ]] && source local_zsh

# unalias sd

DISABLE_AUTO_TITLE="true"

export LANG=en_US.UTF-8
export EDITOR=nvim
export THOR_MERGE="nvim -d $2 $1"
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

[ -f /opt/homebrew/etc/profile.d/autojump.sh ] && . /opt/homebrew/etc/profile.d/autojump.sh

export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
export PATH="$HOME/bin:$PATH"
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"
export PATH=$HOME/development/flutter/bin:$PATH
export PATH=$HOME/cmdline-tools/bin:$PATH
# export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
# export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"

# mysql stuff
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/

alias l='ls -1A'
alias v="nvim"
alias go='~/scripts/open-repo-in-browser.ts'

alias myip="ipconfig getifaddr en0"
alias pubip="curl ifconfig.me"
alias gg="lazygit"
alias bra="bundle exec rubocop -A"
alias bsf="bundle exec standardrb --fix"
alias ctags="`brew --prefix`/bin/ctags"
alias o="open"
# alias c="cursor"
alias c="code"
alias grr='gradle run'

# config
alias cnvim="cd ~/.config/nvim && $EDITOR init.lua"
alias vimrc="$EDITOR ~/.vimrc"
alias zshrc="$EDITOR ~/.zshrc"
alias bashrc="$EDITOR ~/.bashrc"
alias ohmyzsh="$EDITOR ~/.oh-my-zsh"
alias clg="$EDITOR ~/Library/Application\ Support/lazygit/config.yml"
alias cgit="$EDITOR ~/.gitconfig"
alias zj="zellij"
alias zjc="v ~/.config/zellij/config.kdl"
alias zjlc="v ~/.config/zellij/layouts/my_layout.kdl"
alias gac="git add . && git commit --verbose"
alias prc="v /Users/dani/prompts/README.md"
alias fr='find . | rg '
alias ff='hyfetch'
alias cvu='~/scripts/simplecov_parser.rb -u'
alias vo='v $(fzf)'

# Created by `pipx` on 2024-12-12 09:25:29
export PATH="$PATH:/Users/dani/.local/bin"

set_terminal_title() {
git_branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
repo_name=$(basename "$(git rev-parse --show-toplevel 2> /dev/null)")
echo -ne "\e]1;${repo_name} - ${git_branch}\a"
}
export PROMPT_COMMAND="$PROMPT_COMMAND; set_terminal_title"
precmd() { set_terminal_title }


alias y='yazi'

alias jr='javac -d bin src/**/*.java; java -cp bin ch.zhaw.prog1.farm.Farm'
alias gs='git status --porcelain=v1'
alias gsm='git status --porcelain | awk '\''{ print $2 }'\'''
jsf() {
find . -name "*.java" | fzf --preview 'echo {}' | xargs java
}

alias fg='ls -1 | rg'
alias bc='bin/check'
alias br='bin/run'
alias bcu='bin/check_unit_tests'
alias bd='bin/dev'
alias rails_tree="tree -I 'storage|log|tmp|node_modules|.git|public/system|public/uploads' -L 5 | bat"
alias rails_tree_minimal=" tree -I 'db|bin|assets|config|views|storage|log|tmp|node_modules|public|.git|public/system|public/uploads' -L 5 | bat"

export SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/dani/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/dani/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/dani/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/dani/google-cloud-sdk/completion.zsh.inc'; fi

# Zellij

zellij_tab_name_update() {
if [[ -n $ZELLIJ ]]; then
local current_dir=$PWD
if [[ $current_dir == $HOME ]]; then
current_dir="~"
else
current_dir=${current_dir##*/}
fi
command nohup zellij action rename-tab $current_dir >/dev/null 2>&1
fi
}

zellij_tab_name_update
chpwd_functions+=(zellij_tab_name_update)

eval "$(~/.local/bin/mise activate zsh)"

## [Completion]
## Completion scripts setup. Remove the following line to uninstall
[[ -f /Users/dani/.dart-cli-completion/zsh-config.zsh ]] && . /Users/dani/.dart-cli-completion/zsh-config.zsh || true
## [/Completion]

export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"

alias parallel='/opt/homebrew/Cellar/parallel/20250722/bin/parallel'

# deploio completion
fpath=(~/.local/share/zsh/site-functions $fpath)
autoload -Uz compinit && compinit
autoload -U _deploio 2>/dev/null
compdef _deploio deploio depl 2>/dev/null

fpath=(~/.config/zsh/completions $fpath)
autoload -U compinit && compinit

alias bat='bat --theme="gruvbox-dark"'
nvimfuzzysearch() {
local sel
sel=$(
fzf --ansi --disabled \
--prompt='rg> ' \
--header='Type to search. Enter opens in nvim' \
--bind "change:reload:rg --line-number --no-heading --color=always --smart-case --hidden -g '!.git' {q} || true" \
--delimiter=':' \
--preview 'bat --style=plain --color=always {1} --highlight-line {2}' \
--preview-window='up:60%'
) || return

[ -n "$sel" ] || return
nvim "+$(cut -d: -f2 <<<"$sel")" "$(cut -d: -f1 <<<"$sel")"
}
alias vf='nvimfuzzysearch'
alias docker-compose='docker compose'
fpath+=/Users/dani/.zfunc

# Load Angular CLI autocompletion.
source <(ng completion script)
77 changes: 0 additions & 77 deletions DOCKER_README.md

This file was deleted.

30 changes: 26 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apt-get update && apt-get install -y \
wget \
ca-certificates \
locales \
zsh \
&& rm -rf /var/lib/apt/lists/*

# Generate locale
Expand All @@ -26,8 +27,8 @@ ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

# Create a non-root user
RUN useradd -m -s /bin/bash developer && \
# Create a non-root user with zsh as default shell
RUN useradd -m -s /usr/bin/zsh developer && \
echo 'developer ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# Switch to the developer user
Expand All @@ -54,8 +55,29 @@ RUN mkdir -p /home/developer/.config && \
# Copy tool-versions for mise
RUN ln -sf /home/developer/.dotfiles/.tool-versions /home/developer/.tool-versions

# Install oh-my-zsh
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

# Install zsh plugins
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/you-should-use && \
git clone https://github.com/jeffreytse/zsh-vi-mode ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-vi-mode && \
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting && \
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete

# Set up zsh configuration
RUN ln -sf /home/developer/.dotfiles/.zshrc /home/developer/.zshrc

# Create dummy files/directories for macOS-specific paths to avoid errors
RUN sudo mkdir -p /opt/homebrew/etc/profile.d && \
sudo touch /opt/homebrew/etc/profile.d/autojump.sh && \
sudo mkdir -p /Users/dani/.dart-cli-completion && \
sudo touch /Users/dani/.dart-cli-completion/zsh-config.zsh && \
touch /home/developer/.import-secrets.sh && \
echo "# Docker placeholder" > /home/developer/.import-secrets.sh

# Install languages using mise
RUN /bin/bash -c "eval \"\$(mise activate bash)\" && mise install"
RUN /bin/zsh -c "eval \"\$(mise activate zsh)\" && mise install"

# Initialize neovim and install plugins
RUN nvim --headless "+Lazy! sync" +qa
Expand All @@ -67,4 +89,4 @@ RUN nvim --headless "+Lazy! sync" +qa
WORKDIR /home/developer/.dotfiles

# Default command
CMD ["/bin/bash"]
CMD ["/usr/bin/zsh"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
This is a collection of my dotfiles for my personal development setup.
Other than the dotfiles, I also have a few scripts that I use to automate some tasks.

## Docker Setup

Run the complete development environment in a container:

```bash
docker compose up -d
docker compose exec dotfiles zsh
```

## Configuration

* [Alacritty](./.config/alacritty/alacritty.toml)
Expand Down
10 changes: 6 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
version: '3.8'
services:
nvim:
dotfiles:
build: .
image: nvim-dotfiles
container_name: neovim-dev
image: dotfiles-zsh
container_name: dotfiles-dev
volumes:
- .:/workspace
- nvim_data:/home/developer/.local/share/nvim
- mise_data:/home/developer/.local/share/mise
- zsh_data:/home/developer/.oh-my-zsh
working_dir: /workspace
stdin_open: true
tty: true
command: /bin/bash
command: /usr/bin/zsh

volumes:
nvim_data:
mise_data:
zsh_data:
Loading