-
Dotfiles: Configuration files for your applications (e.g.,
.bashrc
,.vimrc
). Managing them in a repository allows for easy backups and synchronization across systems. -
GNU Stow: A symlink manager that simplifies managing multiple dotfiles by organizing them into separate directories and creating symlinks in your home directory.
Ensure that you have the following tools installed on your Linux machine:
- GNU Stow: Symlink manager.
Open your terminal and execute the following commands based on your Linux distribution.
For Debian/Ubuntu-based systems:
sudo apt update
sudo apt install stow
-
Create a New Repository: Create a new repository on GitHub or GitLab to store your dotfiles.
-
Clone the Repository: Clone the repository to your local machine using the following command:
cd ~ git clone https://github.com/yourusername/dotfiles.git cd dotfiles
- Replace
yourusername
with your GitHub username.
- Replace
Create a directory structure for your dotfiles repository as follows:
dotfiles/
├── bash/
├── vim/
├── zsh/
└── ...
Create directories for each package (e.g., bash
, vim
) inside your dotfiles repository:
mkdir bash vim
Move your existing dotfiles into the corresponding package directories. For example, move .bashrc
to the bash
directory:
mv ~/.bashrc ~/dotfiles/bash/
Initialize a Git repository in your dotfiles directory and commit the changes:
git init
git add .
git commit -m "Initial commit"
To symlink the dotfiles from the bash
package, navigate to the dotfiles
directory and run the following command:
cd ~/dotfiles
stow bash
This will create symlinks for the files in the bash
directory in your home directory.
To verify that the symlinks have been created successfully, use the following command:
ls -la ~
You should see the symlinks pointing to the files in the bash
directory.
Whenever you want to make changes to your dotfiles, edit the files in the corresponding package directories (e.g., bash
, vim
).
After making changes, commit the changes to your Git repository:
git add .
git commit -m "Updated .bashrc"
Push the changes to your remote repository:
git push
To clone and set up your dotfiles on a new machine, follow these steps:
-
Clone the Repository: Clone your dotfiles repository to the new machine:
cd ~ git clone https://github.com/yourusername/dotfiles.git cd dotfiles
-
Symlink the Dotfiles: Use GNU Stow to symlink the dotfiles on the new machine:
stow bash
-
Install Zsh: Install Zsh using the package manager of your Linux distribution.
For Debian/Ubuntu-based systems:
sudo apt update sudo apt install zsh
-
Set Zsh as the Default Shell: Change your default shell to Zsh by running the following command:
chsh -s $(which zsh)
-
Log Out and Log Back In: Log out of your session and log back in to apply the changes.
-
Install Oh My Zsh: Install Oh My Zsh by running the following command:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
-
Customize Oh My Zsh: Edit the
~/.zshrc
file to customize your Oh My Zsh configuration.
-
Install Powerlevel10k: Install the Powerlevel10k theme.
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
-
Set ZSH_THEME: Set the
ZSH_THEME
variable in your~/.zshrc
file topowerlevel10k/powerlevel10k
. -
Configure Powerlevel10k
Run
p10k configure
to customize your Powerlevel10k theme.
-
Clone the Ultimate vimrc repository
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
-
Install the Ultimate vimrc
sh ~/.vim_runtime/install_awesome_vimrc.sh