diff --git a/.zshrc b/.zshrc index e69de29..b189275 100644 --- a/.zshrc +++ b/.zshrc @@ -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/mysql@8.4/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/mysql@8.4/lib" + # export CPPFLAGS="-I/opt/homebrew/opt/mysql@8.4/include" + export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql@8.4/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/mysql-client@8.4/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) diff --git a/DOCKER_README.md b/DOCKER_README.md deleted file mode 100644 index c7c9f25..0000000 --- a/DOCKER_README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Neovim Docker Setup - -## Quick Start - -### Build and Run - -```bash -# Build the image -docker build -t nvim-dotfiles . - -# Run interactively -docker run -it --rm -v $(pwd):/workspace nvim-dotfiles - -# Or use docker-compose -docker-compose up -d -docker-compose exec nvim bash -``` - -### Usage Examples - -```bash -# Start Neovim -nvim - -# Check health -nvim --headless +checkhealth +qall - -# Use Ruby/Node with mise -eval "$(mise activate bash)" -ruby --version -node --version - -# Run project commands -bundle install # Ruby projects -npm install # Node projects -``` - -## Development Workflow - -1. **Start the container:** - ```bash - docker-compose up -d - docker-compose exec nvim bash - ``` - -2. **Your dotfiles are available** at `/home/developer/.dotfiles` - -3. **Work on projects** by mounting them: - ```bash - docker run -it --rm -v /path/to/project:/workspace nvim-dotfiles - ``` - -4. **Persistent data** is kept in Docker volumes for nvim and mise - -## Customization - -- Modify `Brewfile` to add/remove tools -- Update `.tool-versions` to change language versions -- Plugin configuration is automatically loaded from `.config/nvim/` - -## Troubleshooting - -- **Plugin issues**: Run `nvim --headless "+Lazy! sync" +qa` -- **Language issues**: Run `mise install` to reinstall languages -- **LSP issues**: Check `:LspInfo` and `:Mason` in neovim - -## Tools Available - -| Tool | Purpose | -|------|---------| -| `nvim` | Neovim editor | -| `rg`, `fd`, `fzf` | Fast searching and file finding | -| `bat`, `tree` | Enhanced file viewing | -| `lazygit` | Git TUI | -| `tmux`, `zellij` | Terminal multiplexing | -| `mise` | Runtime version management | -| `jq`, `yq` | JSON/YAML processing | diff --git a/Dockerfile b/Dockerfile index f9127b1..da48d9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 @@ -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 @@ -67,4 +89,4 @@ RUN nvim --headless "+Lazy! sync" +qa WORKDIR /home/developer/.dotfiles # Default command -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/usr/bin/zsh"] \ No newline at end of file diff --git a/README.md b/README.md index 223e153..4d2b100 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docker-compose.yml b/docker-compose.yml index 7bc0696..ae44758 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: