Skip to content

samoshkin/dotfiles

Repository files navigation

dotfiles

System settings, configuration files and apps for MacOS.

Installation

Sorry, but there's no fully automated installation script that could be run on a fresh MacOS installation and procude a full-blown setup in a one shot. I tried to implement it in a past, but it turns to be overcomplicated. It's better to copy and run a piece of code and validate the outcome.

Terminal and shell

Text editors

  • vim as an $EDITOR. Vim configuration lives in a dedicated repo. See samoshkin/dotvim repo.
  • vscode, if Vim is just too hardcore for you. NOTE: vscode configuration is TBD.

File system

  • nnn as a single-panel console file manager. Altenatively, if you prefer two-panel file manager, use midnight commander
  • osxfuse, brings support for FUSE (file systems in a user space). FUSE allows to mount and view archives, remote file systems over SSH, not supported file systems as a directory in your local filesystem. Use ntfs-3g to mount NTFS volumes. Use macfusion-ng or sshfs to mount remote file systems over SSH or FTPS.
  • archivemount, mounts an archive for access as a directory on a file system. Requires osxfuse to work.

Terminal applications

  • ripgrep for full-text search, modern replacement for grep.
  • fd to find files on a file system, modern replacement for find.
  • exa to list files in a directory, modern replacement for ls.
  • up-to-date version of GNU utils (e.g. sed, tar, grep, find, etc.) installed in place of older versions shipped natively with MacOS.
  • fzf to fuzzy find files. It's versatile enough and not limited to files only scenario. You can pipe pretty much anything through it and get a nice fuzzy selector interface and apply arbitrary action to the selected item or items. Examples are text search matches, brew formulas, npm packages, git commits, git branches, etc.
  • atool to manage archives of various types. zip and unzip commands to work with zip archives.
  • rifle command from ranger file manager is used as a smart file opener instead of the stock open command. You can configure which application handles which file type, and open a file through it.
  • bat, same to cat but with syntax highlighting.
  • rupa/z tracks your most used directories based on 'frecency', and lets you jump around without having to type fully qualified directory path.
  • Patched version of DroidSansMono font from NerdFonts is used in a terminal. It contains a large collection of icons combined from different sources (from font awesome, devicons, octicons, etc).
  • direnv to load directory-local .envrc and read environment variables. It's used to load 12factor apps environment variables, create per-project isolated development environments, or load secrets for deployment.
  • curl and wget to download files
  • htop for interactive process management, fkill-cli to fuzzy find process by name and kill it.
  • rsync to copy files and directories when stock cp is just not enough.
  • httpie, command-line HTTP client for the API era with JSON support, syntax highlighting. More advanced alternative to curl or wget.
  • mptre/yank to yank terminal output to clipboard through a simple selection interface.
  • antonmedv/fx, command line JSON processing and interacive viewer tool. Alternatively, use jq, lightweight and flexible command-line JSON processor, without interactive interface.
  • ncdu, ncurses disk usage program.
  • httrack to copy whole website for offline viewing.
  • nmap to scan nodes on a network, probe open ports and check remote running apps.
  • bandwhich, CLI utility for displaying current network utilization by process, connection and remote IP/hostname.
  • up, tool for writing Linux pipes with instant live preview.
  • itchyny/bed, binary/hex editor written in Go. Alternatively, use xxd, hexdump or od to view files in a binary/hex mode.
  • mediainfo, a unified display of technical and tag data for video and audio files.

GUI applications

Not every app in this list is managed and installed via scripts in this repo. Consider it as just a dump of GUI apps I'm using, some of them are installed via brew cask, whereas other through App Store. I omit most evident apps like browsers, messengers, etc.

  • Microsoft Todo, task management app from Microsoft.
  • amethyst is a tiling window manager for MacOS, so you don't need to constantly arrange and resize windows on a screen(s) on your own.
  • macpass is a password manager, a KeePass compatible port for MacOS.
  • karabiner-elements to remap keys system-wide, key-codes to inspect key codes on press
  • postman to build and talk to HTTP APIs
  • virtualbox and docker for virtualization
  • keepingyourawake to keep you Mac from sleep. Similar to caffeine or amphetamine.
  • speedcrunch is a calculator app
  • vlc is a video player
  • zim is a personal wiki. Zim is a notepad like desktop application that is inspired by the way people use wikis. I use it to keep miriad of notes and as a knowledge base. It has non-native UI on MacOS, but nevertheless it's very useful tool for keeping large amount of notes, and I hardly can find a replacement for it.
  • qbittorrent, a cross-platform free and open source BitTorrent client.
  • bandwidth+, tracks network usage including upload and download speed, and shows small icon in the MacOS menu bar at the top.
  • Microsoft Remote Desktop, if you need to connect to another computer over proprietary RDP protocol.
  • monosnap to make screenshots and upload them to various cloud storages.

Most common commands and aliases

# Open files using "rifle"
# See https://github.com/ranger/ranger
alias o='rifle'

# Edit files using whatever $EDITOR
alias e="$EDITOR"
alias E="editor_in_split_pane"


# Long listing like "ls -la"
alias l='exa -la --group-directories-first --time-style long-iso --color-scale'

# Extract any archive with "x" alias using "atool"
alias x="atool -x"

# "nnn" file manager
$ n

" jump around file system, smart cd to directory
$ z

# Search with ripgrep+fzf with live query reload and live file/match preview
$ rgi

# Open fuzzy finder, select file and open in an $EDITOR
$ fe

For a complete list of extra commands or aliases, see scripts inside zsh directory.

Working with Git

Initially I was using Git extras and aliases from prezto git module, but after some time I noticed I'm using only a small fraction of features it provides in my everyday work. So I removed it and wrote most commonly used commands on my own. See git.sh.

In addition to working with Git on a command line, I use Vim (with vim-fugitive plugin) as a complement tool for viewing diffs, files to be commited, logs, exploring internal Git object database, extracting a snapshot of any file at any revision.

Diffmerge is used as a Git difftool or mergetool. I rarely use sourcetree app, maybe only to explore complex git log histories.

git-fuzzy pipes status, log, diff and other Git commands through fzf resulting in a nice selector interface for Git objects with a live preview on the right side.

delta is a viewer for git and diff output. Given delta, you can look at and review some simple diffs in a terminal. It comes with syntax highlihgting, line numbering, side-by-side view, within-line modifications, and other features.

To give an example, here is a bunch of commands I use to review PRs. It's mostly a terminal-oriented experience. It's all about exploring differences between <pr> and <upstream> revisions, or between <pr> and $(git merge-based pr upstream).

# Explore a difference between <pr> and <upstream>
git checkout <upstream>
git pull

# View a only a list of affected files. `gds` is for "git diff --stat"
# Commit range refers to commit reachable from <origin/pr>, but not reachable from <upstream>
# Basically that means all commits unique to a pull request
gds <upstream>..<origin/pr>

# view commits in PR, and patch for each commit
# glo = git log --oneline
# gfl = git fuzzy log
glo <upstream>..<origin/pr>
gfl <upstream>..<origin/pr>
:Git log <upstream>..<origin/pr> # vim command

# view list of affected files and complete diff for each file (not a commit's patch)
# gfd = git fuzzy diff
# gdt = git difftool (opens Vim or Diffmerge as a difftool)
gfd <upstream>..<origin/pr>
gdt <upstream>..<origin/pr>

# You might also open given file at a given revision, and probably blame it
# `ge` is similar to "git show", but open file's snapshot in a Vim
ge <rev>:<file>
git show <rev>:<file_or_dir>
:Git blame # vim command

# View affected files and a complete diff, and then open selected files in a Vim
$ git checkout <origin/pr>
$ REVIEW_UPSTREAM=<upstream> git_review_pr
# Then use :GdiffUpstream to enter a diff mode between `<pr>` vs `$(merge-base <pr> <upstream>)`
:GdiffUpstream

Development tools

  • node and nvm
  • python3 and pyenv
  • http-server to serve static files in ad-hoc development and testing scenarios
  • universal-ctags, programming tool that generates an index (or tag) file of names found in source and header files of various programming languages to aid code comprehension. Symbols are parsed using regular expressions.

About

System settings, configuration files and apps for MacOS. Personal setup

Resources

Stars

Watchers

Forks

Packages

No packages published