fix: zsh role add fzf support and p10k settings tweaks

This commit is contained in:
Clément Désiles
2026-04-11 22:41:10 +02:00
parent 61c88045f7
commit ae33184aa0
6 changed files with 2935 additions and 369 deletions
+13 -1
View File
@@ -22,7 +22,7 @@
repo: "{{ item.repo }}"
dest: "{{ item.dest }}"
update: true
version: master
version: "{{ item.version | default('master') }}"
loop:
- repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: "{{ zsh_plugins_path }}/zsh-syntax-highlighting"
@@ -30,6 +30,16 @@
dest: "{{ zsh_plugins_path }}/zsh-autosuggestions"
- repo: https://github.com/romkatv/powerlevel10k.git
dest: "{{ zsh_plugins_path }}/powerlevel10k"
- repo: https://github.com/zsh-users/zsh-history-substring-search.git
dest: "{{ zsh_plugins_path }}/zsh-history-substring-search"
- repo: https://github.com/Aloxaf/fzf-tab.git
dest: "{{ zsh_plugins_path }}/fzf-tab"
version: master
- name: Install fzf package
ansible.builtin.package:
name: fzf
state: present
- name: Assert plugins are available for any user
ansible.builtin.file:
@@ -42,3 +52,5 @@
- "{{ zsh_plugins_path }}/zsh-syntax-highlighting"
- "{{ zsh_plugins_path }}/zsh-autosuggestions"
- "{{ zsh_plugins_path }}/powerlevel10k"
- "{{ zsh_plugins_path }}/zsh-history-substring-search"
- "{{ zsh_plugins_path }}/fzf-tab"
+20
View File
@@ -1,4 +1,12 @@
---
- name: Setup .zshenv (environment variables)
ansible.builtin.template:
src: zshenv.j2
dest: "{{ zsh_home }}/.zshenv"
owner: "{{ zsh_user }}"
group: "{{ zsh_user }}"
mode: "0600"
- name: Setup zsh base config
ansible.builtin.template:
src: main.zshrc.j2
@@ -31,6 +39,18 @@
group: "{{ zsh_user }}"
mode: "0600"
- name: Configure fzf-tab plugin
ansible.builtin.copy:
dest: "{{ zsh_config_path }}/fzf-tab.zsh"
content: |
# Enable fzf-tab
zstyle ':fzf-tab:*' continuous-trigger 'right'
zstyle ':fzf-tab:*' group-colors ''
zstyle ':fzf-tab:*' preview-contained-categories true
owner: "{{ zsh_user }}"
group: "{{ zsh_user }}"
mode: "0600"
- name: Change default shell to zsh
ansible.builtin.user:
name: "{{ zsh_user }}"
+8 -2
View File
@@ -1,3 +1,9 @@
alias dc="docker compose"
alias p="podman"
alias pp="podman play"
alias pl="podman logs -f"
alias pc="podman compose"
alias w="cd ~/workspace"
alias sd="systemctl"
alias jd="journalctl -xe"
alias docker="echo 'use podman instead'"
alias docker-compose="echo 'use podman-compose instead'"
alias w='cd $HOME/workspace'
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+49 -12
View File
@@ -1,24 +1,61 @@
# {{ ansible_managed }}
export ZSH_PLUGINS={{ zsh_plugins_path }}
# History configuration
HISTFILE={{ zsh_config_path }}/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt EXTENDED_HISTORY # record timestamp of command
setopt HIST_EXPIRE_DUPS_FIRST # delete duplicates first when trimming
setopt HIST_IGNORE_DUPS # ignore duplicated commands
setopt HIST_IGNORE_SPACE # ignore commands starting with space
setopt HIST_VERIFY # show command with history expansion before running
setopt SHARE_HISTORY # share history between sessions
setopt APPEND_HISTORY # append to history file, don't overwrite
# Directory navigation
setopt AUTO_CD # cd by typing directory name
setopt AUTO_PUSHD # push directories on cd
setopt PUSHD_IGNORE_DUPS # don't push duplicates
setopt CORRECT # correct command spelling
setopt NO_BEEP # no beeps
# Completion
autoload -Uz compinit
compinit -C # faster completion (cache)
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# To customize prompt, run `p10k configure` or edit the following file.
source {{ zsh_p10k_theme_config }}
# Enable syntax highlighting for zsh
source $ZSH_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Enable autosuggestions
source $ZSH_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh
# Enable powerlevel10k theme
source $ZSH_PLUGINS/powerlevel10k/powerlevel10k.zsh-theme
# Enable autosuggestions (before syntax highlighting)
source $ZSH_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh
# Enable history substring search (before keybindings, before syntax highlighting)
source $ZSH_PLUGINS/zsh-history-substring-search/zsh-history-substring-search.zsh
# Enable syntax highlighting (must be loaded last)
source $ZSH_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Enable fzf integration (Ctrl+R, Ctrl+T, Alt+C)
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
# Enable fzf-tab for completions (after compinit)
source $ZSH_PLUGINS/fzf-tab/fzf-tab.zsh
# Source fzf-tab config
[[ -f {{ zsh_config_path }}/fzf-tab.zsh ]] && source {{ zsh_config_path }}/fzf-tab.zsh
# Source aliases
[[ -f {{ zsh_config_path }}/aliases ]] && source {{ zsh_config_path }}/aliases
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
export PROMPT="%n@%m:%~$ "
# Useful keybindings
bindkey "^[[A" history-substring-search-up
bindkey "^[[B" history-substring-search-down