diff --git a/README.md b/README.md index f26e8da..49dd17d 100644 --- a/README.md +++ b/README.md @@ -94,12 +94,17 @@ practice not to run random commands you find. - [onedark](https://github.com/joshdick/onedark.vim) - **vscode** - [Atom One Dark Theme](https://github.com/akamud/vscode-theme-onedark) +- **zsh** + - [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) [ [arch package](https://www.archlinux.org/packages/zsh-autosuggestions) ] + - [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) [ [arch package](https://www.archlinux.org/packages/?q=zsh-syntax-highlighting) ] + - [starship](https://starship.rs/) +- **python** + - [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) **Shell & Term** - [kitty](https://sw.kovidgoyal.net/kitty/) - [zsh](https://wiki.archlinux.org/index.php/zsh) -- [prezto](https://github.com/sorin-ionescu/prezto) - [tmux](https://github.com/tmux/tmux/wiki) [ [arch wiki](https://wiki.archlinux.org/index.php/Tmux) ] **Social** diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh new file mode 100644 index 0000000..66155ce --- /dev/null +++ b/config/zsh/aliases.zsh @@ -0,0 +1,2 @@ +alias ll="ls -l --color" +alias la="ls -la --color" \ No newline at end of file diff --git a/config/zsh/ssh-agent.zsh b/config/zsh/ssh-agent.zsh new file mode 100644 index 0000000..eeb480e --- /dev/null +++ b/config/zsh/ssh-agent.zsh @@ -0,0 +1,45 @@ +# +# Provides for an easier use of SSH by setting up ssh-agent. +# +# Authors: +# Sorin Ionescu +# +# Source (adapted from): +# https://github.com/sorin-ionescu/prezto/tree/master/modules/ssh +# + +# Return if requirements are not found. +if (( ! $+commands[ssh-agent] )); then + return 1 +fi + +# Set the path to the SSH directory. +_ssh_dir="$HOME/.ssh" + +# Set the path to the environment file if not set by another module. +_ssh_agent_env="${_ssh_agent_env:-${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.env}" + +# Set the path to the persistent authentication socket. +_ssh_agent_sock="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.sock" + +# Start ssh-agent if not started. +if [[ ! -S "$SSH_AUTH_SOCK" ]]; then + # Export environment variables. + source "$_ssh_agent_env" 2> /dev/null + + # Start ssh-agent if not started. + if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then + mkdir -p "$_ssh_agent_env:h" + eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")" + fi +fi + +# Create a persistent SSH authentication socket. +if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then + mkdir -p "$_ssh_agent_sock:h" + ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock" + export SSH_AUTH_SOCK="$_ssh_agent_sock" +fi + +# Clean up. +unset _ssh_{dir,identities} _ssh_agent_{env,sock} diff --git a/config/zsh/starship.toml b/config/zsh/starship.toml new file mode 100644 index 0000000..99f8505 --- /dev/null +++ b/config/zsh/starship.toml @@ -0,0 +1,129 @@ +[aws] +disabled = true + +[battery] +disabled = true + +[character] +success_symbol = "[⤚](bold green)" +error_symbol = "[⤚](bold red)" +vicmd_symbol = "[⤙](bold green)" + +[cmake] +disabled = true + +[conda] +disabled = true + +[crystal] +disabled = true + +[dart] +disabled = true + +# [directory] + +# [docker_context] + +[dotnet] +disabled = true + +[elixir] +disabled = true + +[elm] +disabled = true + +[env_var] +disabled = true + +[erland] +disabled = true + +[gcloud] +disabled = true + +# [git_branch] + +# [git_commit] + +# [git_state] + +# [git_status] + +[golang] +disabled = true + +# [hostname] + +# [java] + +# [jobs] + +[julia] +disabled = true + +# [kubernetes] + +# [line_break] + +[lua] +disabled = true + +# [memory_usage] + +# [hg_branch] + +[nim] +disabled = true + +[nix_shell] +disabled = true + +# [nodejs] + +# [package] + +[ocaml] +disabled = true + +[openstack] +disabled = true + +[perl] +disabled = true + +[php] +disabled = true + +# [python] + +[ruby] +disabled = true + +# [rust] + +# [shlvl] + +[singularity] +disabled = true + +[swift] +disabled = true + +# [status] + +# [terraform] + +# [time] + +# [username] + +[zig] +disabled = true + +[custom] +disabled = true + +[purescript] +disabled = true diff --git a/config/zsh/zprofile b/config/zsh/zprofile new file mode 100644 index 0000000..611f9f3 --- /dev/null +++ b/config/zsh/zprofile @@ -0,0 +1,66 @@ +# +# Executes commands at login pre-zshrc. +# +# Authors: +# Sorin Ionescu +# +# Source (adapted from): +# https://github.com/sorin-ionescu/prezto/tree/master/runcoms +# + +# +# Browser +# + +if [[ "$OSTYPE" == darwin* ]]; then + export BROWSER='open' +fi + +# +# Editors +# + +export EDITOR='nvim' +export VISUAL='nvim' +export PAGER='less' + +# +# Language +# + +if [[ -z "$LANG" ]]; then + export LANG='en_US.UTF-8' +fi + +# +# Paths +# + +# Ensure path arrays do not contain duplicates. +typeset -gU cdpath fpath mailpath path + +# Set the list of directories that cd searches. +# cdpath=( +# $cdpath +# ) + +# Set the list of directories that Zsh searches for programs. +path=( + /usr/local/{bin,sbin} + $path +) + +# +# Less +# + +# Set the default Less options. +# Mouse-wheel scrolling has been disabled by -X (disable screen clearing). +# Remove -X and -F (exit if the content fits on one screen) to enable it. +export LESS='-F -g -i -M -R -S -w -X -z-4' + +# Set the Less input preprocessor. +# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system. +if (( $#commands[(i)lesspipe(|.sh)] )); then + export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-" +fi diff --git a/config/zsh/zshrc b/config/zsh/zshrc new file mode 100644 index 0000000..5009a14 --- /dev/null +++ b/config/zsh/zshrc @@ -0,0 +1,19 @@ +# Source zsh-autosuggestions +ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20 +ZSH_AUTOSUGGEST_USE_ASYNC=yes +source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh + +# Source zsh-syntax-highlighting +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + +# Source aliases +source ~/.dots/config/zsh/aliases.zsh + +# Source ssh-agent +source ~/.dots/config/zsh/ssh-agent.zsh + +# Load virtualenvwrapper +source ~/.local/bin/virtualenvwrapper.sh + +# Load starship (prompt) +eval "$(starship init zsh)" diff --git a/install.conf.yaml b/install.conf.yaml index 81f76eb..e6bcbb2 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -20,6 +20,7 @@ ~/.config/ranger/rifle.conf: config/ranger/rifle.conf ~/.config/rofi/config.rasi: config/rofi/config.rasi ~/.config/rofi/themes/slate.rasi: config/rofi/themes/slate.rasi + ~/.config/starship.toml: config/zsh/starship.toml ~/.config/spicetify/Themes: config/spicetify/Themes ~/.config/sxhkd/sxhkdrc: config/sxhkd/sxhkdrc ~/.local/bin/autorandr: bin/autorandr.sh/autorandr.sh @@ -31,12 +32,8 @@ ~/.gitmessage: gitmessage ~/.gnupg/gpg.conf: gpg.conf ~/.Xresources: Xresources - ~/.zlogin: prezto/runcoms/zlogin - ~/.zlogout: prezto/runcoms/zlogout - ~/.zpreztorc: prezto/runcoms/zpreztorc - ~/.zprofile: prezto/runcoms/zprofile - ~/.zshenv: prezto/runcoms/zshenv - ~/.zshrc: prezto/runcoms/zshrc + ~/.zprofile: config/zsh/zprofile + ~/.zshrc: config/zsh/zshrc - shell: - ["git submodule update --init --recursive", Installing submodules]