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"