From ff07b915af96a2bfb9cb9a70d142f2b6a1b3bb6e Mon Sep 17 00:00:00 2001 From: phone Date: Sun, 17 Dec 2023 19:44:49 +0300 Subject: [PATCH] Bootstrap : Add Editorconfig. --- .config/bash/module/bootstrap.sh | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.config/bash/module/bootstrap.sh b/.config/bash/module/bootstrap.sh index 3663bd5..f916ad9 100644 --- a/.config/bash/module/bootstrap.sh +++ b/.config/bash/module/bootstrap.sh @@ -1,6 +1,6 @@ # Install Cargo/Rust. function bootstrap_rust() { - curl https://sh.rustup.rs -sSf | sh + curl https://sh.rustup.rs -sSf | sh rustup component add rust-analyzer } @@ -25,3 +25,33 @@ function bootstrap_grub() { function bootstrap_ffmpeg() { flatpak install org.kde.kdenlive } + +# Install Editorconfig file (with tabs) in current directory. +function bootstrap_editorconfig() { + echo "\ +[*] +end_of_line = lf +charset = utf-8 +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true +" > .editorconfig +} + +# Install Editorconfig file (with specified spaces, 8 by default) in current directory. +# Usage: bootstrap_editorconfig_space [AMOUNT] +function bootstrap_editorconfig_space() { + local spaces="${1}" + [[ "${spaces}" = "" ]] && spaces=8 + + echo "\ +[*] +end_of_line = lf +charset = utf-8 +indent_style = space +indent_size = ${spaces} +insert_final_newline = true +trim_trailing_whitespace = true +" > .editorconfig +} +