From 4fdd55da97f134cbca4ccad7800107cd137486f0 Mon Sep 17 00:00:00 2001 From: Nicola Belluti Date: Mon, 13 Oct 2025 10:32:08 +0200 Subject: [PATCH] Added Neovim --- .chezmoi.toml.tmpl | 10 ++++++---- home/.chezmoiignore.tmpl | 4 ++++ home/private_dot_config/fish/conf.d/aliases.fish.tmpl | 7 +++++++ .../fish/conf.d/environment.fish.tmpl | 4 ++++ home/private_dot_config/nvim/.gitkeep | 0 setup-script/playbook.yaml | 2 ++ setup-script/roles/editor/tasks/main.yaml | 5 +++++ 7 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 home/private_dot_config/fish/conf.d/aliases.fish.tmpl create mode 100644 home/private_dot_config/fish/conf.d/environment.fish.tmpl create mode 100644 home/private_dot_config/nvim/.gitkeep create mode 100644 setup-script/roles/editor/tasks/main.yaml diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index adb4a87..237025c 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -1,8 +1,9 @@ -{{- $email := promptStringOnce . "email" "What's your email?" }} -{{- $git_name := promptStringOnce . "git_name" "What's your Git name?" }} +{{- $email := promptStringOnce . "email" "What's your email" }} +{{- $git_name := promptStringOnce . "git_name" "What's your Git name" }} -{{- $shell := promptBoolOnce . "features.shell" "Do you want to install the Fish shell?" true }} -{{- $git := promptBoolOnce . "features.git" "Do you want to install Git?" true }} +{{- $shell := promptBoolOnce . "features.shell" "Do you want to install the Fish shell" true }} +{{- $git := promptBoolOnce . "features.git" "Do you want to install Git" true }} +{{- $editor := promptBoolOnce . "features.editor" "Do you want to install Neovim" true }} [data] email = {{ $email | quote }} @@ -11,3 +12,4 @@ git_name = {{ $git_name | quote }} [data.features] shell = {{ $shell }} git = {{ $git }} +editor = {{ $editor }} diff --git a/home/.chezmoiignore.tmpl b/home/.chezmoiignore.tmpl index f2bbd96..9eabcac 100644 --- a/home/.chezmoiignore.tmpl +++ b/home/.chezmoiignore.tmpl @@ -6,3 +6,7 @@ {{- if not .features.git }} .config/git {{- end }} + +{{- if not .features.editor }} +.config/nvim +{{- end }} diff --git a/home/private_dot_config/fish/conf.d/aliases.fish.tmpl b/home/private_dot_config/fish/conf.d/aliases.fish.tmpl new file mode 100644 index 0000000..03139d6 --- /dev/null +++ b/home/private_dot_config/fish/conf.d/aliases.fish.tmpl @@ -0,0 +1,7 @@ +abbr --add --position command l ls -lAh + +{{- if .features.editor }} +# Alias `vi` and `vim` to Neovim +abbr --add --position command vim nvim +abbr --add --position command vi nvim +{{- end }} diff --git a/home/private_dot_config/fish/conf.d/environment.fish.tmpl b/home/private_dot_config/fish/conf.d/environment.fish.tmpl new file mode 100644 index 0000000..4123759 --- /dev/null +++ b/home/private_dot_config/fish/conf.d/environment.fish.tmpl @@ -0,0 +1,4 @@ +{{- if .features.editor }} +# Set Neovim to be the default editor +set --export EDITOR nvim +{{- end }} diff --git a/home/private_dot_config/nvim/.gitkeep b/home/private_dot_config/nvim/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/setup-script/playbook.yaml b/setup-script/playbook.yaml index 9f64c51..28a18de 100644 --- a/setup-script/playbook.yaml +++ b/setup-script/playbook.yaml @@ -27,3 +27,5 @@ when: features.shell == true - role: git when: features.git == true + - role: editor + when: features.editor == true diff --git a/setup-script/roles/editor/tasks/main.yaml b/setup-script/roles/editor/tasks/main.yaml new file mode 100644 index 0000000..7fad585 --- /dev/null +++ b/setup-script/roles/editor/tasks/main.yaml @@ -0,0 +1,5 @@ +- name: Install Neovim on Arch + become: true + ansible.builtin.pacman: + name: neovim + when: chezmoi.osRelease.id == "arch"