Skip to content

anhpt379/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anh's dotfiles

Linter Platform

vim-startify

Installation

Clone this repo to ~/dotfiles and follow the instructions in macOS/bootstrap.sh and local/bootstrap.sh.

I'm using this lima fedora39 image at the moment.

limactl start --name=fedora39 macOS/lima/fedora39.yaml
limactl shell fedora39
sudo dnf install -y git
cd ~
git clone https://github.com/anhpt379/dotfiles.git
bash dotfiles/local/bootstrap.sh

# If moving to a newer VM, use these commands to transfer the data:
limactl copy -r fedora:~/.local/share/fish/fish_history fedora39:~/.local/share/fish/
limactl copy -r fedora:~/.local/share/z/data fedora39:~/.local/share/z
limactl copy -r fedora:~/.ssh/conf.d/work.conf fedora39:~/.ssh/conf.d/
limactl copy -r fedora:~/.ssh/id_ed25519 fedora39:~/.ssh/
limactl copy -r fedora:~/notes fedora39:~/notes
limactl copy -r fedora:~/data fedora39:~/data

# On the old VM:
tar cf code.tar ~/code

# Then, on macOS:
limactl copy -r fedora:~/code.tar fedora39:~/code.tar

# Then, on the new VM:
cd
tar xf code.tar

# Finally, go back to macOS and create a snapshot for the new VM:
limactl snapshot create fedora39 --tag v1

The setup

overview

Key concepts:

  • macOS is in charge of handling clipboard, notifications and GUI-based applications (Chrome, Slack, Kitty, etc.).
  • the linux VM is in charge of text-based applications (fish, nvim, git, etc.).
  • ssh port forwards (port 2224 → 2227) are being used to make open, noti, pbcopy and pbpaste commands work within the VM.

Why using a VM?

  • it's easier to reproduce the setup.
  • git & docker are much (10x) faster.

Why not using docker (with Docker Desktop for Mac)?

  • slow storage performance (git status on a docker volume was 8x slower than in a VM).

Why not using native macOS?

  • git & docker operations are slow (git status on a relatively large repo takes 450ms, vs 50ms in a VM).

Keyboard layout

  • caps lock is control on hold, esc on tap.
  • return is control on hold.
  • right command and right option are backspace and delete.
  • : and ; are swapped.

keyboard

Key mappings

Chromium-based browsers

  • <Command>-t new tab
  • <Command>-w close tab
  • <Command>-n next tab
  • <Command>-p previous tab
  • <Command>-] move current tab to the right
  • <Command>-[ move current tab to the left
  • <Command>-o focus on the address bar
  • <Command>-u undo close tab
  • <Command>-y copy url
  • <Command>-f accept suggestion & go
  • <Control>-<Space> search tabs

Kitty

  • <Command>-t new tab
  • <Command>-w close tab
  • <Command>-n next tab
  • <Command>-p previous tab
  • <Command>-] move current tab to the right
  • <Command>-[ move current tab to the left
  • <Command>-r reload config
  • <Command>-s open a split

Tmux

  • <Option>-t new tab
  • <Option>-w close tab
  • <Option>-n next tab
  • <Option>-p previous tab
  • <Option>-] move current tab to the right
  • <Option>-[ move current tab to the left
  • <Option>-r reload config
  • <Option>-s open a split

Fish

  • <C-f> accept suggestion and execute
  • <C-v> edit the current command in vim
  • <C-r> fzf history
  • <Tab> fzf find

Vim

  • q close buffer
  • Q close all buffers
  • <Space>-s startify
  • <Space>-f fzf files (MRU)
  • <Space>-l lf
    • <Space> select
    • x cut
    • y copy
    • d delete
    • p paste
    • r rename
  • <Space>-g ripgrep all files
  • <C-n> next buffer
  • <C-p> previous buffer
  • <Space>-<1-9> jump to buffer #number
  • gs git status
    • a/Va stage/unstage
    • x/Vx discard changes
    • d show diff
    • p git push --force-with-lease
    • P git push --force
    • C commit
    • ca commit amend edit
    • ce commit amend no edit
    • ga git absorb
    • gr rebase
    • rr rebase continue
    • ra rebase abort
  • gb git branches
  • g[ git pull --rebase origin master
  • g] git push origin HEAD --force-with-lease
  • gl git log
  • gL git log current buffer
  • m git log current line
  • gp open github/gitlab pipelines in browser
  • go open link to file on GitLab/GitHub
  • gO copy link to file on GitLab/GitHub
  • gm create/open MR
  • gw write buffer to disk
  • M switch to branch master

Vim HJKL everywhere with Karabiner

When pressed together with Command, Option or CapsLock, HJKL will become arrow keys (Left/Down/Up/Right):

  • Command + H/J/K/L will perform character-level cursor movements.

    • Hold down an additional Shift key to select text.
  • Option + H/J/K/L will perform word-level cursor movements.

    • Hold down an additional Shift key to select text.
  • Control + H/J/K/L will perform page-level cursor movements.

    • Hold down an additional Shift key to select text.
  • CapsLock + N/P to go down and up.

  • Command + <Up>/<Down> to maximize/almost-maximize a window.

  • Command + <Left>/<Right> to resize & tile window to the left/right.