<div align="center"><h1>.dotfiles 📁<h1>

&ensp;[<kbd> <br> About <br> </kbd>](#about-this-repository)&ensp;
&ensp;[<kbd> <br> Installation <br> </kbd>](#installation)&ensp;
&ensp;[<kbd> <br> Usage <br> </kbd>](#usage)&ensp;
&ensp;[<kbd> <br> Troubleshooting <br> </kbd>](#troubleshooting)&ensp;
</div>

## About this repository
It contains all my configuration files (managed by [Chezmoi](https://www.chezmoi.io/)) and the script permitting to install my configuration on any Arch-based Linux distribution or any Linux distribution (as long as you can install [that](#prerequisites)).  

**Overview :**
- [💻 OS]():
    - [Arch Linux 💥](https://archlinux.org/)
- [🪟 Windows Manager]():
    - [HyprLand 🍚](https://hyprland.org/)
- [📟 Widgets]():
    - [ Eww 🤢](https://github.com/elkowar/eww)
- [👽 Terminal]():
    - [☄ Emulator]():
        - [Kitty 😽](https://sw.kovidgoyal.net/kitty/)
    - [🐚 Shell](): 
        - [fish 🐟](https://fishshell.com/) with [Fisher 🎣](https://github.com/jorgebucaran/fisher) 
        - [Zsh 📡]() with [Zinit 🌻](https://github.com/zdharma-continuum/zinit)
        - [Bash 📻]()
        - **🤖 Prompt**: [Oh-My-Posh 🔋](https://ohmyposh.dev/)
    - [📝 Editor]():
        - [Vim 👾](https://www.vim.org/)
        - [NeoVim 👓](https://neovim.io/) with [NvChad 🗿](https://nvchad.com/)
- [🔎 Browser]():
    - [Firefox 🌐](https://www.mozilla.org/fr/firefox/)

Check the `utils/packages` file to see all the packages installed by the script.

<hr style="height:10px">

## Installation
### Prerequisites
`Chezmoi`, `pacman` and `sudo` are necessary, be sure to have them install and configure!  
`Git` and `age` might be useful to have install.  
You may want to install the appropriate [driver](https://wiki.archlinux.org/title/NVIDIA) if you have an NVIDIA GPU.  

### Installation guide
Initialize the `chezmoi` repository and start the installation script with the following command :  
```bash
chezmoi init --apply https://gitea.hexasec.io/tombdf/.dotfiles.git
```
> [!HELP]
> If you just want to get the dotfiles without running the script, just use :
> ```bash
> chezmoi init https://gitea.hexasec.io/tombdf/.dotfiles.git
> ```

### Finishing the configuration
The script will end by itself. I recommend you to restart your computer.  
After restarting and opening the terminal, Fisher will install all the plugins.  
If you have access to Github Copilot, I recommend you to log in neovim with the `Copilot auth` command.   
I also recommend you to launch Firefox and create a Betterfox profile (using the `~/.config/betterfox/` folder). You can follow [this tutorial](https://github.com/yokoffing/Betterfox?tab=readme-ov-file). You may want to add an DNS in `user.js` (search line `user_pref("network.trr.uri", "");`).  
You may also setup the DNS in `/etc/systemd/resolved.conf` (I use [NextDNS](https://nextdns.io/) for that).  
Once you've done that, it's all good, enjoy your new config!  
PS: Don't forget to check the log file

<hr style="height:10px">

## Usage
The following sections will resume what usage you can have of different commands, text editors or terminal emulator.   

### Commands
With Zsh and Zinit, a lot of commands will be installed. They're very useful and powerful so it might be a good idea to learn what they are.  
Note : Two keybindings are define in `.zshrc`. They are <Ctrl>p and <Crtl>n. Use them for navigate in your command history.  

#### Zoxide
**Commands** : `z` | `zi`  
**Replaced by** : `cd` | `cdi`  
[Github page](https://github.com/ajeetdsouza/zoxide)  

Zoxide is a **cd** replacement. It will work fine as cd does, but every time you use the command, it will remember the path to the directory.  
After a little bit of time using the command, you could use it to "jump" to a repository i.e. you could only write a part of the path to the directory. You could also not write the entire name of the directory.  
If you want to see all the repository remembered by Zoxide, you can use the `cdi` command.   
**Note** : Zoxide integrate a system to replace the original `z` command by another (alternative to alias). That mean that only the "new" command work, not the original work. You can find the command in the Shell configuration file.  

Usage of the command : `tldr zoxide`  

<hr>

#### Lsd
**Command** : `lsd`  
**Aliased by** : `ls` | `ll`  
[Github page](https://github.com/lsd-rs/lsd-rs)  

Lsd is a **ls** replacement. It will add colors, icons and even git status to the display.  
The `ll` alias will print all the informations on all the files (including hidden files) in a directory. Check the aliases in the Shell configuration file.  

Usage of the command : `tldr lsd`  

<hr>

#### Rip
**Command** : `rip`
**Aliased by** : `rm`
[Github page](https://github.com/nivekuil/rip)  

Rip is a **rm** replacement. It will send all the deleted files to the graveyard (`/tmp/graveyard-$USER` or `$XDG_DATA_HOME/graveyard`), which means that the files can be restored.  
The files can only be deleted permanently by deleting the entire graveyard with the appropriate flag. Note that the graveyard can be put where you want with the right option.  

Usage of the command : `tldr rip`  

<hr>

#### Bat
**Command** : `bat`  
**Aliased by** : `cat`  
[Github page](https://github.com/sharkdp/bat)  

Bat is a **cat** replacement. It supports syntax-highlighting and git integration.  
It can be use as a pager.  

Usage of the command : `tldr bat`  

<hr>

#### Ripgrep
**Command** : `rg`  
**Aliased by** : `grep`  
[Github page](https://github.com/BurntSushi/ripgrep)  

Ripgrep is a **grep** replacement. It's a faster and recursive alternative to the original command.  

Usage of the command : `tldr rg`  

<hr>

#### Fd
**Command** : `fd`  
**Aliased by** : `find`  
[Github page](https://github.com/sharkdp/fd)  

Fd is a **find** replacement. It's a faster and more user-friendly alternative to the original command.  
The alias is set to show the hidden directory as well. Check the alias in the Shell configuration file.  

Usage of the command : `tldr fd`  

<hr>

#### Sd
**Command** : `sd`  
**Aliased by** : `sed`  
[Github page](https://github.com/chmln/sd)  

Sd is a **sed** replacement. It's a faster and more intuitive alternative to the original command.  

Usage of the command : `tldr sd`  

<hr>

#### Topgrade
**Command** : `topgrade`  
[Github page](https://github.com/topgrade-rs/topgrade)  

Topgrade permit to update, not only the system, but also all the packages and the git repository. It update **ALL** the things.  

Usage of the command : `tldr topgrade`  

<hr>

#### Tealdeer
**Command** : `tldr`  
[Github page](https://github.com/dbrgn/tealdeer)  

Tealdeer is a faster TLDR. It shows you pages written by community on different commands and programs.  
The pages shows different common and useful uses of commands.  

### Text editors
Differents text editors are available with my config. They're very powerful if you know how to use them and if you know the right keyboard shortcuts.  

#### Vim
**Command** : `vim`  
**Replaced by** : `vi`  
**Leader** : `,`  

Vim is installed with vim-plug plugin manager and the Gruvbox theme. In Vim, you can use the `PlugInstall` command to install the plugin, and `Minimap` to toggle the minimap.  
In Insert mode, you can use the `jj` mapping to go in Normal mode, and type Space to enter Command mode.  
Also in Insert mode, you can use the `<leader>'` mapping to open a block instruction.  
In Normal mode, use the `j`|`k`|`l`|`m` keys to move. Use the `<Ctrl-n>` mapping to open NerdTree.  

To see all the mappings, check the `.vimrc` config file.  

<hr>

#### Neovim with NvChad
**Command** : `nvim`  
**Aliased by** : `vim`  
**Leader** : `,`  
[NvChad Github page](https://github.com/NvChad/NvChad)  

Neovim is installed with the NvChad config. The basics mappings in Neovim are the same as the ones describes [here](#Vim).  
To see (almost) all the mappings, use the `<leader>ch` mapping.  
Use the `Lazy` command in Neovim to manage the plugins, and the `Mason` command to manage LSP.  
Type the `Copilot` command and type `tab` to see all the command available to use Copilot and CopilotChat.  

To see all the mappings, check the `mappings.lua` file in `.config/nvim/lua/`. To see all the plugins, check the `plugins.lua` file in `.config/nvim/lua/plugins`.   

### Terminal emulator
Kitty is the terminal emulator use in this config.
The leader key is Ctrl+Shift, here is a list of useful mappings :  
* `<leader>t` : Create a new tab.  
* `<leader>q` : Close a tab.  
* `<leader><Enter>` : Split a tab.  
* `<leader><Directional-arrow>` : Move between the different tab.  

Check the `kitty.conf` file in `.config/kitty/` to see all the possibility offered by Kitty.  

<hr style="height:10px">

## Troubleshooting
Before doing anything, verify that all the packages listed [here](#necessary-packages) are installed with the latest stable version.  

### Fish
If something went wrong when sourcing the config file, it might be that fish_inclusion was not delete preventing, when sourcing the file again, the downloading or the call of certains plugins.  
To fix that, you just have to run manually the command to reset the variable : set -e fish_inclusion

### Neovim
If NvChad seems not to be installed, be sure to have the latest version of Neovim installed.  
For any problem with a plugin, use the `checkhealth` command and see if anything wrong with the plugin is mentioned.  
If you get an error message like this : **"Client 1 quit with code 1"**, it might mean that a package is missing for Mason to work correctly.  
