Skip to content

Latest commit

 

History

History
404 lines (293 loc) · 7.54 KB

README.md

File metadata and controls

404 lines (293 loc) · 7.54 KB

Guil's Dotfiles

Personalized Dotfiles for MacOS.

Installation

Clone this repo to your home folder.

git clone [email protected]:guilpejon/dotfiles.git ~/.dotfiles

Expand the sections below as you wish to learn how to install and configure them.

MacOS

Expand

Install

Install Rosetta 2 and xcode if this is a new M1 machine.

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

xcode-select --install

Configure

# Enable keystroke repetition while holding a key
defaults write -g ApplePressAndHoldEnabled -bool false

Brew

Expand

Installation

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

Apps

Expand
brew install slack
brew install spotify
brew install notion
brew install telegram
brew install whatsapp
brew install 1password

Dev tools

Expand
curl https://sh.rustup.rs -sSf | sh # install cargo
cargo install bat exa tokei ytop tealdeer grex zoxide git-delta

brew install yarn
brew install npm
brew install tree
brew install watch
brew install wget
brew install wireguard-tools
brew install gh
brew install flyctl
brew install redis
brew install postgresql
brew install ansible
brew install gpg
brew install keybase
brew install tmate

brew install cask
brew install --cask ngrok

brew install lazygit

# to enable k8s terminal helper functions
brew install fzf jq

iTerm2

Expand

Installation

brew install iterm2

Configuration

Use this article to configure word jumps wih arrow keys.

Set "Reuse previous session's directory" in "Working Directory".

image

Add one of the themes from the iterm/ folder to iTerm2 by following these steps.

“Command” + “Shift” + “.” - show hidden folders in finder

zsh

Expand

Installation

Install zsh and a few plugins, including powerlevel10k.

brew install zsh
mkdir ~/.zsh
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
echo "source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc

brew install romkatv/powerlevel10k/powerlevel10k
echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >> ~/.zshrc

Configuration

Add these lines to your ~/.zshrc.

# ~/.zshrc

source ~/.dotfiles/zsh/functions
source ~/.dotfiles/zsh/aliases
source ~/.dotfiles/zsh/configurations

Shortcuts

# vim
vim='nvim'
:q='exit'

# rust terminal tools
ls="exa -la --icons"
cat="bat --style=auto"
top="ytop"

# git
merge='merge --no-edit'
gs='git status'
gco='git checkout'
gcm='git commit -m'
gps='git push'
gpl='git pull'
ga='git add -A'
gap='git add -p'
gd='git diff'
gb='git branch -v'
glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)' --abbrev-commit"

# docker
docker-clean=' \
  docker container prune -f ; \
  docker image prune -f ; \
  docker network prune -f ; \
  docker volume prune -f '

# k8s
k=kubectl
kgp='k get pods'
kdp='k delete pod'
kswitch_ns='kubectl config set-context --current --namespace $(fz_namespace)'
kswitch_ctx='kubectl config use-context $(fz_context)'
kshell='kubectl exec $* -it $(fz_podname $*) -- sh'
kbash='kubectl exec $* -it $(fz_podname $*) -- bash'
klogs='kubectl logs $* -f $(fz_podname $*)'

Neovim

Expand

Installation

brew install neovim

Install rg, fd linters, lsps and ctags.

brew install rg fd

brew install ctags
alias ctags="`brew --prefix`/bin/ctags"
alias ctags >> ~/.bashrc

gem install gem-ctags
gem ctags # in a rails project folder

ctags -R * # run ctags manually in a project

Configuration

Create a symbolic link with the config folder.

ln -s ~/.dotfiles/nvim ~/.config/nvim

Shortcuts

<space> - leader
<leader>s - find and replace all under cursor

# tabs
te - tab edit
<tab> - go to next tab
<S-tab> - go to previous tab
tw - close tabclose tab

# splits
ss - split horizontally
sv - split vertically
sh or <S-LEFT> - move left
sk or <S-UP> - move up
sj or <S-DOWN> - move down
sl or <S-RIGHT> - move right
<tab-left> - reduce size horizontally
<tab-right> - increase size horizontally
<tab-up> - increase size vertically
<tab-down> - reduce size vertically

# git
gb - open blame window
go - open file in git repo

# LazyGit
<leader>gg - open lazygit

# telescope
<C>p - search git files
<leader>f - find files
sr - live grep
sc - Search for string under cursor
\\ - list open buffers
C-f - refine fuzzy search

# lspconfig
gr - LSP search word under cursor
<leadnr>cr - renames all references to symbol under cursor
K - displays info about symbol under cursor

# comment
gcc - comment line
gc (in visual mode selection) - comment block

# vim-surround
cs"' - change text between "" to ''
cst" - change text between tags (e.g. <div>) to "
ds" - remove "" surrounding a text
ysiw] - turns "Hello world!" to "[Hello] World" when cursor is in "Hello"
ysiw[ - turns "Hello world!" to "[ Hello ] World" when cursor is in "Hello"
yss) - wraps entire line between (...)
yss( - wraps entire line between ( ... )
S<p> - in visual mode (pressing V) wraps entire line between <p></p>

# vim-unimpaired
]q - :cnext
[q - :cprevious
]a - :next
[b - :bprevious
[<Space> - add newline before the cursor line
]<Space> add newlines after the cursor line
[e - exchange the current line with the one above
]e - exchange the current line with the one below
[os - :set spell
]os - :set nospell
yos - :set invspell
[x - encode XML
]x decode XML (and HTML)
[u - encode URLs
]u decode URLs
[f - go to next file in the directory
]f - go to the previous file in the directory

# copilot
<Tab>" - copilot accept suggestion
<M-]> - copilot next suggestion
<M-[> - copilot previous suggestion
<M-/> - toggle copilt suggestion

# copilot-chat
<leader>aa - start_chat
<leader>cs - send_message

# gen
<leader>] - start gen AI (need to run ollama run mistral first)

asdf

Expand

Installation

brew install asdf
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc

Plugins

asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf plugin-add python

Configuration

Create symlink to configuration file.

ln -s ~/.dotfiles/asdf/.asdfrc ~/.asdfrc

Git

Expand

Configuration

Create ssh key and add to agent.

ssh-keygen -t rsa # generate a new key if needed
ssh-add # add key to agent

Create symlink to configuration files.

ln -s ~/.dotfiles/git/.gitignore ~/.gitignore

# IMPORTANT: Remember to add your name and email to the ~/.gitconfig file
ln -s ~/.dotfiles/git/.gitconfig ~/.gitconfig

Rails

Expand

Configuration

Create symlink to configuration files.

ln -s ~/.dotfiles/rails/.railsrc ~/.railsrc
ln -s ~/.dotfiles/rails/.gemrc ~/.gemrc