Skip to content

Latest commit

 

History

History
134 lines (99 loc) · 4.09 KB

README.md

File metadata and controls

134 lines (99 loc) · 4.09 KB

dotfiles

This repo contains my dotfile configuration, allowing for a consistent computing experience across multiple machines.

How to Install

MacOS

For an MacOS dsitribution, it is recommended to install Apple's Command Line Tools using Homebrew

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install Apple's Command Line Tools
xcode-select --install

After installing Homebrew and Command Line Tool, clone the repo into a new hidden directory (e.g. ~/.dotfiles)

# Using HTTPS
git clone https://github.com/cp-changchien/dotfiles.git ~/.dotfiles

The various configuration files in this repo are linked using GNU Stow. This allows setting up symlinks for all dotfiles using a single command:

brew install stow
cd ~/.dotfiles
stow .

Note

tmux might require to be setup additionally, since the tmp (Tmux Plugin Manager) cannot be git.
Follow the below procedure to install and finish tmux configuration

First, clone the repo to install tpm

# Install tpm
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

# Once install, source the tmux.conf file (wheryou store your tmux.conf file)
tmux source ~/.dotfiles/.config/tmux/tmux.conf

Windows

For a Windows distribution, it is recommended to install PowerShell with winget commands,

# Install Neovim
winget install --id=Neovim.Neovim  -e

# Install git
winget install -e --id Git.Git

On Windows, NeoVim gets its configuration from %userprofile%\AppData\Local\nvim and keeps its data in %userprofile%\AppData\Local\nvim-data.
Therefore, by cloning the /.config file from the repo, we also need to link our /.config/nvim folder to the said configuration folder, this can be achieved by the following commmand,

# clone Dotfiles repo
$dotFilesRoot = Join-Path $HOME "dotfiles"

if (!(Test-Path $dotFilesRoot -PathType Container)) {
    git clone https://github.com/cp-changchien/dotfiles.git $dotFilesRoot
}

Then run the following command to link

# link NeoVim configuration
$localConfiguration = Join-Path $env:LOCALAPPDATA "nvim"
$dotfilesConfiguration = Join-Path $dotFilesRoot ".config" "nvim"

if (!(Test-Path $localConfiguration -PathType Container)) { 
    Start-Process -FilePath "pwsh" -ArgumentList "-c New-Item -Path $localConfiguration -ItemType SymbolicLink -Value $dotfilesConfiguration".Split(" ") -Verb runas
}

After this, reboot the system and run nvim to enter Neovim environment to check the configuration.
Run the following command to install plugins in custom.lua

# Mason Install the custom plugins
:MasonInstallAll

oh-my-posh

To configure terminal theme, first install oh-my-posh by the following command

# Install oh-my-posh
winget install JanDeDobbeleer.OhMyPosh -s winget

# To check, run
oh-my-posh

# Run to display the $PROFILE location to be edited
echo $PROFILE

To configure the theme and other aliases,

cd Documents
mkdir PowerShell
cd Powershell
nvim Microsoft.PowerShell_profile.ps1

Once the file is created, to initialise the default theme, enter the following in the script

# Neovim script
# Aliases
Set-Alias g git
Set-Alias vim nvim

#Prompt
oh-my-posh init pwsh | Invoke-Expression

An URL pointing to a remote config is recommended, replace the above line with (using catppuccin_mocha for example, more themes here)

# Neovim script
#Prompt
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin_mocha.omp.json' | Invoke-Expression

Important

C Compiler might be required to install for Windows, by searching MinGW SourceForge page and install mingw-get-setup.exe.
Follow the steps in this link