Update .chezmoiexternal.toml

Update README.md
Update .bashrc
Update .zshrc
Add .config/atuin/config.toml
Update scripts/shells.sh
Update utils/helpers.sh
Update utils/packages
This commit is contained in:
Thomas Brasdefer 2024-12-21 00:33:52 +01:00
parent 8f1274b070
commit 67a479973b
Signed by: tombdf
GPG Key ID: A047E76CC4582988
8 changed files with 337 additions and 86 deletions

View File

@ -3,6 +3,11 @@
url = "https://raw.githubusercontent.com/dandavison/delta/main/themes.gitconfig"
refreshPeriod = "168h"
[".bash-preexec.sh"]
type = "file"
url = "https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh"
refreshPeriod = "168h"
[".vim/autoload/plug.vim"]
type = "file"
url = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"

View File

@ -134,4 +134,4 @@ eval "$(zoxide init --cmd cd bash)"
eval "$(oh-my-posh init bash)"
[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh
eval "$(atuin init bash)"
eval "$(atuin init bash --disable-up-arrow)"

166
dot_zshrc
View File

@ -9,64 +9,64 @@
#
##########################################################################
# zsh and zinit configuration ---------------------------------------------------------------- {{{
# Zsh and Zinit configuration ---------------------------------------------------------------- {{{
# if you come from bash you might have to change your $path.
export path=$home/bin:/usr/local/bin:$home/.local/bin/:$home/.cargo/bin/:$home/.atuin/bin/:$path
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin/:$HOME/.cargo/bin/:$HOME/.atuin/bin/:$PATH
# path to your zinit installation.
export zsh="${xdg_date_home:-${home}/.local/share}/zinit/zinit.git"
# Path to your Zinit installation.
export ZSH="${XDG_DATE_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# download and install zinit if it's not already installed
if [ ! -d $zsh ]; then
git clone https://github.com/zdharma-continuum/zinit.git $zsh
# Download and install Zinit if it's not already installed
if [ ! -d $ZSH ]; then
git clone https://github.com/zdharma-continuum/zinit.git $ZSH
fi
source $zsh/zinit.zsh
source $ZSH/zinit.zsh
# theme ---------------------------------------------------------------- {{{
# Theme ---------------------------------------------------------------- {{{
# set the theme to use with oh my posh
eval "$(oh-my-posh init zsh --config $home/.config/ohmyposh/prompt.json)"
# Set the theme to use with Oh My Posh
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/prompt.json)"
# }}}
# general options ---------------------------------------------------------------- {{{
# General options ---------------------------------------------------------------- {{{
# uncomment the following line to use case-sensitive completion.
# case_sensitive="true"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# uncomment the following line if pasting urls and other text is messed up.
# disable_magic_functions="true"
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# uncomment the following line to disable auto-setting terminal title.
# disable_auto_title="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# uncomment the following line to enable command auto-correction.
enable_correction="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# uncomment the following line to display red dots whilst waiting for completion.
# you can also set it to another string to have that shown instead of the default red dots.
# e.g. completion_waiting_dots="%f{yellow}waiting...%f"
# caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
completion_waiting_dots="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
COMPLETION_WAITING_DOTS="true"
# uncomment the following line if you want to disable marking untracked files
# under vcs as dirty. this makes repository status check for large repositories
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# disable_untracked_files_dirty="true"
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# uncomment the following line if you want to change the command execution time
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# you can set one of the optional three formats:
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
hist_stamps="dd.mm.yyyy"
HIST_STAMPS="dd.mm.yyyy"
# }}}
# plugins and snippets ---------------------------------------------------------------- {{{
# Plugins and snippets ---------------------------------------------------------------- {{{
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions
@ -75,49 +75,49 @@ zinit ice from'gh-r' as'program'
zinit light sei40kr/fast-alias-tips-bin
zinit light sei40kr/zsh-fast-alias-tips
zinit snippet omzp::git
zinit snippet omzp::zoxide
zinit snippet OMZP::git
zinit snippet OMZP::zoxide
# }}}
# history ---------------------------------------------------------------- {{{
# History ---------------------------------------------------------------- {{{
histsize=5000 # the number of commands to remember in the command history
histfile=~/.zsh_history # the file to save the command history to
savehist=$histsize # the number of commands to save in the history file
histdup=erase # erase duplicates in the history file
setopt appendhistory # append history to the history file
setopt sharehistory # share history between all sessions
setopt hist_ignore_space # ignore commands that start with a space
setopt hist_ignore_dups # ignore duplicate commands
setopt hist_ignore_all_dups # ignore all duplicate commands
setopt hist_save_no_dups # do not save duplicate commands
setopt hist_find_no_dups # do not display duplicate commands
HISTSIZE=5000 # The number of commands to remember in the command history
HISTFILE=~/.zsh_history # The file to save the command history to
SAVEHIST=$HISTSIZE # The number of commands to save in the history file
HISTDUP=erase # Erase duplicates in the history file
setopt appendhistory # Append history to the history file
setopt sharehistory # Share history between all sessions
setopt hist_ignore_space # Ignore commands that start with a space
setopt hist_ignore_dups # Ignore duplicate commands
setopt hist_ignore_all_dups # Ignore all duplicate commands
setopt hist_save_no_dups # Do not save duplicate commands
setopt hist_find_no_dups # Do not display duplicate commands
# key bindings
bindkey "^p" history-search-backward # search backward in history
bindkey "^n" history-search-forward # search forward in history
# Key bindings
bindkey "^p" history-search-backward # Search backward in history
bindkey "^n" history-search-forward # Search forward in history
# }}}
# completion ---------------------------------------------------------------- {{{
# Completion ---------------------------------------------------------------- {{{
# zsh allows command completion.
# the completion is very modifiable, here are some options
zstyle ':completion:*' matcher-list 'm:{a-z}={a-za-z}'
zstyle ':completion:*:descriptions' format '%u%b%d%b%u'
zstyle ':completion:*:warnings' format '%bsorry, no results'
# Zsh allows command completion.
# The completion is very modifiable, here are some options
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no results'
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt %sscrolling active: current selection at %p%s
zstyle ':completion:*' list-colors '${(s.:.)ls_colors}'
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' list-colors '${(s.:.)LS_COLORS}'
# load bash completion functions
autoload -uz +x compinit && compinit
autoload -uz +x bashcompinit && bashcompinit
# Load bash completion functions
autoload -Uz +X compinit && compinit
autoload -Uz +X bashcompinit && bashcompinit
# -q is for quiet; actually run all the `compdef's saved before `compinit` call
# (`compinit' declares the `compdef' function, so it cannot be used until
# `compinit' is ran; zinit solves this via intercepting the `compdef'-calls and
# `compinit' is ran; Zinit solves this via intercepting the `compdef'-calls and
# storing them for later use with `zinit cdreplay')
zinit cdreplay -q
@ -125,21 +125,21 @@ zinit cdreplay -q
# }}}
# user configuration ---------------------------------------------------------------- {{{
# User configuration ---------------------------------------------------------------- {{{
# preferred editor for local and remote sessions
if [[ -n $ssh_connection ]]; then
export editor='nvim'
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nvim'
else
export editor='vim'
export EDITOR='vim'
fi
# set the ssh-agent if it is not already running
if ! pgrep -u "$user" ssh-agent > /dev/null; then
# Set the ssh-agent if it is not already running
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
eval "$(ssh-agent -s)" > /dev/null
fi
export ssh_auth_sock=$(ssh-agent -s | grep -op '(?<=ssh_auth_sock=)[^;]+')
# add the keys to the agent
export SSH_AUTH_SOCK=$(ssh-agent -s | grep -oP '(?<=SSH_AUTH_SOCK=)[^;]+')
# Add the keys to the agent
if [ -f ~/.ssh/id_ed25519 ] && ! ssh-add -l | grep -q id_ed25519; then
ssh-add ~/.ssh/id_ed25519 > /dev/null 2>&1
fi
@ -147,35 +147,35 @@ if [ -f ~/.ssh/hexasec ] && ! ssh-add -l | grep -q hexasec; then
ssh-add ~/.ssh/hexasec > /dev/null 2>&1
fi
# compilation flags
# export archflags="-arch x86_64"
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# aliases ---------------------------------------------------------------- {{{
# Aliases ---------------------------------------------------------------- {{{
# set personal aliases
# for a full list of active aliases, run `alias`.
# Set personal aliases
# For a full list of active aliases, run `alias`.
alias ls='lsd'
alias ll='ls -alf'
alias ll='ls -alF'
alias rm='rip'
alias cat='bat'
alias grep='rg'
alias find='fd -h'
alias find='fd -H'
alias sed='sd'
alias c='clear'
alias prolog='~/.config/scryer-prolog/target/release/scryer-prolog' # à remplacer par prolog='scryer-prolog'
alias prolog='~/.config/scryer-prolog/target/release/scryer-prolog' # À remplacer par prolog='scryer-prolog'
alias csc='sudo cytech-site-change'
alias quit='exit'
alias compresse='echo "tar -cv [nomdufichieràcompresser] -f [nomarchive].tar"'
alias compresse='echo "tar -cv [nomDuFichieràCompresser] -f [nomArchive].tar"'
alias maj='~/./miseajour.sh'
alias vi=$(which vim)
alias vim='nvim'
# }}}
# allow zoxide to work and to replace cd
# Allow zoxide to work and to replace cd
eval "$(zoxide init --cmd cd zsh)"
# initialize atuin
eval "$(atuin init zsh)"
# Initialize atuin
eval "$(atuin init zsh --disable-up-arrow)"
# }}}

View File

@ -0,0 +1,234 @@
## where to store your database, default is your system data directory
## linux/mac: ~/.local/share/atuin/history.db
## windows: %USERPROFILE%/.local/share/atuin/history.db
db_path = "~/.local/share/atuin/history.db"
## where to store your encryption key, default is your system data directory
## linux/mac: ~/.local/share/atuin/key
## windows: %USERPROFILE%/.local/share/atuin/key
key_path = "~/.local/share/atuin/key"
## where to store your auth session token, default is your system data directory
## linux/mac: ~/.local/share/atuin/session
## windows: %USERPROFILE%/.local/share/atuin/session
session_path = "~/.local/share/atuin/session"
## date format used, either "us" or "uk"
dialect = "us"
## default timezone to use when displaying time
## either "l", "local" to use the system's current local timezone, or an offset
## from UTC in the format of "<+|->H[H][:M[M][:S[S]]]"
## for example: "+9", "-05", "+03:30", "-01:23:45", etc.
# timezone = "local"
## enable or disable automatic sync
auto_sync = true
## enable or disable automatic update checks
update_check = true
## address of the sync server
sync_address = "https://atuin.hexasec.io"
## how often to sync history. note that this is only triggered when a command
## is ran, so sync intervals may well be longer
## set it to 0 to sync after every command
sync_frequency = "1h"
## which search mode to use
## possible values: prefix, fulltext, fuzzy, skim
search_mode = "fuzzy"
## which filter mode to use
## possible values: global, host, session, directory
filter_mode = "global"
## With workspace filtering enabled, Atuin will filter for commands executed
## in any directory within a git repository tree (default: false)
workspaces = false
## which filter mode to use when atuin is invoked from a shell up-key binding
## the accepted values are identical to those of "filter_mode"
## leave unspecified to use same mode set in "filter_mode"
filter_mode_shell_up_key_binding = "global"
## which search mode to use when atuin is invoked from a shell up-key binding
## the accepted values are identical to those of "search_mode"
## leave unspecified to use same mode set in "search_mode"
search_mode_shell_up_key_binding = "fuzzy"
## which style to use
## possible values: auto, full, compact
style = "auto"
## the maximum number of lines the interface should take up
## set it to 0 to always go full screen
inline_height = 0
## Invert the UI - put the search bar at the top , Default to `false`
invert = false
## enable or disable showing a preview of the selected command
## useful when the command is longer than the terminal width and is cut off
show_preview = true
## what to do when the escape key is pressed when searching
## possible values: return-original, return-query
exit_mode = "return-original"
## possible values: emacs, subl
# word_jump_mode = "emacs"
## characters that count as a part of a word
# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
## number of context lines to show when scrolling by pages
# scroll_context_lines = 1
## default history list format - can also be specified with the --format arg
history_format = "{time}\t{command}\t{duration}"
## prevent commands matching any of these regexes from being written to history.
## Note that these regular expressions are unanchored, i.e. if they don't start
## with ^ or end with $, they'll match anywhere in the command.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
history_filter = [
"^secret-cmd",
"^innocuous-cmd .*--secret=.+",
]
## prevent commands run with cwd matching any of these regexes from being written
## to history. Note that these regular expressions are unanchored, i.e. if they don't
## start with ^ or end with $, they'll match anywhere in CWD.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
# cwd_filter = [
# "^/very/secret/area",
# ]
## Configure the maximum height of the preview to show.
## Useful when you have long scripts in your history that you want to distinguish
## by more than the first few lines.
max_preview_height = 4
# Configures whether to store commands that failed (those with non-zero exit status) or not.
store_failed = true
## Configure whether or not to show the help row, which includes the current Atuin
## version (and whether an update is available), a keymap hint, and the total
## amount of commands in your history.
# show_help = true
## Configure whether or not to show tabs for search and inspect
# show_tabs = true
## Defaults to true. This matches history against a set of default regex, and will not save it if we get a match. Defaults include
## 1. AWS key id
## 2. Github pat (old and new)
## 3. Slack oauth tokens (bot, user)
## 4. Slack webhooks
## 5. Stripe live/test keys
secrets_filter = true
## Defaults to true. If enabled, upon hitting enter Atuin will immediately execute the command. Press tab to return to the shell and edit.
# This applies for new installs. Old installs will keep the old behaviour unless configured otherwise.
enter_accept = true
## Defaults to "emacs". This specifies the keymap on the startup of `atuin
## search`. If this is set to "auto", the startup keymap mode in the Atuin
## search is automatically selected based on the shell's keymap where the
## keybinding is defined. If this is set to "emacs", "vim-insert", or
## "vim-normal", the startup keymap mode in the Atuin search is forced to be
## the specified one.
keymap_mode = "emacs"
## Cursor style in each keymap mode. If specified, the cursor style is changed
## in entering the cursor shape. Available values are "default" and
## "{blink,steady}-{block,underline,bar}".
keymap_cursor = { emacs = "blink-block", vim_insert = "blink-block", vim_normal = "steady-block" }
network_connect_timeout = 5
network_timeout = 5
## Timeout (in seconds) for acquiring a local database connection (sqlite)
local_timeout = 5
## Set this to true and Atuin will minimize motion in the UI - timers will not update live, etc.
## Alternatively, set env NO_MOTION=true
prefers_reduced_motion = false
[stats]
## Set commands where we should consider the subcommand for statistics. Eg, kubectl get vs just kubectl
common_subcommands = [
"apt",
"cargo",
"composer",
"dnf",
"docker",
"git",
"go",
"ip",
"kubectl",
"nix",
"nmcli",
"npm",
"pecl",
"pnpm",
"podman",
"port",
"systemctl",
"tmux",
"yarn",
]
## Set commands that should be totally stripped and ignored from stats
common_prefix = ["sudo"]
## Set commands that will be completely ignored from stats
# ignored_commands = [
# "cd",
# "ls",
# "vi"
# ]
[keys]
# Defaults to true. If disabled, using the up/down key won't exit the TUI when scrolled past the first/last entry.
scroll_exits = true
[sync]
# Enable sync v2 by default
# This ensures that sync v2 is enabled for new installs only
# In a later release it will become the default across the board
records = true
[preview]
## which preview strategy to use to calculate the preview height (respects max_preview_height).
## possible values: auto, static
## auto: length of the selected command.
## static: length of the longest command stored in the history.
strategy = "auto"
[dotfiles]
enabled = false
[daemon]
## Enables using the daemon to sync. Requires the daemon to be running in the background. Start it with `atuin daemon`
enabled = false
## How often the daemon should sync in seconds
# sync_frequency = 300
## The path to the unix socket used by the daemon (on unix systems)
## linux/mac: ~/.local/share/atuin/atuin.sock
## windows: Not Supported
# socket_path = "~/.local/share/atuin/atuin.sock"
## Use systemd socket activation rather than opening the given path (the path must still be correct for the client)
## linux: false
## mac/windows: Not Supported
# systemd_socket = false
## The port that should be used for TCP on non unix systems
# tcp_port = 8889

View File

@ -69,6 +69,10 @@ check_installation "yay -S --noconfirm --needed" "git-delta"
echo -e "${BLUE}Installing SSHS...${DEFAULT}"
check_installation "yay -S --noconfirm --needed" "sshs"
# Atuin - Shell history synchronization
echo -e "${BLUE}Installing Atuin...${DEFAULT}"
check_installation "pacman -S --noconfirm --needed" "atuin"
# Changing the default shell to Fish
echo -e "${GREEN}Setting Fish as default shell...${DEFAULT}"
chsh -s $(which fish)

View File

@ -58,6 +58,13 @@ function setup_final() {
systemctl --user enable --now pipewire.service
systemctl --user enable --now pipewire-pulse.service
# Enable Atuin
echo -e "${GREEN}Setting up Atuin...${DEFAULT}"
echo -e "${BLUE}Please enter your Atuin login${DEFAULT}"
read -p "Username: " atuin_user
atuin login -u $atuin_user
atuin sync
# Import GPG keys
gpg --import $HOME/.gpg/public-keys.asc
gpg --import $HOME/.gpg/private-keys.asc

View File

@ -65,3 +65,4 @@ topgrade
tealdeer
git-delta
sshs
atuin