dotfiles
Dotfiles for π¦(MLOps) and π²(Data Scientist): A Sara Pope's Spin-Off.
Managing Aliases
The dotfiles include a comprehensive set of aliases to streamline your workflow. You can view and manage these aliases using the alias_help.sh
script. To see a list of available alias categories, run:
aliases
To describe a specific category, use:
aliases --help <category_name>
To describe a specific alias, use:
aliases --describe <alias_name>
For example, to see what the alias gp
does, you would run:
aliases --describe gp
Before you get started make sure you give full disk access permission to your terminal (for writing macos defaults). System Preferences -> Privacy -> Full Disk Access
.
Add [+] Utilities > Terminal
To install:
curl -L https://bit.ly/42YwVdi | sh
This expands to run.sh which will fetch this repo and run the install script.
π«ΈπΎ don't accept macOS changes unless you know what it means
File overview
- Configs for the following tools:
- Shell environment configs:
Brewfile
- contains all homebrew packages, casks, and mac appstore apps
The install script will also setup Python, Node and Bun versions/environments:
- rye sets the global Python version to latest stable version and installs additional tools like
aider
- n sets the global Node version to LTS
- bun all-in-one toolkit for JavaScript and TypeScript apps
Brewfile Tools Definitions
```sh
# GUI & Command Line Tools
# Utilities and tools to enhance the command line interface experience
"ack" # A tool like grep, optimized for programmers
"aldente" # Battery life
"applesimutils" # Apple Simulator Utilities
"arc" # Browser for the future - 1Password, Vimium C extentions
"alttab" # Better preview app switcher
"azure-cli" # Microsoft Azure Command Line Interface
"bat" # A cat clone with syntax highlighting and Git integration
"bpytop" # Resource monitor that shows usage and stats
"binutils" # GNU binary tools for native development
"chruby" # Changes the current Ruby
"cleanshot" # Better screen capture
"coreutils" # GNU File, Shell, and Text utilities
"diffutils" # File comparison utilities
"direnv" # Environment switcher for the shell
"espanso" # Expands text shortcuts to full template
"eza" # A better ls and tree
"fd" # A simple, fast and user-friendly alternative to 'find'
"ffmpeg" # A complete, cross-platform solution to record, convert and stream audio and video
"figlet" # ascii fonts similar to toilet but with better fonts
"findutils" # GNU `find`, `locate`, `updatedb`, and `xargs` commands
"fzf" # Command-line fuzzy finder
"gawk" # GNU awk utility
"gh" # GitHub cli used by plenary
"git" # Distributed revision control system
"git-lfs" # Git Large Files Storage
"git-filter-repo" # When we mess up and want to clean
"gnu-sed" # GNU implementation of the famous stream editor
"gnu-tar" # GNU version of the tar archiving utility
"gnu-time" # GNU implementation of the time utility
"gnu-which" # GNU implementation of the 'which' utility to find path of executables
"gnupg" # GNU Pretty Good Privacy (PGP) package
"go" # The Go programming language
"graphviz" # Visualizing graphs
"grep" # GNU grep, egrep and fgrep
"gum" # Glamorous shell scripts
"gzip" # GNU compression utility
"hiddenbar" # Hides unpopular tab icons
"hyperfine" # A command-line benchmarking tool
"jq" # Lightweight and flexible command-line JSON processor
"lazygit" # The lazier way to manage everything git
"lazydocker" # The lazier way to manage everything docker
"mongosh" # Mongo DB shell
"moreutils" # Collection of tools that nobody wrote when UNIX was young
"ncdu" # NCurses Disk Usage
"neovim" # Ambitious Vim-fork focused on extensibility and agility
"node" # Platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications
"ollama" # Running Large Language Models offline
"pixi" # Fast than mamba: Drop in replacer of Pyenv + Poetry for conda universe
"python" # Interpreted, interactive, object-oriented programming language
"raycast" # A better spotlight - CleanShotX, Ollama, OpenAI, Alacritty, Brew extensitions
"rename" # Perl-powered file rename script with many helpful built-ins
"ripgrep" # Recursively searches directories for a regex pattern while respecting your gitignore
"rsync" # Utility that provides fast incremental file transfer
"rust" # Safe, concurrent, practical language
"rye" # Python's Cargo
"screen" # GNU screen, terminal multiplexer
"shotcat" # Vimium C for Apps: Path to Mouseless World
"starship" # Cross-shell prompt for astronauts
"stow" # Manage installation of multiple softwares in the same directory structure
"terraform" # Tool for building, changing, and versioning infrastructure safely and efficiently
"thefuck" # Autocorrection with f as alias
"tldr" # Too long I did nor read man
"toilet" # ascii art fonting similar to figlet but with filter and boarder e.g. toilet -F border -f future Welcome Prayson
"tmux" # Terminal multiplexer
"universal-ctags" # Creates a compressed version of a code bases used by Aider
"uv" # Better drop in pip replacer alias pip='uv pip'
"vim" # Highly configurable text editor built to enable efficient text editing
"watchman" # Watch files and take action when they change
"wget" # Internet file retriever
"yarn" # JavaScript package manager
"yazi" # Terminal file management
"zlib" # General-purpose lossless data-compression library
"zplug" # A next-generation plugin manager for zsh
"zsh" # UNIX shell (command interpreter)
"zoxide" # A faster way to navigate your filesystem
# Custom Taps (Specialized tools)
"koekeishiya/formulae/skhd" # Simple hotkey daemon for macOS
"koekeishiya/formulae/yabai" # A tiling window manager for macOS
# GUI Applications (Casks)
# Various applications installed through Homebrew Cask
"1password" # Password manager
"alacritty" # GPU-accelerated terminal emulator
"docker" # Platform to develop, ship, and run applications
````
Customization
Git
-
Be sure to update the user name/email values in the global gitconfig
Color Schemes
-
Alacritty, Tmux, Nvim, fzf := color scheme == Catppuccin-Mocha
After First Installation, Sync dotfile with GitHub
Configure GitHub to usee SSH Configure + Setup
Change dotfile remote url to use ssh:
git remote set-url origin git@github.com:Proteusiq/dotfiles.git
MacOS settings
Steps of updating or changing `macos/.macos` to fit your preferences
Example changing Clock to Analog:
```sh
# step 1: generate before change default settings
defaults read > before
# step 2: make changes on the UI. For example change clock appearance settings and go back to terminal
defaults read > after
# step 3: used `diff before after` or VSCode to change the difference. On VSCode right click `before` > Select for Compare, right click `after`> Compare with Selected
# find the changes that highlights the UI chnages
```
![diff](https://github.com/Proteusiq/dotfiles/assets/14926709/e897e34a-5d7a-4865-8782-7bef847e4e0b)
Translate the changes to .macos
```python
# Prayson's Clock Preferences Dock
defaults write com.apple.menuextra.clock IsAnalog -int 0
defaults write com.apple.menuextra.clock ShowAMPM -int 1
defaults write com.apple.menuextra.clock ShowDate -int 0
defaults write com.apple.menuextra.clock ShowDayOfWeek -int 0
defaults write com.apple.menuextra.clock ShowSeconds -int 0
```
See [RexYuan](https://github.com/RexYuan/Blemishine/tree/main/preferences)'s settings for inspiration and examples
Oh Vim
π§πΎββοΈ Vim Grammar: Verb + Noun
In Vim, editing operations follow a grammar-like structure: **Verb + Noun**. The verb represents an action, while the noun represents the text or movement the action operates on. This allows for flexible and powerful editing.
See: [Learn Vim the Smarter Way](https://learnvim.irian.to). Note: Visual mode **Noun + Verb***.
## Verbs
| Verb | Action |
|------|---------------------------------------------|
| `d` | delete |
| `c` | change (delete + enter insert mode) |
| `y` | yank (copy) |
## Nouns (Motions)
| Noun | Description |
|--------|------------------------------------|
| `w` | word (forward by word) |
| `b` | back (backward by word) |
| `3j` | down 3 lines |
| `G` | down to bottom |
| `gg` | up to top |
| `s` | sentence |
| `p` | paragraph |
## Nouns (Text Objects)
| Noun | Description |
|-------|------------------------------------|
| `iw` | inner word |
| `ib` | inner bracket (i{ or i() ) |
| `i"` | inner quotes |
| `is` | inner sentence |
| `as` | a sentence |
## Nouns (Parameterizers)
| Noun | Description |
|--------|-------------------------------------------|
| `f`, `F` | find the next character |
| `t`, `T` | find until next character |
| `/` | next match (word/pattern) |
## Examples: Verb + Noun
>Preferably Text Objects for repeatability with dot `.`
| Command | Action |
|-----------|------------------------------------------|
| `diw` | delete inner word |
| `da"` | delete contents a(rround) and include `"`|
| `yib` | yank (copy) inner bracket |
| `cfK` | change to next occurrence of character K |
Why Text Objects over Motions:
`cw` change executes from the current cursor position, while `ciw` execute whole object regardless of the cursor position.
Allowing dot `.` of action.
## Prefix: g (Super Prefix to Extend Commands)
| Command | Action |
|-----------|------------------------------------------|
| `gUaw` | uppercase a word |
| `:g/^\s*$/d` | search and remove all empty lines. |
---
This structure allows you to combine commands fluidly, increasing efficiency in text editing. By mastering verbs, nouns, and their combinations, you can perform powerful editing operations with minimal keystrokes.
More Vim keybindings:
### Modes
| **Key** | **Explanation** |
|----------|------------------------------------------|
| `Esc` | Command mode |
| `i` | Edit mode |
| `V` | Visual mode |
| `a` | Move cursor forward and enter edit mode |
| `A` | Move cursor to the end of the line, enter edit mode |
| `o` | Add newline below and enter edit mode |
| `O` | Add newline above |
### Deleting and Changing Text
| **Key** | **Explanation** |
|----------|-------------------------------------------------|
| `x` | Delete the character under the cursor |
| `~` | Swap the case of the character under the cursor |
| `dd` | Cut the current line |
| `d}` | Cut until the end of the block |
| `cw` | Change word: delete the word in focus and enter edit mode |
| `dw` | Delete word |
| `D` | Delete to the end of the line |
| `C` | Delete to the end of the line and enter edit mode |
| `ct` | Delete up to (but not including) the specified character |
| `.` | Repeat the last action |
| `u` | Undo |
| `3u` | Undo last 3 changes |
| `Ctrl-r` | Redo |
Better grammar `diw` or `daw` - delete inside/arround word
### Navigation
| **Key** | **Explanation** |
|----------|--------------------------------------------------|
| `hjkl` | Move cursor (left, down, up, right) |
| `20j` | Go down 20 lines |
| `:20` | Jump to line 20 |
| `w` | Move to the next word |
| `b` | Move backward one word |
| `4b` | Move backward 4 words |
| `0` | Move to the beginning of the line |
| `^` | Move to the first non-blank character of the line|
| `t` | Move just before the specified character |
| `f` | Move to the specified character |
| `%` | Move to the matching parenthesis, bracket, or brace |
| `gg` | Go to the top of the file |
| `G` | Go to the bottom of the file |
| `{` | Jump backward by paragraph |
| `}` | Jump forward by paragraph |
| `*` | Jump to the next occurrence of the word under the cursor |
| `z` | Center the line with the cursor in the middle of the screen |
### Copy and Paste
| **Key** | **Explanation** |
|----------|------------------------------------------|
| `yy` | Copy (yank) the current line |
| `P` | Paste before the cursor |
| `p` | Paste after the cursor |
### Search and Help
| **Key** | **Explanation** |
|-----------------|----------------------------------|
| `:h navigation` | Help on navigation |
| `:h search` | Help on search commands |
| `*` | Search for the word under the cursor |
### File and URL Handling
| **Key** | **Explanation** |
|----------|------------------------------------------|
| `gf` | Go to file path and open |
| `gx` | Go to URL and open in browser |
### Recording and Running Commands
| **Key** | **Explanation** |
|----------|------------------------------------------|
| `qa ... q` | Record macro |
| `@a` | Repeat recorded macro |
| `13@a` | Repeat recorded macro 13 times |
| `Shift+V Shift+G :` | Select to the end of the document |
| `:'<,'> norm A!` | Jump to the end and add `!` |
| `:norm I` | Jump to the beginning and enter insert mode |
### Browsing in Edit Mode
| **Key** | **Explanation** |
|----------|------------------------------------------|
| `Ctrl-p` / `Ctrl-n` | Browse written variables or names in edit mode |
---
Who You Gonna Call? π»
cheat.sh - curl https://cheat.sh/<cli_command>
Using Tools
Tips + Tricks
### Shortπ
Ctrl + f
---
### Sesh Tmux
raycast plugins sesh + sesh connect on terminal rocks
+ k
---
### Using [tmux](https://tmuxcheatsheet.com/)
```sh
# installl plugins
+ I # prefix is which is C-b
+ c # create a new session
+ n # previous session or instead of n, a to switch to session
+ "Shift + 2" (") or i to split horizontal
+ "Shift + 5" (%) o - to split vertical
+ Arrows or hjkl # move across panes
+ : # command mode (:rename-window :rename-session :kill-session -a #kill all session but this one :kill-session -t , :kill-server # kills all session)
+ d # dettach session
tmux ls # list sessions
+ s # list sessions
+ , # rename window
+ & # close window
+ z # min/maximize pane
+ p (P menu) # => popup terminal (leader + p to close)
+ O # => popup sessions (esc to close)
# custom
iexit # alias to kill-session
ikill # alias to kill-server
iswitch # alias to switch-session
ipop # alias for popup window
```
---
### Using fzf
```sh
# search
fzf # fzf -q .py$ -e
# open files/folders with nvim
nvim # Ctrl + t (C-t)
nvim ** # + TAB
# open files and folder
cd ** # + TAB
# commands things with fzf (kill, unalias, unset, export, ssh)
kill -9 ** # TAB (Next TAB will multiselect and Shift+Tab to deselect)
# looking throw the history
# C-r
docker # + C-r filter search to 'docker' history
```
---
## Using lazyVim
```sh
# Space
# window actions
# w # moves back to Neo-Tree
[b ]b # option/alt 8 and 9 for [] to navigate buffers(tabs)
# command mode
: # run sh commands: use case sort data, select and execute : <','>!sort or structure JSON <','> !jq
# Visual mode select:
# '<,'>s/^./# &/ -> replace anything with '#' to all non-blank lines"
# '<,'>s/^\([^#]\)/# &/ -> replace anything but lines starting with '#' with # "
: + !(Shift + 1) # filter mode: echo "OPENAI_API_KEY=sk-****** >> .env"
# Telescope:
:Telescope keymap
:Telescope lsp_definition `gd`
:Telescope live_grep
:Telescope lsp_reference `gr`
:Telescope git_branches
:Telescopes buffers
# More
Switch words
:s/\(hello\)\s\(there\)/\2 \1/
= => indent =G indent all to bottom
:help or :h v_d(help of visual mode d) (ctrl + wc) window close
# Debugging
## Key Mappings
| Shortcut | Description |
|---------------|------------------------------|
| `dm` | Debug Test Method |
| `dc` | Debug Test Class |
| `df` | Debug Python File |
| `du` | Debug Function Under Cursor |
| `dk` | Debug Class Under Cursor |
```
Acknowledgements