From 722f9db961bbde59ec44e85e002ccbf17f6d9d8f Mon Sep 17 00:00:00 2001 From: aminnairi <18418459+aminnairi@users.noreply.github.com> Date: Sat, 8 Nov 2025 20:46:24 +0100 Subject: [PATCH] initial commit --- modules/0-library.sh | 291 ++++++++++++++++++ modules/1-git.sh | 9 + modules/10-tmux.sh | 7 + modules/2-base.sh | 34 ++ modules/3-docker.sh | 7 + modules/4-neovim.sh | 4 + modules/5-fish.sh | 17 + modules/6-fontconfig.sh | 9 + modules/7-services.sh | 3 + modules/8-gnome.sh | 7 + modules/9-kitty.sh | 7 + post-install.sh | 13 + sources/fish/conf.d/abbreviations.fish | 112 +++++++ sources/fish/conf.d/omf.fish | 7 + sources/fish/config.fish | 64 ++++ sources/fish/functions/cat.fish | 3 + sources/fish/functions/ls.fish | 3 + sources/fish/functions/pass.fish | 3 + .../fish/functions/privateinternetaccess.fish | 30 ++ sources/fish/functions/rm.fish | 4 + sources/fish/functions/tmux.fish | 12 + sources/fish/functions/vicd.fish | 3 + sources/fontconfig/fonts.conf | 33 ++ sources/kitty/kitty.conf | 70 +++++ sources/nvim/init.lua | 4 + sources/nvim/lua/settings/autocommands.lua | 9 + sources/nvim/lua/settings/keymap.lua | 37 +++ sources/nvim/lua/settings/lazy/init.lua | 16 + .../nvim/lua/settings/lazy/plugins/barbar.lua | 33 ++ .../lua/settings/lazy/plugins/barbecue.lua | 13 + .../nvim/lua/settings/lazy/plugins/cloak.lua | 45 +++ .../lua/settings/lazy/plugins/comment.lua | 46 +++ .../lua/settings/lazy/plugins/conform.lua | 38 +++ .../lua/settings/lazy/plugins/dressing.lua | 168 ++++++++++ .../lua/settings/lazy/plugins/icon-picker.lua | 19 ++ .../settings/lazy/plugins/link-visitor.lua | 22 ++ .../lua/settings/lazy/plugins/lsp-colors.lua | 12 + .../lua/settings/lazy/plugins/lspkind.lua | 36 +++ .../lua/settings/lazy/plugins/lualine.lua | 47 +++ .../settings/lazy/plugins/mason-lspconfig.lua | 39 +++ .../lazy/plugins/mason-tool-installer.lua | 27 ++ .../nvim/lua/settings/lazy/plugins/mason.lua | 4 + .../nvim/lua/settings/lazy/plugins/neogit.lua | 21 ++ .../nvim/lua/settings/lazy/plugins/neorg.lua | 72 +++++ .../lua/settings/lazy/plugins/neoscroll.lua | 5 + .../nvim/lua/settings/lazy/plugins/noice.lua | 26 ++ .../settings/lazy/plugins/nvim-autopairs.lua | 5 + .../lua/settings/lazy/plugins/nvim-lint.lua | 44 +++ .../settings/lazy/plugins/nvim-lspconfig.lua | 82 +++++ .../lua/settings/lazy/plugins/nvim-notify.lua | 23 ++ .../settings/lazy/plugins/nvim-surround.lua | 5 + .../settings/lazy/plugins/nvim-treesitter.lua | 139 +++++++++ .../lua/settings/lazy/plugins/nvimcmp.lua | 70 +++++ .../lua/settings/lazy/plugins/nvimtree.lua | 175 +++++++++++ .../lua/settings/lazy/plugins/telescope.lua | 24 ++ .../lua/settings/lazy/plugins/tokyonight.lua | 16 + .../settings/lazy/plugins/vim-illuminate.lua | 52 ++++ .../lua/settings/lazy/plugins/which-key.lua | 11 + .../lua/settings/lazy/plugins/zen-mode.lua | 5 + sources/nvim/lua/settings/options.lua | 46 +++ sources/omf/bundle | 1 + sources/omf/channel | 1 + sources/omf/theme | 1 + sources/tmux/.tmux.conf | 90 ++++++ 64 files changed, 2281 insertions(+) create mode 100644 modules/0-library.sh create mode 100644 modules/1-git.sh create mode 100644 modules/10-tmux.sh create mode 100644 modules/2-base.sh create mode 100644 modules/3-docker.sh create mode 100644 modules/4-neovim.sh create mode 100644 modules/5-fish.sh create mode 100644 modules/6-fontconfig.sh create mode 100644 modules/7-services.sh create mode 100644 modules/8-gnome.sh create mode 100644 modules/9-kitty.sh create mode 100644 post-install.sh create mode 100644 sources/fish/conf.d/abbreviations.fish create mode 100644 sources/fish/conf.d/omf.fish create mode 100644 sources/fish/config.fish create mode 100644 sources/fish/functions/cat.fish create mode 100644 sources/fish/functions/ls.fish create mode 100644 sources/fish/functions/pass.fish create mode 100644 sources/fish/functions/privateinternetaccess.fish create mode 100644 sources/fish/functions/rm.fish create mode 100644 sources/fish/functions/tmux.fish create mode 100644 sources/fish/functions/vicd.fish create mode 100644 sources/fontconfig/fonts.conf create mode 100644 sources/kitty/kitty.conf create mode 100644 sources/nvim/init.lua create mode 100644 sources/nvim/lua/settings/autocommands.lua create mode 100644 sources/nvim/lua/settings/keymap.lua create mode 100644 sources/nvim/lua/settings/lazy/init.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/barbar.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/barbecue.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/cloak.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/comment.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/conform.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/dressing.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/icon-picker.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/link-visitor.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/lsp-colors.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/lspkind.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/lualine.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/mason-lspconfig.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/mason-tool-installer.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/mason.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/neogit.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/neorg.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/neoscroll.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/noice.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvim-autopairs.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvim-lint.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvim-lspconfig.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvim-notify.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvim-surround.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvim-treesitter.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvimcmp.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/nvimtree.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/telescope.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/tokyonight.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/vim-illuminate.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/which-key.lua create mode 100644 sources/nvim/lua/settings/lazy/plugins/zen-mode.lua create mode 100644 sources/nvim/lua/settings/options.lua create mode 100644 sources/omf/bundle create mode 100644 sources/omf/channel create mode 100644 sources/omf/theme create mode 100644 sources/tmux/.tmux.conf diff --git a/modules/0-library.sh b/modules/0-library.sh new file mode 100644 index 0000000..e3c8912 --- /dev/null +++ b/modules/0-library.sh @@ -0,0 +1,291 @@ +#!/bin/bash + +function log() { + echo "[POSTINSTALL] $1" +} + +function is_installed() { + pacman -Q "$1" > /dev/null 2>&1 +} + +function is_global_git_configuration_set() { + test ! -z "$(git config --global "$1")" +} + +function is_global_root_git_configuration_set() { + test ! -z "$(sudo git config --global "$1")" +} + +function ensure_git_configuration_set() { + ensure_package_is_installed git + + if is_global_git_configuration_set "$1" + then + log "Configuration Git pour $1 déjà présente." + else + if log "Configuration Git pour $1 manquante, configuration en cours..." \ + && read -rp "Valeur pour $1 : " CONFIGURATION_VALUE \ + && git config --global "$1" "$CONFIGURATION_VALUE" + then + log "Configuration pour $1 installée." + else + log "Impossible de configurer $1 pour Git." + return 1 + fi + fi +} + +function ensure_root_git_configuration_set() { + ensure_package_is_installed git + + if is_global_root_git_configuration_set "$1" + then + log "Configuration administrateur Git pour $1 déjà présente." + else + if log "Configuration administrateur Git pour $1 manquante, configuration en cours..." \ + && read -rp "Valeur pour $1 : " CONFIGURATION_VALUE \ + && sudo git config --global "$1" "$CONFIGURATION_VALUE" + then + log "Configuration administrateur pour $1 installée." + else + log "Impossible de configurer $1 pour l'adminsitrateur Git." + return 1 + fi + fi +} + +function ensure_yay_installed() { + if ! is_installed yay + then + log "Installation de yay..." + sudo pacman -Syyu --needed --noconfirm git base-devel \ + && rm -rf /tmp/yay \ + && mkdir --parent /tmp/yay \ + && git clone https://aur.archlinux.org/yay /tmp/yay \ + && cd /tmp/yay \ + && makepkg -sri --noconfirm --needed \ + && yay --version \ + && cd ... || exit + fi +} + +function ensure_system_is_updated() { + ensure_yay_installed \ + && log "Mise à jour du système d'exploitation" \ + && yay --noconfirm --needed +} + +function ensure_package_is_installed() { + ensure_yay_installed + + if ! is_installed "$1" + then + log "Installation de $1..." + yay -Syyu --noconfirm --needed "$1" + else + log "Paquet $1 déjà installé." + fi +} + +function ensure_package_group_is_installed() { + local group_name="$1" + local exit_status=0 + + log "Vérification du groupe de paquets : $group_name" + + local members=$(pacman -Sg "$group_name" 2>/dev/null | awk '{print $2}') + + if [[ -z "$members" ]] + then + log "Le groupe '$group_name' n'existe pas ou ne contient aucun paquet." >&2 + return 1 + fi + + local missing_packages="" + + for pkg in $members; do + if ! is_installed $pkg + then + missing_packages+="$pkg " + exit_status=1 + fi + done + + if [ $exit_status -eq 0 ]; then + log "Le groupe '$group_name' est COMPLÈTEMENT installé." + return 0 + else + log "Le groupe '$group_name' est INCOMPLET. Paquets manquants :" + for pkg in $missing_pkgs + do + ensure_package_is_installed $pkg + done + fi +} + +function synchronize_user_folder() { + log "Synchronisation du dossier $1 vers $2..." \ + && rsync --archive --quiet --delete "$1" "$2" +} + +function synchronize_root_folder() { + log "Synchronisation du dossier $1 vers $2..." \ + && sudo rsync --archive --quiet --delete "$1" "$2" +} + +function ensure_group_is_installed() { + if groups "$USER" | grep "$1" > /dev/null 2>&1 + then + log "Groupe $1 déjà présent pour l'utilisateur $USER." + else + log "Groupe $1 absent pour l'utilisateur $USER, configuration..." + sudo usermod -aG docker "$1" + fi +} + +function ensure_service_active() { + local service_name="$1" + + if ! systemctl is-enabled --quiet "${service_name}"; then + log "Le service '${service_name}' n'est pas activé. Activation en cours..." + + if ! sudo systemctl enable "${service_name}" > /dev/null 2>&1; then + log "Impossible d'activer le service '${service_name}'." + else + log "Service $service_name activé." + fi + else + log "Service $service_name déjà activé." + fi + + if ! systemctl is-active --quiet "${service_name}"; then + log "Le service '${service_name}' n'est pas démarré. Démarrage en cours..." + + if ! sudo systemctl start "${service_name}" > /dev/null 2>&1; then + log "Impossible de démarrer le service '${service_name}'." + else + log "Service '${service_name}' démarré." + fi + else + log "Service '${service_name}' déjà démarré." + fi +} + +function ensure_ssh_key_installed() { + # Installing ssk-keygen and other OpenSSH related packages + ensure_package_is_installed openssh + + if ls -d ~/.ssh/*.pub > /dev/null 2>&1 + then + log "Clé SSH configurée sur ce système d'exploitation." + else + log "Aucune clé SSH configurée sur ce système d'exploitation." + if ! ssh-keygen -t ed25519 + then + log "Impossible d'installer la clé SSH." + return 1 + fi + fi +} + +function ensure_shell_installed() { + if grep "^$USER:.*:.*/$1$" /etc/passwd > /dev/null 2>&1 + then + log "Shell $1 déjà installé pour l'utilisateur $USER." + return 0 + fi + + log "Installation du shell $1 pour $USER." + + if sudo chsh -s fish "$USER" + then + log "Shell $1 installé pour $USER." + else + log "Echec lors de l'installation du shell $1 pour l'utilisateur $USER." + return 1 + fi +} + +function ensure_git_folder_installed_for_user() { + local git_path="$1" + local repo_dir="$2" + + local full_url="https://github.com/$git_path" + + if [[ -d "$repo_dir" ]] + then + log "Dossier $repo_dir existant, mise à jour..." + + if git -C "$repo_dir" pull --quiet + then + log "Dépôt $repo_dir mis à jour." + return 0 + else + log "Échec de la mise à jour du dépôt $repo_dir." + return 1 + fi + fi + + log "Dépôt $repo_dir innexistant, installation..." + + if git clone --quiet "$full_url" "$repo_dir" + then + log "Dépôt cloné avec succès dans $repo_dir." + return 0 + else + log "Échec du clonage de $full_url." + return 1 + fi +} + +function ensure_git_folder_installed_for_root() { + local git_path="$1" + local repo_dir="$2" + + local full_url="https://github.com/$git_path" + + if sudo test -d "$repo_dir" + then + log "Dossier $repo_dir existant, mise à jour..." + + if sudo git -C "$repo_dir" pull --quiet + then + log "Dépôt $repo_dir mis à jour." + return 0 + else + log "Échec de la mise à jour du dépôt $repo_dir." + return 1 + fi + fi + + log "Dépôt $repo_dir innexistant, installation..." + + if sudo git clone --quiet "$full_url" "$repo_dir" + then + log "Dépôt cloné pour l'administrateur avec succès dans $repo_dir." + return 0 + else + log "Échec du clonage pour l'administrateur de $full_url." + return 1 + fi +} + +function ensure_gnome_setting_set() { + local setting_schema="$1" + local setting_key="$2" + local setting_value="$3" + + if gsettings get "$setting_schema" "$setting_key" > /dev/null 2>&1 + then + log "Paramètre $setting_schema déjà paramétré." + return 0 + fi + + if ! gsettings set "$setting_schema" "$setting_key" "$setting_value" + then + log "Echec lor de la configuration du paramètre $1." + return 1 + fi + + log "Paramètre $setting_schema $setting_key paramétré avec succès." +} \ No newline at end of file diff --git a/modules/1-git.sh b/modules/1-git.sh new file mode 100644 index 0000000..97a3d6e --- /dev/null +++ b/modules/1-git.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +ensure_git_configuration_set "user.name" \ + && ensure_git_configuration_set "user.email" \ + && ensure_git_configuration_set "init.defaultbranch" \ + && ensure_root_git_configuration_set "user.name" \ + && ensure_root_git_configuration_set "user.email" \ + && ensure_root_git_configuration_set "init.defaultbranch" \ + && ensure_ssh_key_installed \ No newline at end of file diff --git a/modules/10-tmux.sh b/modules/10-tmux.sh new file mode 100644 index 0000000..905796c --- /dev/null +++ b/modules/10-tmux.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +ensure_package_is_installed tmux \ + && ensure_git_folder_installed_for_user tmux-plugins/tpm ~/.tmux/plugins/tpm \ + && ensure_git_folder_installed_for_root tmux-plugins/tpm /root/.tmux/plugins/tpm \ + && synchronize_user_folder ./sources/tmux/.tmux.conf ~/.config \ + && synchronize_root_folder ./sources/tmux/.tmux.conf /root/.config \ No newline at end of file diff --git a/modules/2-base.sh b/modules/2-base.sh new file mode 100644 index 0000000..085bfee --- /dev/null +++ b/modules/2-base.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +ensure_system_is_updated \ + && ensure_package_is_installed sudo \ + && ensure_git_configuration_set "user.name" \ + && ensure_git_configuration_set "user.email" \ + && ensure_git_configuration_set "init.defaultbranch" \ + && ensure_ssh_key_installed \ + && ensure_package_is_installed xf86-video-amdgpu \ + && ensure_package_is_installed vulkan-radeon \ + && ensure_package_is_installed mesa \ + && ensure_package_is_installed libva-mesa-driver \ + && ensure_package_is_installed mesa-vdpau \ + && ensure_package_is_installed amd-ucode \ + && ensure_package_is_installed syncthing \ + && ensure_package_is_installed man \ + && ensure_package_is_installed bpytop \ + && ensure_package_is_installed bind \ + && ensure_package_is_installed which \ + && ensure_package_is_installed fd \ + && ensure_package_is_installed python \ + && ensure_package_is_installed ruby \ + && ensure_package_is_installed php \ + && ensure_package_is_installed composer \ + && ensure_package_is_installed luarocks \ + && ensure_package_is_installed wget \ + && ensure_package_is_installed unzip \ + && ensure_package_is_installed zip \ + && ensure_package_is_installed rsync \ + && ensure_package_is_installed tokei \ + && ensure_package_is_installed texlive-bin \ + && ensure_package_is_installed neovim \ + && ensure_package_is_installed chromium \ + && ensure_package_is_installed firefox \ No newline at end of file diff --git a/modules/3-docker.sh b/modules/3-docker.sh new file mode 100644 index 0000000..c1be370 --- /dev/null +++ b/modules/3-docker.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +ensure_package_is_installed docker \ + && ensure_package_is_installed docker-compose \ + && ensure_package_is_installed lazydocker \ + && ensure_group_is_installed docker \ + && ensure_service_active docker \ No newline at end of file diff --git a/modules/4-neovim.sh b/modules/4-neovim.sh new file mode 100644 index 0000000..5c12573 --- /dev/null +++ b/modules/4-neovim.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +ensure_package_is_installed nvim \ + && synchronize_user_folder ./sources/nvim/ ~/.config/nvim \ No newline at end of file diff --git a/modules/5-fish.sh b/modules/5-fish.sh new file mode 100644 index 0000000..9a89df1 --- /dev/null +++ b/modules/5-fish.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +ensure_package_is_installed fish \ + && ensure_package_is_installed eza \ + && ensure_package_is_installed bat \ + && ensure_package_is_installed fastfetch \ + && ensure_package_is_installed openvpn \ + && ensure_package_is_installed fzf \ + && synchronize_user_folder ./sources/fish ~/.config \ + && synchronize_user_folder ./sources/omf ~/.config \ + && synchronize_root_folder ./sources/fish /root/.config \ + && synchronize_root_folder ./sources/omf /root/.config \ + && ensure_git_folder_installed_for_user oh-my-fish/oh-my-fish ~/.local/share/omf \ + && ensure_git_folder_installed_for_user oh-my-fish/theme-agnoster ~/.local/share/omf/themes/agnoster \ + && ensure_git_folder_installed_for_root oh-my-fish/oh-my-fish /root/.local/share/omf \ + && ensure_git_folder_installed_for_root oh-my-fish/theme-agnoster /root/.local/share/omf/themes/agnoster \ + && ensure_shell_installed fish \ No newline at end of file diff --git a/modules/6-fontconfig.sh b/modules/6-fontconfig.sh new file mode 100644 index 0000000..dc6ec45 --- /dev/null +++ b/modules/6-fontconfig.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +ensure_package_is_installed ttf-jetbrains-mono-nerd \ + && ensure_package_is_installed noto-fonts \ + && ensure_package_is_installed noto-fonts-emoji \ + && ensure_package_is_installed noto-fonts-cjk \ + && ensure_package_is_installed noto-fonts-ar \ + && synchronize_user_folder ./sources/fontconfig ~/.config \ + && synchronize_root_folder ./sources/fontconfig /root/.config \ No newline at end of file diff --git a/modules/7-services.sh b/modules/7-services.sh new file mode 100644 index 0000000..5fc13b3 --- /dev/null +++ b/modules/7-services.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +ensure_service_active acpid \ No newline at end of file diff --git a/modules/8-gnome.sh b/modules/8-gnome.sh new file mode 100644 index 0000000..a4eb891 --- /dev/null +++ b/modules/8-gnome.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +ensure_package_group_is_installed gnome \ + && ensure_package_group_is_installed gnome-extra \ + && ensure_package_is_installed python-psutil \ + && ensure_service_active gdm \ + && ensure_gnome_setting_set "org.gnome.desktop.input-sources" "xkb-options" "['compose:ralt']" \ No newline at end of file diff --git a/modules/9-kitty.sh b/modules/9-kitty.sh new file mode 100644 index 0000000..48d9c5b --- /dev/null +++ b/modules/9-kitty.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +ensure_package_is_installed kitty \ + && ensure_package_is_installed viu \ + && ensure_package_is_installed ueberzugpp \ + && synchronize_user_folder ./sources/kitty ~/.config \ + && synchronize_root_folder ./sources/kitty /root/.config \ No newline at end of file diff --git a/post-install.sh b/post-install.sh new file mode 100644 index 0000000..fd80e5e --- /dev/null +++ b/post-install.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +source ./modules/0-library.sh \ + && source ./modules/1-git.sh \ + && source ./modules/2-base.sh \ + && source ./modules/3-docker.sh \ + && source ./modules/4-neovim.sh \ + && source ./modules/5-fish.sh \ + && source ./modules/6-fontconfig.sh \ + && source ./modules/7-services.sh \ + && source ./modules/8-gnome.sh \ + && source ./modules/9-kitty.sh \ + && source ./modules/10-tmux.sh \ No newline at end of file diff --git a/sources/fish/conf.d/abbreviations.fish b/sources/fish/conf.d/abbreviations.fish new file mode 100644 index 0000000..2fa6ce3 --- /dev/null +++ b/sources/fish/conf.d/abbreviations.fish @@ -0,0 +1,112 @@ +# Abbreviations for "docker compose" +abbr --add dkcpb "docker compose build" +abbr --add dkcpcf "docker compose config" +abbr --add dkcpcp "docker compose cp" +abbr --add dkcpce "docker compose create" +abbr --add dkcpdn "docker compose down" +abbr --add dkcpevt "docker compose events" +abbr --add dkcpex "docker compose exec" +abbr --add dkcpimg "docker compose images" +abbr --add dkcpkl "docker compose kill" +abbr --add dkcplg "docker compose logs" +abbr --add dkcpls "docker compose ls" +abbr --add dkcppa "docker compose pause" +abbr --add dkcppr "docker compose port" +abbr --add dkcppl "docker compose pull" +abbr --add dkcpps "docker compose ps" +abbr --add dkcprs "docker compose restart" +abbr --add dkcprn "docker compose run" +abbr --add dkcpsc "docker compose scale" +abbr --add dkcpst "docker compose start" +abbr --add dkcpsp "docker compose stop" +abbr --add dkcptp "docker compose top" +abbr --add dkcpups "docker compose unpause" +abbr --add dkcpup "docker compose up" +abbr --add dkcpv "docker compose version" +abbr --add dkcpwt "docker compose wait" +abbr --add dkcpwa "docker compose watch" + +# Abbrevations for "docker container" +abbr --add dkctnat "docker container attach" +abbr --add dkctncm "docker container commit" +abbr --add dkctncp "docker container cp" +abbr --add dkctnca "docker container create" +abbr --add dkctnd "docker container diff" +abbr --add dkctnep "docker container export" +abbr --add dkctnex "docker container exec" +abbr --add dkctnip "docker container inspect" +abbr --add dkctnk "docker container kill" +abbr --add dkctnl "docker container logs" +abbr --add dkctnls "docker container ls" +abbr --add dkctnp "docker container pause" +abbr --add dkctnpn "docker container prune" +abbr --add dkctnp "docker container port" +abbr --add dkctnps "docker container port" +abbr --add dkctnrm "docker container rm" +abbr --add dkctnr "docker container run" +abbr --add dkctnrn "docker container rename" +abbr --add dkctnrt "docker container restart" +abbr --add dkctns "docker container stop" +abbr --add dkctnst "docker container start" +abbr --add dkctnsts "docker container stats" +abbr --add dkctnt "docker container top" +abbr --add dkctnud "docker container update" +abbr --add dkctnup "docker container unpause" +abbr --add dkctnw "docker container wait" + +# Abbreviations for "docker" +abbr --add dkev "docker events" +abbr --add dkhtr "docker history" +abbr --add dkip "docker import" +abbr --add dkl "docker load" +abbr --add dks "docker stats" +abbr --add dkt "docker tag" + +# Abbrevations for "docker system" +abbr --add dkstdf "docker system df" +abbr --add dkstevt "docker system events" +abbr --add dkstif "docker system info" +abbr --add dkstpn "docker system prune" + +# Abbrevations for "docker swarm" +abbr --add dksint "docker swarm init" +abbr --add dkslv "docker swarm leave" + +# Abbreviations for "docker context" +abbr --add dkctca "docker context create" +abbr --add dkctep "docker context export" +abbr --add dkctip "docker context import" +abbr --add dkctis "docker context inspect" +abbr --add dkctls "docker context ls" +abbr --add dkctrm "docker context rm" +abbr --add dkcts "docker context show" +abbr --add dkctud "docker context update" +abbr --add dkctu "docker context use" + +# Abbreviations for "docker network" +abbr --add dknwce "docker network create" +abbr --add dknwcn "docker network connect" +abbr --add dknwdcn "docker network disconnect" +abbr --add dknwis "docker network inspect" +abbr --add dknwls "docker network ls" +abbr --add dknwp "docker network prune" +abbr --add dknwrm "docker network rm" + +# Abbreviations for "docker plugin" +abbr --add dkpgce "docker plugin create" +abbr --add dkpgdsb "docker plugin disable" +abbr --add dkpgenb "docker plugin enable" +abbr --add dkpgis "docker plugin inspect" +abbr --add dkpgit "docker plugin install" +abbr --add dkpgls "docker plugin ls" +abbr --add dkpgp "docker plugin push" +abbr --add dkpgrm "docker plugin rm" +abbr --add dkpgs "docker plugin set" +abbr --add dkpgug "docker plugin upgrade" + +# Abbreviations for "docker volume" +abbr --add dkvlce "docker volume create" +abbr --add dkvlis "docker volume inspect" +abbr --add dkvlls "docker volume ls" +abbr --add dkvlp "docker volume prune" +abbr --add dkvlrm "docker volume rm" diff --git a/sources/fish/conf.d/omf.fish b/sources/fish/conf.d/omf.fish new file mode 100644 index 0000000..3e0f6d6 --- /dev/null +++ b/sources/fish/conf.d/omf.fish @@ -0,0 +1,7 @@ +# Path to Oh My Fish install. +set -q XDG_DATA_HOME + and set -gx OMF_PATH "$XDG_DATA_HOME/omf" + or set -gx OMF_PATH "$HOME/.local/share/omf" + +# Load Oh My Fish configuration. +source $OMF_PATH/init.fish diff --git a/sources/fish/config.fish b/sources/fish/config.fish new file mode 100644 index 0000000..8333a72 --- /dev/null +++ b/sources/fish/config.fish @@ -0,0 +1,64 @@ +if status is-interactive + # Enable vi-mode + fish_vi_key_bindings + + # Set the editor to use vim + set --export --global EDITOR nvim + + # Add ruby in the global path for Neovim + fish_add_path ~/.local/share/gem/ruby/3.0.0/bin + + # Add Node.js binaries in the global path + fish_add_path ~/.local/lib/node_modules/.bin + + # Add local binary in the global path + fish_add_path ~/.local/bin + + # Add Go binary path to global path + fish_add_path ~/go/bin + + # configuration for Oh My Fish BobTheFish theme + set -g theme_display_git yes + set -g theme_display_git_dirty yes + set -g theme_display_git_untracked yes + set -g theme_display_git_ahead_verbose yes + set -g theme_display_git_dirty_verbose yes + set -g theme_display_git_stashed_verbose yes + set -g theme_display_git_default_branch yes + set -g theme_git_default_branches development master main + set -g theme_git_worktree_support yes + set -g theme_use_abbreviated_branch_name yes + set -g theme_display_vagrant no + set -g theme_display_docker_machine yes + set -g theme_display_k8s_context yes + set -g theme_display_hg yes + set -g theme_display_virtualenv no + set -g theme_display_nix no + set -g theme_display_ruby no + set -g theme_display_node yes + set -g theme_display_user ssh + set -g theme_display_hostname ssh + set -g theme_display_vi yes + set -g theme_display_date yes + set -g theme_display_cmd_duration yes + set -g theme_title_display_process yes + set -g theme_title_display_path no + set -g theme_title_display_user yes + set -g theme_title_use_abbreviated_path no + set -g theme_date_format "+%a %H:%M" + set -g theme_date_timezone Europe/Paris + set -g theme_avoid_ambiguous_glyphs yes + set -g theme_powerline_fonts yes + set -g theme_nerd_fonts yes + set -g theme_show_exit_status yes + set -g theme_display_jobs_verbose yes + set -g default_user aminnairi + set -g theme_color_scheme dark + set -g fish_prompt_pwd_dir_length 0 + set -g theme_project_dir_length 1 + set -g theme_newline_cursor yes + set -g theme_newline_prompt '$ ' + + # Run fastfetch on each fish startup + fastfetch +end diff --git a/sources/fish/functions/cat.fish b/sources/fish/functions/cat.fish new file mode 100644 index 0000000..cb3c454 --- /dev/null +++ b/sources/fish/functions/cat.fish @@ -0,0 +1,3 @@ +function cat + bat --style full --italic-text always --force-colorization --theme gruvbox-dark $argv +end diff --git a/sources/fish/functions/ls.fish b/sources/fish/functions/ls.fish new file mode 100644 index 0000000..e004394 --- /dev/null +++ b/sources/fish/functions/ls.fish @@ -0,0 +1,3 @@ +function ls + eza --icons --long --classify --git --header --created --accessed --modified $argv +end diff --git a/sources/fish/functions/pass.fish b/sources/fish/functions/pass.fish new file mode 100644 index 0000000..86a8a45 --- /dev/null +++ b/sources/fish/functions/pass.fish @@ -0,0 +1,3 @@ +function pass + passbolt get resource --id (passbolt list resource | fzf | cut -d " " -f 1) | grep Password | cut -d " " -f 2 | xclip -selection clipboard +end diff --git a/sources/fish/functions/privateinternetaccess.fish b/sources/fish/functions/privateinternetaccess.fish new file mode 100644 index 0000000..d4901e0 --- /dev/null +++ b/sources/fish/functions/privateinternetaccess.fish @@ -0,0 +1,30 @@ +function privateinternetaccess + # Store the folder's path leading to the *.ovpn files + set openvpn_files_path "/etc/privateinternetaccess" + + # If there are no openvpn configuration files available + if not count $openvpn_files_path/* > /dev/null + # Bail out and exit with an error + echo "Error: no OpenVPN files found in $openvpn_files_path" + return 1 + end + + # Set the OpenVPN file name choosen by the user + set selected_file (/usr/bin/ls $openvpn_files_path | fzf) + + # Set the full path to the OpenVPN configuration file + set selected_file_path $openvpn_files_path/$selected_file + + # Prevent this script from running if the path is incorrect + if not test -f $selected_file_path + # Bail out and exit with an error + echo "Error: Configuration file not found at $selected_file_path" + return 2 + end + + # Open a new OpenVPN tunnel without caching the credentials by providing the path to a configuration + sudo openvpn --auth-nocache --config $selected_file_path + + # Notification + notify-send "OpenVPN" "Disconnected from OpenVPN" +end diff --git a/sources/fish/functions/rm.fish b/sources/fish/functions/rm.fish new file mode 100644 index 0000000..b0960c0 --- /dev/null +++ b/sources/fish/functions/rm.fish @@ -0,0 +1,4 @@ +function rm + # Use GIO in order to move the file to trash instead of deleting it permanently + /usr/bin/gio trash $argv +end diff --git a/sources/fish/functions/tmux.fish b/sources/fish/functions/tmux.fish new file mode 100644 index 0000000..421a7d9 --- /dev/null +++ b/sources/fish/functions/tmux.fish @@ -0,0 +1,12 @@ +function tmux + if test (count $argv) -eq 0 + # Install Tmux plugins + ~/.tmux/plugins/tpm/bin/install_plugins + + # Update Tmux plugins + ~/.tmux/plugins/tpm/bin/update_plugins all + end + + # Execute TMUX + /usr/bin/tmux -u $argv +end diff --git a/sources/fish/functions/vicd.fish b/sources/fish/functions/vicd.fish new file mode 100644 index 0000000..026a32a --- /dev/null +++ b/sources/fish/functions/vicd.fish @@ -0,0 +1,3 @@ +function vicd + cd (vifm --choose-dir - $argv) +end diff --git a/sources/fontconfig/fonts.conf b/sources/fontconfig/fonts.conf new file mode 100644 index 0000000..8aa590e --- /dev/null +++ b/sources/fontconfig/fonts.conf @@ -0,0 +1,33 @@ + + + + + sans-serif + + Noto Sans + Noto Color Emoji + Noto Emoji + DejaVu Sans + + + + + serif + + Noto Serif + Noto Color Emoji + Noto Emoji + DejaVu Serif + + + + + monospace + + Noto Mono + Noto Color Emoji + Noto Emoji + JetBrainsMono Nerd Font + + + diff --git a/sources/kitty/kitty.conf b/sources/kitty/kitty.conf new file mode 100644 index 0000000..40de3b2 --- /dev/null +++ b/sources/kitty/kitty.conf @@ -0,0 +1,70 @@ +# Tokyo Night color scheme for kitty terminal emulator +foreground #a9b1d6 +background #1a1b26 +# Black +color0 #414868 +color8 #414868 +# Red +color1 #f7768e +color9 #f7768e +# Green +color2 #73daca +color10 #73daca +# Yellow +color3 #e0af68 +color11 #e0af68 +# Blue +color4 #7aa2f7 +color12 #7aa2f7 +# Magenta +color5 #bb9af7 +color13 #bb9af7 +# Cyan +color6 #7dcfff +color14 #7dcfff +# White +color7 #c0caf5 +color15 #c0caf5 +# Cursor +cursor #c0caf5 +cursor_text_color #1a1b26 +# Selection highlight +selection_foreground none +selection_background #28344a +# The color for highlighting URLs on mouse-over +url_color #9ece6a +# Window borders +active_border_color #3d59a1 +inactive_border_color #101014 +bell_border_color #e0af68 +# Tab bar +tab_bar_style fade +tab_fade 1 +active_tab_foreground #3d59a1 +active_tab_background #16161e +active_tab_font_style bold +inactive_tab_foreground #787c99 +inactive_tab_background #16161e +inactive_tab_font_style bold +tab_bar_background #101014 +# Title bar +macos_titlebar_color #16161e +# Storm +# background #24283b +# cursor_text_color #24283b +# active_tab_background #1f2335 +# inactive_tab_background #1f2335 +# macos_titlebar_color #1f2335 + +# Custom configuration +font_family JetBrainsMono NFM +bold_font JetBrainsMono NFM Bold +italic_font JetBrainsMono NFM Italic +bold_italic_font JetBrainsMono NFM BoldItali +font_size 18.0 +force_ltr no +font_features +liga +disable_ligatures never +modify_font cell_height 10px +background_opacity 1 +background_blur 0 diff --git a/sources/nvim/init.lua b/sources/nvim/init.lua new file mode 100644 index 0000000..0d214c1 --- /dev/null +++ b/sources/nvim/init.lua @@ -0,0 +1,4 @@ +require("settings.options") +require("settings.keymap") +require("settings.autocommands") +require("settings.lazy") diff --git a/sources/nvim/lua/settings/autocommands.lua b/sources/nvim/lua/settings/autocommands.lua new file mode 100644 index 0000000..55ff669 --- /dev/null +++ b/sources/nvim/lua/settings/autocommands.lua @@ -0,0 +1,9 @@ +vim.api.nvim_create_autocmd("FileType", { + pattern = "php", + callback = function() + vim.bo.tabstop = 4 + vim.bo.softtabstop = 4 + vim.bo.shiftwidth = 4 + vim.bo.expandtab = true + end, +}) diff --git a/sources/nvim/lua/settings/keymap.lua b/sources/nvim/lua/settings/keymap.lua new file mode 100644 index 0000000..9bda706 --- /dev/null +++ b/sources/nvim/lua/settings/keymap.lua @@ -0,0 +1,37 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +local options = { + noremap = true, + silent = true +} + +-- Move the current line down one line in normal mode +vim.keymap.set('n', '', ":move .+1==", options) + +-- Move the current line up one line in normal mode +vim.keymap.set('n', '', ":move .-2==", options) + +-- Move the character under the cursor one character forward in normal mode +vim.keymap.set('n', '', "xp", options) + +-- Move the character under the cursor one character backward in normal mode +vim.keymap.set('n', '', "xhP", options) + +-- Move the current range down one line in visual-line mode +vim.keymap.set('x', '', ":move '>+1gv=gv", options) + +-- Move the current range up one line in visual-line mode +vim.keymap.set('x', '', ":move '<-2gv=gv", options) + +-- Move the current line down one line in insert mode +vim.keymap.set('i', '', ":move .+1==gi", options) + +-- Move the current line up one line in insert mode +vim.keymap.set('i', '', ":move .-2==gi", options) + +-- Move the character under the cursor one character forward in insert mode +vim.keymap.set('i', '', "lxpi", options) + +-- Move the character under the cursor one character backward in insert mode +vim.keymap.set('i', '', "lxhPi", options) diff --git a/sources/nvim/lua/settings/lazy/init.lua b/sources/nvim/lua/settings/lazy/init.lua new file mode 100644 index 0000000..f64a791 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/init.lua @@ -0,0 +1,16 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end + +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup("settings.lazy.plugins") diff --git a/sources/nvim/lua/settings/lazy/plugins/barbar.lua b/sources/nvim/lua/settings/lazy/plugins/barbar.lua new file mode 100644 index 0000000..829aba5 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/barbar.lua @@ -0,0 +1,33 @@ +return { + "romgrk/barbar.nvim", + event = "BufNew", + dependencies = { + "lewis6991/gitsigns.nvim", + "nvim-tree/nvim-web-devicons", + }, + init = function() + vim.g.barbar_auto_setup = false + + local map = vim.api.nvim_set_keymap + local opts = { noremap = true, silent = true } + + map("n", "", "BufferPrevious", opts) + map("n", "", "BufferNext", opts) + map("n", "", "BufferMovePrevious", opts) + map("n", ">", "BufferMoveNext", opts) + map("n", "", "BufferGoto 1", opts) + map("n", "", "BufferGoto 2", opts) + map("n", "", "BufferGoto 3", opts) + map("n", "", "BufferGoto 4", opts) + map("n", "", "BufferGoto 5", opts) + map("n", "", "BufferGoto 6", opts) + map("n", "", "BufferGoto 7", opts) + map("n", "", "BufferGoto 8", opts) + map("n", "", "BufferGoto 9", opts) + map("n", "", "BufferLast", opts) + map("n", "", "BufferPin", opts) + map("n", "", "BufferClose", opts) + map("n", "", "BufferPick", opts) + end, + opts = {}, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/barbecue.lua b/sources/nvim/lua/settings/lazy/plugins/barbecue.lua new file mode 100644 index 0000000..16a93ef --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/barbecue.lua @@ -0,0 +1,13 @@ +return { + "utilyre/barbecue.nvim", + name = "barbecue", + event = "BufEnter", + dependencies = { + "SmiteshP/nvim-navic", + "nvim-tree/nvim-web-devicons", + "folke/tokyonight.nvim", + }, + opts = { + theme = "tokyonight", + }, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/cloak.lua b/sources/nvim/lua/settings/lazy/plugins/cloak.lua new file mode 100644 index 0000000..0584059 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/cloak.lua @@ -0,0 +1,45 @@ +return { + "laytan/cloak.nvim", + config = function() + require("cloak").setup({ + enabled = true, + cloak_character = "·", + -- The applied highlight group (colors) on the cloaking, see `:h highlight`. + highlight_group = "Comment", + -- Applies the length of the replacement characters for all matched + -- patterns, defaults to the length of the matched pattern. + cloak_length = nil, -- Provide a number if you want to hide the true length of the value. + -- Wether it should try every pattern to find the best fit or stop after the first. + try_all_patterns = true, + patterns = { + { + -- Match any file starting with '.env'. + -- This can be a table to match multiple file patterns. + file_pattern = { + ".env*", + ".npmrc" + }, + -- Match an equals sign and any character after it. + -- This can also be a table of patterns to cloak, + -- example: cloak_pattern = { ':.+', '-.+' } for yaml files. + cloak_pattern = { + "=.+", + ":.+" + }, + -- A function, table or string to generate the replacement. + -- The actual replacement will contain the 'cloak_character' + -- where it doesn't cover the original text. + -- If left emtpy the legacy behavior of keeping the first character is retained. + replace = nil, + }, + }, + }) + + require("which-key").add({ + { "c", "Cloak", }, + { "ct", ":CloakToggle", desc = "Toggle" }, + { "cd", ":CloakDisable", desc = "Disable" }, + { "ce", ":CloakEnable", desc = "Enable" }, + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/comment.lua b/sources/nvim/lua/settings/lazy/plugins/comment.lua new file mode 100644 index 0000000..15f038f --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/comment.lua @@ -0,0 +1,46 @@ +return { + "numToStr/Comment.nvim", + opts = { + ---Add a space b/w comment and the line + padding = true, + ---Whether the cursor should stay at its position + sticky = true, + ---Lines to be ignored while (un)comment + ignore = nil, + ---LHS of toggle mappings in NORMAL mode + toggler = { + ---Line-comment toggle keymap + line = "gcc", + ---Block-comment toggle keymap + block = "gbc", + }, + ---LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + ---Line-comment keymap + line = "gc", + ---Block-comment keymap + block = "gb", + }, + ---LHS of extra mappings + extra = { + ---Add comment on the line above + above = "gcO", + ---Add comment on the line below + below = "gco", + ---Add comment at the end of line + eol = "gcA", + }, + ---Enable keybindings + ---NOTE: If given `false` then the plugin won't create any mappings + mappings = { + ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` + basic = true, + ---Extra mapping; `gco`, `gcO`, `gcA` + extra = true, + }, + ---Function to call before (un)comment + pre_hook = nil, + ---Function to call after (un)comment + post_hook = nil, + }, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/conform.lua b/sources/nvim/lua/settings/lazy/plugins/conform.lua new file mode 100644 index 0000000..fb89339 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/conform.lua @@ -0,0 +1,38 @@ +return { + "stevearc/conform.nvim", + init = function() + local whichKey = require("which-key") + local conform = require("conform") + + whichKey.add({ + { "f", group = "Format" }, + { + "ff", + function() + local currentFileBufferNumber = vim.fn.bufnr("%") + conform.format({ bufnr = currentFileBufferNumber }) + end, + desc = "Current File", + }, + }) + end, + config = function() + local conform = require("conform") + + conform.setup({ + formatters_by_ft = { + lua = { "stylua" }, + javascript = { "eslint_d" }, + php = { "phpcbf" }, + elm = { "elm_format" }, + fish = { "fish_indent" }, + }, + }) + + conform.formatters.phpcbf = { + prepend_args = { + "--standard=PSR12", + }, + } + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/dressing.lua b/sources/nvim/lua/settings/lazy/plugins/dressing.lua new file mode 100644 index 0000000..9ab15aa --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/dressing.lua @@ -0,0 +1,168 @@ +return { + "stevearc/dressing.nvim", + event = "VeryLazy", + opts = { + input = { + -- Set to false to disable the vim.ui.input implementation + enabled = true, + + -- Default prompt string + default_prompt = "Input:", + + -- Can be 'left', 'right', or 'center' + title_pos = "left", + + -- When true, will close the modal + insert_only = true, + + -- When true, input will start in insert mode. + start_in_insert = true, + + -- These are passed to nvim_open_win + border = "rounded", + -- 'editor' and 'win' will default to being centered + relative = "cursor", + + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + prefer_width = 40, + width = nil, + -- min_width and max_width can be a list of mixed types. + -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" + max_width = { 140, 0.9 }, + min_width = { 20, 0.2 }, + + buf_options = {}, + win_options = { + -- Window transparency (0-100) + winblend = 10, + -- Disable line wrapping + wrap = false, + -- Indicator for when text exceeds window + list = true, + listchars = "precedes:…,extends:…", + -- Increase this for more context when text scrolls off the window + sidescrolloff = 0, + }, + + -- Set to `false` to disable + mappings = { + n = { + [""] = "Close", + [""] = "Confirm", + }, + i = { + [""] = "Close", + [""] = "Confirm", + [""] = "HistoryPrev", + [""] = "HistoryNext", + }, + }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + + -- see :help dressing_get_config + get_config = nil, + }, + select = { + -- Set to false to disable the vim.ui.select implementation + enabled = true, + + -- Priority list of preferred vim.select implementations + backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" }, + + -- Trim trailing `:` from prompt + trim_prompt = true, + + -- Options for telescope selector + -- These are passed into the telescope picker directly. Can be used like: + -- telescope = require('telescope.themes').get_ivy({...}) + telescope = nil, + + -- Options for fzf selector + fzf = { + window = { + width = 0.5, + height = 0.4, + }, + }, + + -- Options for fzf-lua + fzf_lua = { + -- winopts = { + -- height = 0.5, + -- width = 0.5, + -- }, + }, + + -- Options for nui Menu + nui = { + position = "50%", + size = nil, + relative = "editor", + border = { + style = "rounded", + }, + buf_options = { + swapfile = false, + filetype = "DressingSelect", + }, + win_options = { + winblend = 10, + }, + max_width = 80, + max_height = 40, + min_width = 40, + min_height = 10, + }, + + -- Options for built-in selector + builtin = { + -- These are passed to nvim_open_win + border = "rounded", + -- 'editor' and 'win' will default to being centered + relative = "editor", + + buf_options = {}, + win_options = { + -- Window transparency (0-100) + winblend = 10, + cursorline = true, + cursorlineopt = "both", + }, + + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- the min_ and max_ options can be a list of mixed types. + -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" + width = nil, + max_width = { 140, 0.8 }, + min_width = { 40, 0.2 }, + height = nil, + max_height = 0.9, + min_height = { 10, 0.2 }, + + -- Set to `false` to disable + mappings = { + [""] = "Close", + [""] = "Close", + [""] = "Confirm", + }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, + + -- Used to override format_item. See :help dressing-format + format_item_override = {}, + + -- see :help dressing_get_config + get_config = nil, + }, + }, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/icon-picker.lua b/sources/nvim/lua/settings/lazy/plugins/icon-picker.lua new file mode 100644 index 0000000..ed37bf8 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/icon-picker.lua @@ -0,0 +1,19 @@ +return { + "ziontee113/icon-picker.nvim", + event = "VeryLazy", + config = function() + local iconPicker = require("icon-picker") + local whichKey = require("which-key") + + iconPicker.setup({ + disable_legacy_commands = true + }) + + whichKey.add({ + { "i", group = "Icon" }, + { "ie", function() vim.cmd("IconPickerInsert emoji") end, group = "Emoji" }, + { "is", function() vim.cmd("IconPickerInsert symbols") end, group = "Symbol" }, + { "in", function() vim.cmd("IconPickerInsert nerd_font") end, group = "Nerd Font Symbol" }, + }) + end +} diff --git a/sources/nvim/lua/settings/lazy/plugins/link-visitor.lua b/sources/nvim/lua/settings/lazy/plugins/link-visitor.lua new file mode 100644 index 0000000..dbc2738 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/link-visitor.lua @@ -0,0 +1,22 @@ +return { + "xiyaowong/link-visitor.nvim", + event = "BufEnter", + opts = { + open_cmd = nil, + silent = true, + skip_confirmation = true, + border = "rounded", + }, + config = function() + local whichKey = require("which-key") + local linkVisitor = require("link-visitor"); + + whichKey.add({ + { "v", group = "Link", }, + { "vv", function() linkVisitor.visit() end, }, + { "vl", function() linkVisitor.link_under_cursor() end, }, + { "vn", function() linkVisitor.link_near_cursor() end, }, + { "vN", function() linkVisitor.link_nearest() end, }, + }) + end +} diff --git a/sources/nvim/lua/settings/lazy/plugins/lsp-colors.lua b/sources/nvim/lua/settings/lazy/plugins/lsp-colors.lua new file mode 100644 index 0000000..80c6339 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/lsp-colors.lua @@ -0,0 +1,12 @@ +return { + "folke/lsp-colors.nvim", + dependencies = { + "neovim/nvim-lspconfig", + }, + opts = { + Error = "#db4b4b", + Warning = "#e0af68", + Information = "#0db9d7", + Hint = "#10B981", + }, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/lspkind.lua b/sources/nvim/lua/settings/lazy/plugins/lspkind.lua new file mode 100644 index 0000000..f31e825 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/lspkind.lua @@ -0,0 +1,36 @@ +return { + "onsails/lspkind.nvim", + config = function() + require('lspkind').init({ + mode = 'symbol_text', + preset = 'codicons', + symbol_map = { + Text = "󰉿", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "", + }, + }) + end +} diff --git a/sources/nvim/lua/settings/lazy/plugins/lualine.lua b/sources/nvim/lua/settings/lazy/plugins/lualine.lua new file mode 100644 index 0000000..fc5cc76 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/lualine.lua @@ -0,0 +1,47 @@ +return { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + dependencies = { + "nvim-tree/nvim-web-devicons" + }, + opts = { + options = { + icons_enabled = true, + theme = "tokyonight", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, + }, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/mason-lspconfig.lua b/sources/nvim/lua/settings/lazy/plugins/mason-lspconfig.lua new file mode 100644 index 0000000..5903d84 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/mason-lspconfig.lua @@ -0,0 +1,39 @@ +return { + "williamboman/mason-lspconfig.nvim", + dependencies = { + "williamboman/mason.nvim", + }, + opts = { + automatic_instalation = true, + ensure_installed = { + "angularls", + "ansiblels", + "bashls", + "biome", + "cssls", + "denols", + "docker_compose_language_service", + "dockerls", + "elmls", + "emmet_language_server", + "eslint", + "gopls", + "graphql", + "html", + "intelephense", + "jsonls", + "lua_ls", + "marksman", + "nginx_language_server", + "prismals", + "rust_analyzer", + "sqlls", + "svelte", + "templ", + "ts_ls", + "vls", + "vuels", + "yamlls", + }, + }, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/mason-tool-installer.lua b/sources/nvim/lua/settings/lazy/plugins/mason-tool-installer.lua new file mode 100644 index 0000000..b3f3274 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/mason-tool-installer.lua @@ -0,0 +1,27 @@ +return { + "WhoIsSethDaniel/mason-tool-installer.nvim", + dependencies = { + "williamboman/mason.nvim", + }, + opts = { + ensure_installed = { + "stylua", + "luacheck", + "stylelint", + "shellcheck", + "rustfmt", + "jq", + "jsonlint", + "htmlbeautifier", + "eslint", + "markdownlint", + "yamllint", + "ansible-lint", + "eslint_d", + "phpcbf", + "phpcs", + }, + auto_update = true, + run_on_start = true, + } +} diff --git a/sources/nvim/lua/settings/lazy/plugins/mason.lua b/sources/nvim/lua/settings/lazy/plugins/mason.lua new file mode 100644 index 0000000..b23f053 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/mason.lua @@ -0,0 +1,4 @@ +return { + "williamboman/mason.nvim", + opts = {} +} diff --git a/sources/nvim/lua/settings/lazy/plugins/neogit.lua b/sources/nvim/lua/settings/lazy/plugins/neogit.lua new file mode 100644 index 0000000..6d3d38f --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/neogit.lua @@ -0,0 +1,21 @@ +return { + "NeogitOrg/neogit", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "nvim-telescope/telescope.nvim", -- optional + "sindrets/diffview.nvim", -- optional + "ibhagwan/fzf-lua", -- optional + }, + config = function() + local whichKey = require("which-key") + local neogit = require("neogit") + + neogit.setup({}) + + whichKey.add({ + { "g", group = "Neogit", }, + { "go", function() neogit.open() end, }, + }) + end +} diff --git a/sources/nvim/lua/settings/lazy/plugins/neorg.lua b/sources/nvim/lua/settings/lazy/plugins/neorg.lua new file mode 100644 index 0000000..84108e4 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/neorg.lua @@ -0,0 +1,72 @@ +return { + "nvim-neorg/neorg", + build = ":Neorg sync-parsers", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim", + "folke/which-key.nvim", + }, + -- init = function() + -- -- Configure the key to use for keybinds used in the "core.keybinds" module + -- vim.g.maplocalleader = "," + -- end, + config = function() + require("neorg").setup({ + load = { + -- Default module that imports the core modules necessary for Neorg + ["core.defaults"] = {}, + -- Module responsible for enhancing the icons display in Neorg files + ["core.concealer"] = { + -- Configuration for the "core.concealer" module + config = { + -- Configure icons for concealed items + icons = { + -- Configure the code blocks + code_block = { + -- Conceal the "@code" and "@end" completely when in normal modej + conceal = true, + -- Add padding to a code inside a code block + padding = { + -- Add 2 spaces before the code inside a code block + left = 2 + } + }, + -- Configure the headings + heading = { + -- List of icons to use for all headings levels from 1 to 6 + icons = { + "◉", + "◎", + "○", + "◉", + "◎", + "○", + }, + }, + }, + }, + }, + ["core.dirman"] = { + -- Configuration for "core.dirman" module + config = { + -- Workspaces are folders from where to find Neorg files + workspaces = { + -- My personal notes + notes = "~/git/github.com/aminnairi/notes", + }, + }, + }, + -- Module for controling the presentation mode for Neorg files + ["core.presenter"] = { + -- Configuration for the presenter module + config = { + -- Plugin to use, here "folke/zen-mode" + zen_mode = "zen-mode", + }, + }, + -- Module for controling the ability to export Neorg files + ["core.export"] = {} + }, + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/neoscroll.lua b/sources/nvim/lua/settings/lazy/plugins/neoscroll.lua new file mode 100644 index 0000000..ebe7ea6 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/neoscroll.lua @@ -0,0 +1,5 @@ +return { + "karb94/neoscroll.nvim", + event = "BufEnter", + opts = {}, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/noice.lua b/sources/nvim/lua/settings/lazy/plugins/noice.lua new file mode 100644 index 0000000..dd8a60e --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/noice.lua @@ -0,0 +1,26 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + }, + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + } +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvim-autopairs.lua b/sources/nvim/lua/settings/lazy/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..bfa4ac4 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvim-autopairs.lua @@ -0,0 +1,5 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvim-lint.lua b/sources/nvim/lua/settings/lazy/plugins/nvim-lint.lua new file mode 100644 index 0000000..c321f5c --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvim-lint.lua @@ -0,0 +1,44 @@ +return { + "mfussenegger/nvim-lint", + dependencies = { + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + event = { "BufReadPre", "BufWritePost" }, + init = function() + local lint = require("lint") + + vim.api.nvim_create_autocmd({ "BufWritePost" }, { + callback = function() + lint.try_lint() + end + }) + end, + config = function() + local lint = require("lint") + local phpcs = lint.linters.phpcs + + phpcs.args = { + "-q", + -- <- Add a new parameter here + "--standard=PSR12", + "--report=json", + "-", + } + + lint.linters_by_ft = { + lua = { "luacheck" }, + javascript = { "eslint" }, + typescript = { "eslint" }, + javascriptreact = { "eslint" }, + typescriptreact = { "eslint" }, + vue = { "eslint" }, + sh = { "shellcheck" }, + fish = { "fish" }, + json = { "jsonlint" }, + markdown = { "markdownlint" }, + php = { "php", "phpcs", "phpstan" }, + css = { "stylelint" }, + yaml = { "yamllint" }, + } + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvim-lspconfig.lua b/sources/nvim/lua/settings/lazy/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..6e753c5 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvim-lspconfig.lua @@ -0,0 +1,82 @@ +return { + "neovim/nvim-lspconfig", + event = "VeryLazy", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "hrsh7th/nvim-cmp", + "folke/neodev.nvim" + }, + config = function() + local lspconfig = require("lspconfig") + local capabilities = require("cmp_nvim_lsp").default_capabilities() + local whichKey = require("which-key") + local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶 ", Info = " " } + + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + end + + local on_attach = function(_, buffer) + whichKey.add({ + { "l", group = "LSP" }, + { "lb", group = "LSP Buffer" }, + { "lbD", function() vim.lsp.buf.declaration() end, buffer = 1, desc = "Go to symbol declaration" }, + { "lbR", function() vim.lsp.buf.references() end, buffer = 1, desc = "Go to symbol references" }, + { "lbc", function() vim.lsp.buf.code_action() end, buffer = 1, desc = "LSP code action" }, + { "lbd", function() vim.lsp.buf.definition() end, buffer = 1, desc = "Go to symbol definition" }, + { "lbf", function() vim.lsp.buf.format() end, buffer = 1, desc = "Format file" }, + { "lbh", function() vim.lsp.buf.hover() end, buffer = 1, desc = "Hover symbol documentation" }, + { "lbi", function() vim.lsp.buf.implementation() end, buffer = 1, desc = "Go to symbol implementation" }, + { "lbr", function() vim.lsp.buf.rename() end, buffer = 1, desc = "Rename symbol" }, + { "lbs", function() vim.lsp.buf.signature_help() end, buffer = 1, desc = "Go to symbol signature" }, + { "lbt", function() vim.lsp.buf.type_definition() end, buffer = 1, desc = "Go to symbol type definition" }, + { "ld", group = "LSP Diagnostic" }, + { "ldn", function() vim.diagnostic.goto_next() end, desc = "Next LSP diagnostic" }, + { "ldo", function() vim.diagnostic.open_float() end, desc = "Open LSP diagnostic" }, + { "ldp", function() vim.diagnostic.goto_prev() end, desc = "Previous LSP diagnostic" }, + }) + end + + -- Needed in order to get more completion in Lua files for Vim/Neovim + require("neodev").setup() + + local languageServers = { + "angularls", + "ansiblels", + "bashls", + "biome", + "cssls", + --"denols", + "docker_compose_language_service", + "dockerls", + "elmls", + "emmet_language_server", + "eslint", + "gopls", + "graphql", + "html", + "intelephense", + "jsonls", + "lua_ls", + "marksman", + "nginx_language_server", + "prismals", + "rust_analyzer", + "sqlls", + "svelte", + "templ", + "ts_ls", + "vls", + "vuels", + "yamlls", + } + + for _, languageServerName in pairs(languageServers) do + lspconfig[languageServerName].setup({ + capabilities = capabilities, + on_attach = on_attach + }) + end + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvim-notify.lua b/sources/nvim/lua/settings/lazy/plugins/nvim-notify.lua new file mode 100644 index 0000000..bfe3c97 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvim-notify.lua @@ -0,0 +1,23 @@ +return { + "rcarriga/nvim-notify", + event = "VeryLazy", + config = function() + local notify = require("notify") + + vim.notify = notify + + require("notify.config").setup({ + enabled = false, + stages = "fade_in_slide_out", + timeout = 5000, + background_colour = "#1e222a", + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎", + }, + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvim-surround.lua b/sources/nvim/lua/settings/lazy/plugins/nvim-surround.lua new file mode 100644 index 0000000..15ecd7d --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvim-surround.lua @@ -0,0 +1,5 @@ +return { + "kylechui/nvim-surround", + event = "BufEnter", + opts = {}, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvim-treesitter.lua b/sources/nvim/lua/settings/lazy/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..58c07d3 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvim-treesitter.lua @@ -0,0 +1,139 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + event = "VeryLazy", + config = function() + require("nvim-treesitter.configs").setup({ + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { + "bash", + "c", + "css", + "csv", + "dockerfile", + "elm", + "fish", + "javascript", + "jsdoc", + "json", + "lua", + "norg", + "markdown", + "markdown_inline", + "php", + "prisma", + "query", + "regex", + "rust", + "scss", + "sql", + "ssh_config", + "svelte", + "toml", + "tsx", + "twig", + "typescript", + "vim", + "vimdoc", + "vue", + "xml", + "yaml", + }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = true, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally + auto_install = true, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + indent = { + enable = true, + }, + + highlight = { + enable = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on "syntax" being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + -- Configure text objects + textobjects = { + -- Text objects for selections like inside word (iw) or inside html tag (it) + select = { + -- Enable text objects selection + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + + -- Keymaps to use for using the following selection text objects + keymaps = { + -- The whole function + ["af"] = { query = "@function.outer", desc = "Select the whole function" }, + -- Inside a function + ["if"] = { query = "@function.inner", desc = "Select inside a function" }, + -- Inside an assignment + ["i="] = { query = "@assignment.inner", desc = "Select inside of a statement" }, + -- Left-hand-side of a statement + ["l="] = { query = "@assignment.lhs", desc = "Select left-hand-side of a statement" }, + -- Right-hand-side of a statement + ["r="] = { query = "@assignment.rhs", desc = "Select right-hand-side of a statement" }, + -- The whole statement + ["a="] = { query = "@assignment.outer", desc = "Select the whole statement" }, + -- Inside of an attribute + ["ia"] = { query = "@attribute.inner", desc = "Select inside of an attribute" }, + -- The whole attribute + ["aa"] = { query = "@attribute.outer", desc = "Select the whole attribute" }, + -- Inside of a block + ["ib"] = { query = "@block.inner", desc = "Select inside a block" }, + -- The whole block + ["ab"] = { query = "@block.outer", desc = "Select the whole block" }, + -- Inside of a class + ["ic"] = { query = "@class.inner", desc = "Select inside of a class" }, + -- The whole class + ["ac"] = { query = "@class.outer", desc = "Select the whole class" }, + -- Inside a comment + ["iC"] = { query = "@comment.inner", desc = "Select inside of a comment" }, + -- The whole comment + ["aC"] = { query = "@comment.outer", desc = "Select the whole comment" }, + -- Inside of a conditional statement + ["ii"] = { query = "@conditional.inner", desc = "Select inside of a conditional statement" }, + -- The whole conditional statement + ["ai"] = { query = "@conditional.outer", desc = "Select the whole conditional statement" }, + -- Inside a loop + ["il"] = { query = "@loop.inner", desc = "Select inside a loop" }, + -- The whole a loop + ["al"] = { query = "@loop.outer", desc = "Select the whole loop" }, + -- Inside a number + ["in"] = { query = "@number.inner", desc = "Select inside a number" }, + -- Inside a number + ["an"] = { query = "@number.inner", desc = "Select the whole number" }, + -- Inside a parameter + ["ip"] = { query = "@parameter.inner", desc = "Select inside a parameter" }, + -- The whole parameter + ["ap"] = { query = "@parameter.outer", desc = "Select the whole parameter" }, + -- Inside of a regex + ["ir"] = { query = "@regex.inner", desc = "Select inside of a regex" }, + -- The whole regex + ["ar"] = { query = "@regex.outer", desc = "Select the whole regex" }, + -- Inside of a return statement + ["iR"] = { query = "@return.inner", desc = "Select inside of a return statement" }, + -- The whole return statement + ["aR"] = { query = "@return.outer", desc = "Select the whole return statement" }, + }, + -- Select surrounding white spaces as well as the selected text object + include_surrounding_whitespace = true, + }, + }, + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvimcmp.lua b/sources/nvim/lua/settings/lazy/plugins/nvimcmp.lua new file mode 100644 index 0000000..2b670e0 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvimcmp.lua @@ -0,0 +1,70 @@ +return { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip' + }, + event = "InsertEnter", + config = function() + local cmp = require("cmp") + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp", group_index = 2 }, + { name = "path", group_index = 2 }, + { name = 'luasnip' }, + }, { + { name = "buffer" }, + }), + }) + + -- Set configuration for specific filetype. + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). + }, { + { name = "buffer" }, + }), + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won"t work anymore). + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/nvimtree.lua b/sources/nvim/lua/settings/lazy/plugins/nvimtree.lua new file mode 100644 index 0000000..257a234 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/nvimtree.lua @@ -0,0 +1,175 @@ +local function use_nvim_tree_width(options) + if type(options) ~= "table" then + return + end + + ---@type number + local offset = options.offset + + ---@type number + local initial_width = options.initial_width + + local initial_width_type = type(initial_width) + + local on_width_updated = options.on_width_updated + + if type(on_width_updated) ~= "function" then + on_width_updated = function() end + end + + if type(offset) ~= "number" then + offset = 10 + end + + if initial_width_type ~= "number" and initial_width_type ~= "table" then + initial_width = 30 + end + + ---@type number|table + local previous_width = initial_width + + if initial_width_type ~= "number" then + previous_width = 30 + end + + ---@type number|table + local width = initial_width + + local function get_width() + return width + end + + local function increment_width() + if type(width) == "table" then + width = previous_width + end + + local new_width = width + offset + + previous_width = new_width + width = new_width + + on_width_updated(new_width) + end + + local function decrement_width() + if type(width) == "table" then + width = previous_width + end + + local new_width = width - offset + + previous_width = new_width + width = new_width + + on_width_updated(new_width) + end + + local function dynamic_width() + width = {} + on_width_updated(width) + end + + return get_width, increment_width, decrement_width, dynamic_width +end + +return { + "nvim-tree/nvim-tree.lua", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + vim.opt.termguicolors = true + + local nvimTreeApi = require("nvim-tree.api") + + local get_width, increment_width, decrement_width, dynamic_width = use_nvim_tree_width({ + offset = 5, + initial_width = 30, + on_width_updated = function(width) + vim.cmd.NvimTreeResize(width) + end + }) + + local function on_nvim_tree_attach(buffer) + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = buffer, noremap = true, silent = true, nowait = true } + end + + -- default mappings + nvimTreeApi.config.mappings.default_on_attach(buffer) + + -- custom mappings + vim.keymap.set('n', 'l', nvimTreeApi.node.open.edit, opts('Open file/directory')) + vim.keymap.set('n', 'h', nvimTreeApi.node.navigate.parent_close, opts('Help')) + end + + require("nvim-tree").setup({ + on_attach = on_nvim_tree_attach, + auto_reload_on_write = true, + sort_by = "case_sensitive", + filters = { + dotfiles = false, + }, + notify = { + -- Notifies everything from the INFO severity to ERROR + threshold = vim.log.levels.INFO, + -- Notifies only the relative path instead of the absolute + absolute_path = false, + }, + -- Move to the first letter of each folder/files instead of the beginning of the line + hijack_cursor = true, + -- Disable completely netrw, just in case + disable_netrw = true, + -- Reload the tree whenever a buffer is opened + reload_on_bufenter = true, + -- Allows using vim.ui.select for various operation instead of the defaut implementation + select_prompts = true, + view = { + -- dynamically get the width of the tree + width = get_width, + -- Always open the tree on the left side of the screen + side = "left", + -- Never display the number line for the tree + number = false, + }, + renderer = { + -- Never add trailing slashes for folders name + add_trailing = false, + -- Never group directories in the tree for those that only have one child node + group_empty = false, + -- Never highlight any files in a special way + special_files = {}, + -- Highlight files that have diagnostics + highlight_diagnostics = true + }, + update_focused_file = { + -- Focus the file in the tree whenever it is focused in the editor + enable = true + }, + diagnostics = { + -- Enable diagnostics for the tree + enable = true, + -- Show diagnostics for the parent folder of the incriminated file + show_on_dirs = true + } + }) + + local whichKey = require("which-key") + + whichKey.add({ + { "n", group = "NvimTree" }, + { "nt", function() nvimTreeApi.tree.toggle() end, desc = "Toggle" }, + { "nf", function() nvimTreeApi.tree.focus() end, desc = "Focus" }, + { "ne", function() nvimTreeApi.tree.expand_all() end, desc = "Expand All" }, + { "nc", function() nvimTreeApi.tree.collapse_all() end, desc = "Collapse All" }, + { "nw", group = "Width" }, + { "nwi", increment_width, desc = "Increase" }, + { "nwd", decrement_width, desc = "Decrease" }, + { "nwa", dynamic_width, desc = "Decrease" }, + { "nt", function() nvimTreeApi.tree.toggle() end, desc = "Toggle" }, + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/telescope.lua b/sources/nvim/lua/settings/lazy/plugins/telescope.lua new file mode 100644 index 0000000..0645eba --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/telescope.lua @@ -0,0 +1,24 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + local telescope = require("telescope") + local telescopeBuiltin = require("telescope.builtin") + + telescope.setup({}) + + local whichKey = require("which-key") + + whichKey.add({ + { "t", group = "Telescope" }, + { "th", function() telescopeBuiltin.help_tags() end, desc = "Help Tags" }, + { "tt", function() telescopeBuiltin.treesitter() end, desc = "Treesitter" }, + { "tf", function() telescopeBuiltin.find_files() end, desc = "Files" }, + { "tw", function() telescopeBuiltin.live_grep() end, desc = "Words" }, + { "tc", function() telescopeBuiltin.colorscheme() end, desc = "Colorscheme" }, + { "tg", function() telescopeBuiltin.git_files() end, desc = "Colorscheme" }, + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/tokyonight.lua b/sources/nvim/lua/settings/lazy/plugins/tokyonight.lua new file mode 100644 index 0000000..02cee2e --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/tokyonight.lua @@ -0,0 +1,16 @@ +return { + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + init = function() + vim.cmd.colorscheme("tokyonight") + end, + opts = { + style = "storm", + transparent = true, + light_style = "day", + terminal_colors = true, + }, + }, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/vim-illuminate.lua b/sources/nvim/lua/settings/lazy/plugins/vim-illuminate.lua new file mode 100644 index 0000000..e0f32b6 --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/vim-illuminate.lua @@ -0,0 +1,52 @@ +return { + "RRethy/vim-illuminate", + event = "BufEnter", + config = function() + require("illuminate").configure({ + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 100, + -- filetype_overrides: filetype specific overrides. + -- The keys are strings to represent the filetype while the values are tables that + -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist + filetype_overrides = {}, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + -- See `:help mode()` for possible values + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + -- See `:help mode()` for possible values + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + -- large_file_cutoff: number of lines at which to use large_file_config + -- The `under_cursor` option is disabled when this cutoff is hit + large_file_cutoff = nil, + -- large_file_config: config to use for large files (based on large_file_cutoff). + -- Supports the same keys passed to .configure + -- If nil, vim-illuminate will be disabled for large files. + large_file_overrides = nil, + -- min_count_to_highlight: minimum number of matches required to perform highlighting + min_count_to_highlight = 1, + }) + end, +} diff --git a/sources/nvim/lua/settings/lazy/plugins/which-key.lua b/sources/nvim/lua/settings/lazy/plugins/which-key.lua new file mode 100644 index 0000000..2f0841a --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/which-key.lua @@ -0,0 +1,11 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 0 + end, + config = function() + -- Nothing here + end +} diff --git a/sources/nvim/lua/settings/lazy/plugins/zen-mode.lua b/sources/nvim/lua/settings/lazy/plugins/zen-mode.lua new file mode 100644 index 0000000..6b7fa5d --- /dev/null +++ b/sources/nvim/lua/settings/lazy/plugins/zen-mode.lua @@ -0,0 +1,5 @@ +return { + "folke/zen-mode.nvim", + event = "VeryLazy", + opts = {} +} diff --git a/sources/nvim/lua/settings/options.lua b/sources/nvim/lua/settings/options.lua new file mode 100644 index 0000000..266b834 --- /dev/null +++ b/sources/nvim/lua/settings/options.lua @@ -0,0 +1,46 @@ +local opt = vim.opt + +opt.autoindent = true +opt.autoread = true +opt.backspace = "indent,eol,start" +opt.bufhidden = "hide" +opt.clipboard:append("unnamedplus") +opt.confirm = true +opt.copyindent = true +opt.emoji = true +opt.encoding = "UTF-8" +opt.expandtab = true +opt.fileignorecase = true +opt.hlsearch = true +opt.ignorecase = true +opt.incsearch = true +opt.infercase = true +opt.joinspaces = true +opt.laststatus = 2 +opt.lazyredraw = false +opt.backup = false +opt.breakindent = false +opt.compatible = false +opt.errorbells = false +opt.linebreak = false +opt.swapfile = false +opt.number = true +opt.relativenumber = true +opt.shiftround = true +opt.shiftwidth = 2 +opt.shiftwidth = 2 +opt.smartcase = true +opt.smartindent = true +opt.smarttab = true +opt.softtabstop = 2 +opt.tabstop = 2 +opt.syntax = "on" +opt.wrap = false +opt.cursorline = true +opt.termguicolors = true +opt.signcolumn = "yes" +opt.splitright = true +opt.splitbelow = true +opt.conceallevel = 3 + +vim.api.nvim_set_hl(0, "NvimTreeNormal", { bg = "none" }) diff --git a/sources/omf/bundle b/sources/omf/bundle new file mode 100644 index 0000000..9524e26 --- /dev/null +++ b/sources/omf/bundle @@ -0,0 +1 @@ +theme agnoster diff --git a/sources/omf/channel b/sources/omf/channel new file mode 100644 index 0000000..2bf5ad0 --- /dev/null +++ b/sources/omf/channel @@ -0,0 +1 @@ +stable diff --git a/sources/omf/theme b/sources/omf/theme new file mode 100644 index 0000000..e957063 --- /dev/null +++ b/sources/omf/theme @@ -0,0 +1 @@ +agnoster diff --git a/sources/tmux/.tmux.conf b/sources/tmux/.tmux.conf new file mode 100644 index 0000000..c93569b --- /dev/null +++ b/sources/tmux/.tmux.conf @@ -0,0 +1,90 @@ +# Open in current director# Rebind Ctrl-b to Ctrl-a +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# Start windows at index 1 instead of 0 +set -g base-index 1 + +# Start panes at index 1 instead of 0 +set -g pane-base-index 1 + +# Ensures that panes get reordered correctly when killing panes +set-option -g renumber-windows on + +# VI-mode +set-window-option -g mode-keys vi +set-window-option -g status-keys vi + +# Enable Vi copy commands +bind-key -T copy-mode-vi 'v' send -X begin-selection +bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -selection clipboard' + +# Vim keybinding for resizing panes +bind -r C-h resize-pane -L # Control-a Control-h +bind -r C-j resize-pane -D # Control-a Control-j +bind -r C-k resize-pane -U # Control-a Control-k +bind -r C-l resize-pane -R # Control-a Control-l + +# Vim keybinding for switching between panes +bind h select-pane -l # Control-a h +bind j select-pane -D # Control-a j +bind k select-pane -U # Control-a k +bind l select-pane -R # Control-a l + +# Bind Control-a + X to kill a session +bind X kill-session + +# Bind Control-a + C to create a new session +bind C new-session + +# split panes using | and - and use the current working directory +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" + +# Create new window with current path +bind c new-window -c "#{pane_current_path}" + +# Unbinding the old keybind for splitting the pane vertically +unbind '"' + +# Unbinding the old keybind for splitting the pane horizontally +unbind % + +# Disable completely the mouse +set -g mouse off + +# Set the default terminal +set -s default-terminal 'tmux-256color' + +# Longer workspace names +set -g status-left-length 20 + +# Reduce the escape time for Neovim +set-option -sg escape-time 10 + +# Enable focus event for Neovim +set-option -g focus-events on + +# Terminal feature specific to Neovim +set-option -sa terminal-overrides ',tmux-256color:Tc' +set-option -as terminal-features ',xterm-kitty:RGB' +set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support +set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 + +# Tmux plugin to handle tmux plugins +set -g @plugin 'tmux-plugins/tpm' + +# Tmux theme plugin +set -g @plugin 'jimeh/tmux-themepack' + +# Tmux plugin to navigate easily between session +set -g @plugin 'tmux-plugins/tmux-sessionist' + +# Setting the theme to use with Tmux Themepack +# set -g @themepack 'powerline/block/cyan' +# set -g @plugin "aminnairi/tokyo-night-tmux#mode-style" +set -g @plugin "janoamaral/tokyo-night-tmux" + +# Run the Tmux plugin manager +run '~/.tmux/plugins/tpm/tpm'