change from zsh to bash
add alacritty
This commit is contained in:
parent
a63238beca
commit
36806ee77d
13 changed files with 206 additions and 67 deletions
9
Makefile
9
Makefile
|
@ -28,10 +28,13 @@ virtualbox:
|
|||
vscodium:
|
||||
ansible-playbook playbooks/vscodium.yml -i inventory/hosts.yml -K
|
||||
|
||||
zsh:
|
||||
ansible-playbook playbooks/zsh.yml -i inventory/hosts.yml -K
|
||||
|
||||
wireguard:
|
||||
ansible-playbook playbooks/wireguard.yml -i inventory/hosts.yml -K --ask-vault-pass
|
||||
|
||||
alacritty:
|
||||
ansible-playbook playbooks/alacritty.yml -i inventory/hosts.yml -K
|
||||
|
||||
bash:
|
||||
ansible-playbook playbooks/bash.yml -i inventory/hosts.yml -K
|
||||
|
||||
.PHONY: run
|
||||
|
|
4
playbooks/alacritty.yml
Normal file
4
playbooks/alacritty.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: Install alacritty
|
||||
hosts: self
|
||||
roles:
|
||||
- alacritty
|
|
@ -4,9 +4,10 @@
|
|||
- system
|
||||
vars:
|
||||
my_roles:
|
||||
- zsh
|
||||
- asdf
|
||||
- bash
|
||||
- alacritty
|
||||
- wireguard
|
||||
- asdf
|
||||
- neovim
|
||||
- signal
|
||||
- virtualbox
|
||||
|
|
4
playbooks/bash.yml
Normal file
4
playbooks/bash.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: Install bash
|
||||
hosts: self
|
||||
roles:
|
||||
- bash
|
|
@ -1,4 +0,0 @@
|
|||
- name: Install zsh
|
||||
hosts: self
|
||||
roles:
|
||||
- zsh
|
20
roles/alacritty/tasks/main.yml
Normal file
20
roles/alacritty/tasks/main.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
- name: Download PPA signing key
|
||||
become: true
|
||||
apt_key:
|
||||
keyserver: keyserver.ubuntu.com
|
||||
id: 3A160895CC2CE253085D08A552B24DF7D43B5377
|
||||
keyring: /etc/apt/keyrings/alacritty.gpg
|
||||
- name: Install PPA repository
|
||||
become: true
|
||||
apt_repository:
|
||||
repo: "deb [signed-by=/etc/apt/keyrings/alacritty.gpg] https://ppa.launchpadcontent.net/aslatter/ppa/ubuntu {{ ansible_distribution_release }} main"
|
||||
register: apt_repository
|
||||
- name: Update APT cache
|
||||
become: true
|
||||
apt:
|
||||
update_cache: true
|
||||
when: apt_repository.changed
|
||||
- name: Install Alacritty
|
||||
become: true
|
||||
apt:
|
||||
name: alacritty
|
|
@ -26,7 +26,6 @@
|
|||
shell:
|
||||
cmd: "~/.asdf/bin/asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git"
|
||||
creates: ~/.asdf/plugins/erlang
|
||||
executable: /usr/bin/zsh
|
||||
- name: Install Elixir prerequisite APT packages
|
||||
become: true
|
||||
apt:
|
||||
|
@ -35,4 +34,3 @@
|
|||
shell:
|
||||
cmd: "~/.asdf/bin/asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git"
|
||||
creates: ~/.asdf/plugins/elixir
|
||||
executable: /usr/bin/zsh
|
||||
|
|
102
roles/bash/files/bashrc
Normal file
102
roles/bash/files/bashrc
Normal file
|
@ -0,0 +1,102 @@
|
|||
#!/bin/bash
|
||||
iatest=$(expr index "$-" i)
|
||||
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
# Enable bash programmable completion features in interactive shells
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
|
||||
#######################################################
|
||||
# EXPORTS
|
||||
#######################################################
|
||||
|
||||
# Disable the bell
|
||||
if [[ $iatest > 0 ]]; then bind "set bell-style visible"; fi
|
||||
|
||||
# Expand the history size
|
||||
export HISTFILESIZE=10000
|
||||
export HISTSIZE=500
|
||||
|
||||
# Don't put duplicate lines in the history and do not add lines that start with a space
|
||||
export HISTCONTROL=erasedups:ignoredups:ignorespace
|
||||
|
||||
# Check the window size after each command and, if necessary, update the values of LINES and COLUMNS
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Causes bash to append to history instead of overwriting it so if you start a new terminal, you have old session history
|
||||
shopt -s histappend
|
||||
PROMPT_COMMAND='history -a'
|
||||
|
||||
# Allow ctrl-S for history navigation (with ctrl-R)
|
||||
stty -ixon
|
||||
|
||||
# Ignore case on auto-completion
|
||||
# Note: bind used instead of sticking these in .inputrc
|
||||
if [[ $iatest > 0 ]]; then bind "set completion-ignore-case on"; fi
|
||||
|
||||
# Show auto-completion list automatically, without double tab
|
||||
if [[ $iatest > 0 ]]; then bind "set show-all-if-ambiguous On"; fi
|
||||
|
||||
# Set the default editor
|
||||
export EDITOR=nano
|
||||
export VISUAL=nano
|
||||
alias pico='edit'
|
||||
alias spico='sedit'
|
||||
alias nano='edit'
|
||||
alias snano='sedit'
|
||||
|
||||
# To have colors for ls and all grep commands such as grep, egrep and zgrep
|
||||
export CLICOLOR=1
|
||||
export LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.xml=00;31:'
|
||||
#export GREP_OPTIONS='--color=auto' #deprecated
|
||||
alias grep="/usr/bin/grep $GREP_OPTIONS"
|
||||
unset GREP_OPTIONS
|
||||
|
||||
# Color for manpages in less makes manpages a little easier to read
|
||||
export LESS_TERMCAP_mb=$'\E[01;31m'
|
||||
export LESS_TERMCAP_md=$'\E[01;31m'
|
||||
export LESS_TERMCAP_me=$'\E[0m'
|
||||
export LESS_TERMCAP_se=$'\E[0m'
|
||||
export LESS_TERMCAP_so=$'\E[01;44;33m'
|
||||
export LESS_TERMCAP_ue=$'\E[0m'
|
||||
export LESS_TERMCAP_us=$'\E[01;32m'
|
||||
|
||||
#######################################################
|
||||
# GENERAL ALIASES
|
||||
#######################################################
|
||||
# To temporarily bypass an alias, we preceed the command with a \
|
||||
# EG: the ls command is aliased, but to use the normal ls command you would type \ls
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Enable git status in prompt
|
||||
source /etc/bash_completion.d/git-prompt
|
||||
export GIT_PS1_SHOWDIRTYSTATE=1
|
||||
export PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 "(%s)")\$ '
|
||||
|
||||
# Git aliases
|
||||
alias gp='git push'
|
||||
alias gco='git checkout'
|
||||
alias gd='git diff'
|
||||
alias gc='git commit'
|
||||
alias gpl='git pull'
|
||||
alias gs='git status'
|
||||
alias gb='git branch'
|
||||
alias ga='git add'
|
||||
alias gl='git log'
|
||||
|
||||
# For neovim
|
||||
PATH=$PATH:/usr/local
|
||||
alias vi='nvim'
|
||||
alias vim='nvim'
|
||||
|
||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
48
roles/bash/files/fzf.bash
Normal file
48
roles/bash/files/fzf.bash
Normal file
|
@ -0,0 +1,48 @@
|
|||
export FZF_DEFAULT_COMMAND=ag
|
||||
|
||||
export FZF_COMPLETION_TRIGGER='**'
|
||||
|
||||
# Options to fzf command
|
||||
export FZF_COMPLETION_OPTS='--border --info=inline'
|
||||
|
||||
# Use fd (https://github.com/sharkdp/fd) instead of the default find
|
||||
# command for listing path candidates.
|
||||
# - The first argument to the function ($1) is the base path to start traversal
|
||||
# - See the source code (completion.{bash,zsh}) for the details.
|
||||
_fzf_compgen_path() {
|
||||
fdfind --hidden --follow --exclude ".git" . "$1"
|
||||
}
|
||||
|
||||
# Use fd to generate the list for directory completion
|
||||
_fzf_compgen_dir() {
|
||||
fdfind --type d --hidden --follow --exclude ".git" . "$1"
|
||||
}
|
||||
|
||||
# Advanced customization of fzf options via _fzf_comprun function
|
||||
# - The first argument to the function is the name of the command.
|
||||
# - You should make sure to pass the rest of the arguments to fzf.
|
||||
_fzf_comprun() {
|
||||
local command=$1
|
||||
shift
|
||||
|
||||
case "$command" in
|
||||
cd) fzf --preview 'tree -C {} | head -200' "$@" ;;
|
||||
export|unset) fzf --preview "eval 'echo \$'{}" "$@" ;;
|
||||
ssh) fzf --preview 'dig {}' "$@" ;;
|
||||
*) fzf --preview 'batcat -n --color=always {}' "$@" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Setup fzf
|
||||
# ---------
|
||||
if [[ ! "$PATH" == */home/pim/repos/fzf/bin* ]]; then
|
||||
PATH="${PATH:+${PATH}:}/home/pim/repos/fzf/bin"
|
||||
fi
|
||||
|
||||
# Auto-completion
|
||||
# ---------------
|
||||
[[ $- == *i* ]] && source "/home/pim/repos/fzf/shell/completion.bash" 2> /dev/null
|
||||
|
||||
# Key bindings
|
||||
# ------------
|
||||
source "/home/pim/repos/fzf/shell/key-bindings.bash"
|
19
roles/bash/tasks/main.yml
Normal file
19
roles/bash/tasks/main.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
- name: Install packages
|
||||
become: true
|
||||
apt:
|
||||
pkg:
|
||||
- fd-find
|
||||
- bat
|
||||
- name: Set default shell to bash
|
||||
become: true
|
||||
user:
|
||||
name: "{{ ansible_user_id }}"
|
||||
shell: /usr/bin/bash
|
||||
- name: Install .bashrc
|
||||
copy:
|
||||
src: "{{ role_path }}/files/bashrc"
|
||||
dest: ~/.bashrc
|
||||
- name: Install .fzf.bash
|
||||
copy:
|
||||
src: "{{ role_path }}/files/fzf.bash"
|
||||
dest: ~/.fzf.bash
|
|
@ -1,30 +0,0 @@
|
|||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
plugins=(git asdf colored-man-pages colorize command-not-found copyfile copypath docker extract docker-compose fancy-ctrl-z fzf ripgrep catimg)
|
||||
|
||||
export ZSH_THEME="strug"
|
||||
export ZSH_COLORIZE_TOOL=pygmentize
|
||||
export ZSH_COLORIZE_STYLE=gruvbox-dark
|
||||
export FZF_BASE=~/repos/fzf
|
||||
export FZF_DEFAULT_COMMAND='ag'
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Git aliases
|
||||
alias gp='git push'
|
||||
alias gco='git checkout'
|
||||
alias gd='git diff'
|
||||
alias gc='git commit'
|
||||
alias gpl='git pull'
|
||||
alias gs='git status'
|
||||
alias gb='git branch'
|
||||
alias ga='git add'
|
||||
alias gl='git log'
|
||||
|
||||
# For neovim
|
||||
PATH=$PATH:/usr/local
|
||||
alias vi='nvim'
|
||||
alias vim='nvim'
|
||||
|
||||
zstyle ':completion:*:*:docker:*' option-stacking yes
|
||||
zstyle ':completion:*:*:docker-*:*' option-stacking yes
|
|
@ -1,26 +0,0 @@
|
|||
- name: Install apt packages
|
||||
become: true
|
||||
apt:
|
||||
pkg:
|
||||
- zsh
|
||||
- fzf
|
||||
- silversearcher-ag
|
||||
- xclip
|
||||
- name: Install pygments
|
||||
pip:
|
||||
name:
|
||||
- pygments
|
||||
- name: Clone oh-my-zsh
|
||||
git:
|
||||
repo: https://github.com/ohmyzsh/ohmyzsh.git
|
||||
depth: 1
|
||||
dest: ~/.oh-my-zsh
|
||||
- name: Set default shell to zsh
|
||||
become: true
|
||||
user:
|
||||
name: "{{ ansible_user_id }}"
|
||||
shell: /usr/bin/zsh
|
||||
- name: Install .zshrc
|
||||
copy:
|
||||
src: "{{ role_path }}/files/.zshrc"
|
||||
dest: ~/.zshrc
|
Reference in a new issue