More complete terminal/shell setup

This commit is contained in:
Julien Negrotto 2025-05-20 12:06:42 -05:00
parent 79b13c038f
commit 2212e548d2
10 changed files with 132 additions and 5 deletions

View File

@ -2,3 +2,10 @@
brew "ruby-lsp"
brew "lua-language-server"
brew "typescript-language-server"
brew "rbenv"
brew "ruby-build"
brew "pyenv"
brew "pyenv-virtualenv"
brew "neovim"
brew "zinit"
brew "fzf"

View File

@ -1,11 +1,17 @@
# My Dotfiles
# Dotfiles
## External Dependencies
- Neovim
- Kitty
- Homebrew
- ZSH (as the default shell for the user)
## Installation
Assuming external dependencies are installed, run `./install.sh`.
## Notes
Does not currently install Python, Ruby, Node, etc. Install whatever build
dependencies are needed, then use rbenv, pyenv, nvm, etc. to manage them.

View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Kitty
Exec="$HOME/.local/kitty.app/bin/kitty"
Icon="$XDG_DATA_HOME/icons/kitty-whiskers.svg"
Type=Application
Categories=Utility

6
icons/kitty-whiskers.svg Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" version="1.1" viewBox="-18.3 -18.3 292.6 292.6">
<rect x="4" y="4" width="248" height="248" ry="57.108" fill="#252525" stroke="#fff" stroke-width="8"/>
<path d="m42.918 164.35v-17.664l29.63-15.718q3.7575-1.9482 8.2649-2.9875-4.5075-0.90906-8.2649-2.857l-29.63-15.718v-17.804l49.381 27.02v18.572z" fill="#fff"/>
<path d="m213.07 164.35-49.381-27.02v-18.572l49.381-27.136v17.664l-29.63 15.718q-3.7575 1.9482-8.265 2.9875 4.5075 0.90906 8.265 2.857l29.63 15.718z" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 592 B

View File

@ -1,15 +1,36 @@
#!/bin/bash
set -euo pipefail
set -euxo pipefail
export XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}"
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}"
echo "Installing fonts"
sudo cp -R fonts/* /usr/share/fonts
fonts_dir="$XDG_DATA_HOME/fonts"
cp -R fonts/* "$fonts_dir/"
fc-cache
echo "Installing homebrew dependencies"
brew bundle install
echo "Installing application icons and entries"
icons_dir="$XDG_DATA_HOME/icons/"
mkdir -p "$icons_dir"
cp -f icons/* "$icons_dir"
applications_dir="$XDG_DATA_HOME/applications/"
mkdir -p "$applications_dir"
envsubst > "$applications_dir/kitty.desktop" < applications/kitty.desktop
xdg-desktop-menu forceupdate
echo "Creating symlinks"
ln -sf "$PWD/nvim" "${XDG_CONFIG_HOME:-$HOME/.config}/nvim"
ln -sf "$PWD/kitty" "${XDG_CONFIG_HOME:-$HOME/.config}/kitty"
ln -sf "$PWD/nvim" "$XDG_CONFIG_HOME/nvim"
ln -sf "$PWD/kitty" "$XDG_CONFIG_HOME/kitty"
ln -sf "$PWD/zsh/zshrc" "$HOME/.zshrc"
ln -sf "$PWD/zsh/zsh_functions" "$HOME/.zsh_functions"
ln -sf "$PWD/zsh/zsh_aliases" "$HOME/.zsh_aliases"
ln -sf "$PWD/zsh/zsh_plugins" "$HOME/.zsh_plugins"
ln -sf "$PWD/zsh/zsh_prompt" "$HOME/.zsh_prompt"
echo "Installing NVM"
curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh" | bash
echo "Done"

10
zsh/zsh_aliases Normal file
View File

@ -0,0 +1,10 @@
# Clipboard aliases
# y - yank text to clipboard
# p - put text from clipboard
if q command -v wl-copy; then
alias y='wl-copy'
alias p='wl-paste'
elif q command -v xclip; then
alias y='xclip -selection -clipboard'
alias p='xclip -selection -clipboard -o'
fi

4
zsh/zsh_functions Normal file
View File

@ -0,0 +1,4 @@
# Silently run a command
function q {
"$@" > /dev/null 2>&1
}

8
zsh/zsh_plugins Normal file
View File

@ -0,0 +1,8 @@
zinit_path='/home/linuxbrew/.linuxbrew/opt/zinit/zinit.zsh'
if [[ -f "$zinit_path" ]]; then
. "$zinit_path"
# Use fzf for tab completion in zsh
zinit light 'Aloxaf/fzf-tab'
fi

30
zsh/zsh_prompt Normal file
View File

@ -0,0 +1,30 @@
autoload -Uz add-zsh-hook vcs_info compinit
compinit
setopt promptsubst
# Sets `prompt_workdir` to home-relative, abbreviated working directory
# example: `/home/julien/Code/foo/bar` > `~/C/f/bar`
set_prompt_workdir() {
local workdir="${PWD/#$HOME/~}"
local workdir_segments=( ${(s:/:)workdir} )
local short_workdir_segments=()
for (( i=1; i <= ${#workdir_segments}; i++ )) do
segment=${workdir_segments[i]}
if [[ $i < ${#workdir_segments} ]]; then
short_workdir_segments+=${segment[1]}
else
short_workdir_segments+="$segment"
fi
done
prompt_workdir="${(j./.)short_workdir_segments}"
if [[ "$PWD" != "$HOME"* ]]; then
prompt_workdir="/$prompt_workdir"
fi
}
add-zsh-hook precmd set_prompt_workdir
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:git:*' formats ' %F{red}%b%f%c%u'
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr '%F{green}+%f'
zstyle ':vcs_info:git:*' unstagedstr '%F{yellow}+%f'
export PROMPT='%B%F{cyan}%n%f%F{blue}@%f%F{cyan}%m%f%F{blue}:%f%F{green}${prompt_workdir}%f${vcs_info_msg_0_} %(!.#.>)%b '

29
zsh/zshrc Normal file
View File

@ -0,0 +1,29 @@
# add custom executable locations
export PATH="$HOME/.local/kitty.app/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
# linux brew
export LINUX_BREW_PATH="/home/linuxbrew/.linuxbrew/bin/brew"
[[ -x "$LINUX_BREW_PATH" ]] && \
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# rbenv
export RBENV_ROOT="$HOME/.rbenv"
eval "$(rbenv init - zsh)"
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - zsh)"
eval "$(pyenv virtualenv-init -)"
# nvm
export NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"
[[ -s "$NVM_DIR/zsh_completion" ]] && . "$NVM_DIR/zsh_completion"
# further customizations
[[ -f "$HOME/.zsh_functions" ]] && . "$HOME/.zsh_functions"
[[ -f "$HOME/.zsh_aliases" ]] && . "$HOME/.zsh_aliases"
[[ -f "$HOME/.zsh_plugins" ]] && . "$HOME/.zsh_plugins"
[[ -f "$HOME/.zsh_prompt" ]] && . "$HOME/.zsh_prompt"