Inspiration https://github.com/ahmedelgabri/dotfiles
Last active
July 30, 2020 13:50
-
-
Save langolf/e6fbed5a98e5f35e49f108d915f9269a to your computer and use it in GitHub Desktop.
Mac dotfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if test ! "$( command -v brew )"; then | |
echo "Installing homebrew" | |
ruby -e "$( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )" | |
fi | |
# Install command-line tools using Homebrew. | |
# Make sure we’re using the latest Homebrew. | |
brew update | |
# Upgrade any already-installed formulae. | |
brew upgrade | |
# zplugin install | |
# https://github.com/zdharma/zplugin | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zplugin/master/doc/install.sh)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd $(dirname $BASH_SOURCE) | |
BASE=$(pwd) | |
export GIT_SSL_NO_VERIFY=true | |
mkdir -p ~/.vim/autoload | |
curl --insecure -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim | |
# vimrc | |
mv -v ~/.vimrc ~/.vimrc.old 2> /dev/null | |
ln -sf $BASE/vimrc ~/.vimrc | |
# nvim | |
mkdir -p ~/.config/nvim/autoload | |
ln -sf $BASE/vimrc ~/.config/nvim/init.vim | |
ln -sf ~/.vim/autoload/plug.vim ~/.config/nvim/autoload/ | |
mkdir -p ~/.config/nvim | |
ln -sf $BASE/coc-settings.json ~/.config/nvim/coc-settings.json | |
vim +PlugInstall +qall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ~/.macos — https://mths.be/macos | |
# Close any open System Preferences panes, to prevent them from overriding | |
# settings we’re about to change | |
osascript -e 'tell application "System Preferences" to quit' | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
# Trackpad: enable tap to click for this user and for the login screen | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true | |
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true | |
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 | |
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true | |
# Save to disk (not to iCloud) by default | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
# Disable transparency in the menu bar and elsewhere on Yosemite | |
# defaults write com.apple.universalaccess reduceTransparency -bool true | |
# Set sidebar icon size to medium | |
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 | |
# Increase window resize speed for Cocoa applications | |
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 | |
# Automatically quit printer app once the print jobs complete | |
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true | |
# Save to disk (not to iCloud) by default | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
# Disable the “Are you sure you want to open this application?” dialog | |
defaults write com.apple.LaunchServices LSQuarantine -bool false | |
# Remove duplicates in the “Open With” menu (also see `lscleanup` alias) | |
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user | |
# Disable automatic termination of inactive apps | |
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true | |
# Set Help Viewer windows to non-floating mode | |
defaults write com.apple.helpviewer DevMode -bool true | |
# Reveal IP address, hostname, OS version, etc. when clicking the clock | |
# in the login window | |
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName | |
# Restart automatically if the computer freezes | |
sudo systemsetup -setrestartfreeze on | |
# Disable the sudden motion sensor as it’s not useful for SSDs | |
sudo pmset -a sms 0 | |
# Increase sound quality for Bluetooth headphones/headsets | |
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 | |
# Enable full keyboard access for all controls | |
# (e.g. enable Tab in modal dialogs) | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
# Set a blazingly fast keyboard repeat rate | |
defaults write NSGlobalDomain KeyRepeat -int 2 | |
defaults write NSGlobalDomain InitialKeyRepeat -int 15 | |
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false # For VS Code | |
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider | |
defaults write com.visualstudio.code.oss ApplePressAndHoldEnabled -bool false # For VS Codium | |
defaults delete -g ApplePressAndHoldEnabled # If necessary, reset global default | |
# Stop iTunes from responding to the keyboard media keys | |
#launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null | |
# Set timezone | |
sudo systemsetup -settimezone "America/Chicago" > /dev/null | |
# Enable subpixel font rendering on non-Apple LCDs | |
defaults write NSGlobalDomain AppleFontSmoothing -int 2 | |
# Enable HiDPI display modes (requires restart) | |
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true | |
# Hide desktop icons | |
defaults write com.apple.finder CreateDesktop false | |
# Set Desktop as the default location for new Finder windows | |
# For other paths, use `PfLo` and `file:///full/path/here/` | |
defaults write com.apple.finder NewWindowTarget -string "PfDe" | |
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" | |
# Finder: disable window animations and Get Info animations | |
defaults write com.apple.finder DisableAllAnimations -bool true | |
# Finder: show hidden files by default | |
defaults write com.apple.finder AppleShowAllFiles -bool true | |
# Finder: show all filename extensions | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
# Finder: show status bar | |
defaults write com.apple.finder ShowStatusBar -bool true | |
# Finder: show path bar | |
defaults write com.apple.finder ShowPathbar -bool true | |
# Display full POSIX path as Finder window title | |
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true | |
# Keep folders on top when sorting by name | |
defaults write com.apple.finder _FXSortFoldersFirst -bool true | |
# When performing a search, search the current folder by default | |
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" | |
# Disable the warning when changing a file extension | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Enable spring loading for directories | |
defaults write NSGlobalDomain com.apple.springing.enabled -bool true | |
# Remove the spring loading delay for directories | |
defaults write NSGlobalDomain com.apple.springing.delay -float 0 | |
# Avoid creating .DS_Store files on network volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
# Use list view in all Finder windows by default | |
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` | |
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" | |
# Enable AirDrop over Ethernet and on unsupported Macs running Lion | |
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true | |
# Show the ~/Library folder | |
chflags nohidden ~/Library | |
# Show the /Volumes folder | |
sudo chflags nohidden /Volumes | |
# Expand the following File Info panes: | |
# “General”, “Open with”, and “Sharing & Permissions” | |
defaults write com.apple.finder FXInfoPanesExpanded -dict \ | |
General -bool true \ | |
OpenWith -bool true \ | |
Privileges -bool true | |
# Password after Screensaver | |
defaults write com.apple.screensaver askForPassword -bool true | |
# Set screensaver and add password delay | |
defaults -currentHost write com.apple.screensaver idleTime -int 120 | |
defaults write com.apple.screensaver askForPasswordDelay -int 60 | |
# Don’t animate opening applications from the Dock | |
defaults write com.apple.dock launchanim -bool false | |
# Speed up Mission Control animations | |
defaults write com.apple.dock expose-animation-duration -float 0.1 | |
# Remove the auto-hiding Dock delay | |
defaults write com.apple.dock autohide-delay -float 0 | |
# Remove the animation when hiding/showing the Dock | |
defaults write com.apple.dock autohide-time-modifier -float 0 | |
# Automatically hide and show the Dock | |
defaults write com.apple.dock autohide -bool true | |
# Make Dock icons of hidden applications translucent | |
defaults write com.apple.dock showhidden -bool true | |
# Disable Dashboard | |
defaults write com.apple.dashboard enabled-state -int 1 | |
# Privacy: don’t send search queries to Apple | |
defaults write com.apple.Safari UniversalSearchEnabled -bool false | |
defaults write com.apple.Safari SuppressSearchSuggestions -bool true | |
# Press Tab to highlight each item on a web page | |
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true | |
# Show the full URL in the address bar (note: this still hides the scheme) | |
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true | |
# Set Safari’s home page to `about:blank` for faster loading | |
defaults write com.apple.Safari HomePage -string "about:blank" | |
# Prevent Safari from opening ‘safe’ files automatically after downloading | |
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false | |
# Allow hitting the Backspace key to go to the previous page in history | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true | |
# Hide Safari’s bookmarks bar by default | |
defaults write com.apple.Safari ShowFavoritesBar -bool false | |
# Hide Safari’s sidebar in Top Sites | |
defaults write com.apple.Safari ShowSidebarInTopSites -bool false | |
# Disable Safari’s thumbnail cache for History and Top Sites | |
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 | |
# Enable Safari’s debug menu | |
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true | |
# Make Safari’s search banners default to Contains instead of Starts With | |
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false | |
# Remove useless icons from Safari’s bookmarks bar | |
defaults write com.apple.Safari ProxiesInBookmarksBar "()" | |
# Enable the Develop menu and the Web Inspector in Safari | |
defaults write com.apple.Safari IncludeDevelopMenu -bool true | |
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true | |
# Add a context menu item for showing the Web Inspector in web views | |
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true | |
# Enable continuous spellchecking | |
defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true | |
# Disable auto-correct | |
defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false | |
# Disable AutoFill | |
defaults write com.apple.Safari AutoFillFromAddressBook -bool false | |
defaults write com.apple.Safari AutoFillPasswords -bool false | |
defaults write com.apple.Safari AutoFillCreditCardData -bool false | |
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false | |
# Warn about fraudulent websites | |
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true | |
# Disable plug-ins | |
defaults write com.apple.Safari WebKitPluginsEnabled -bool false | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false | |
# Disable Java | |
defaults write com.apple.Safari WebKitJavaEnabled -bool false | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false | |
# Block pop-up windows | |
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false | |
# Enable “Do Not Track” | |
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true | |
# Update extensions automatically | |
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true | |
# Hide Spotlight tray-icon (and subsequent helper) | |
#sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search | |
# Disable Spotlight indexing for any volume that gets mounted and has not yet | |
# been indexed before. | |
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. | |
# sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" | |
# Only use UTF-8 in Terminal.app | |
defaults write com.apple.terminal StringEncodings -array 4 | |
# Enable Secure Keyboard Entry in Terminal.app | |
# See: https://security.stackexchange.com/a/47786/8918 | |
defaults write com.apple.terminal SecureKeyboardEntry -bool true | |
# Disable the annoying line marks | |
defaults write com.apple.Terminal ShowLineMarks -int 0 | |
# Don’t display the annoying prompt when quitting iTerm | |
defaults write com.googlecode.iterm2 PromptOnQuit -bool false | |
# Show the main window when launching Activity Monitor | |
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true | |
# Visualize CPU usage in the Activity Monitor Dock icon | |
defaults write com.apple.ActivityMonitor IconType -int 5 | |
# Show all processes in Activity Monitor | |
defaults write com.apple.ActivityMonitor ShowCategory -int 0 | |
# Sort Activity Monitor results by CPU usage | |
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" | |
defaults write com.apple.ActivityMonitor SortDirection -int 0 | |
# Use plain text mode for new TextEdit documents | |
defaults write com.apple.TextEdit RichText -int 0 | |
# Open and save files as UTF-8 in TextEdit | |
defaults write com.apple.TextEdit PlainTextEncoding -int 4 | |
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 | |
# Enable the debug menu in Disk Utility | |
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true | |
defaults write com.apple.DiskUtility advanced-image-options -bool true | |
# Auto-play videos when opened with QuickTime Player | |
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true | |
# Enable the automatic update check | |
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true | |
# Check for software updates daily, not just once per week | |
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 | |
# Download newly available updates in background | |
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 | |
# Install System data files & security updates | |
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 | |
# Automatically download apps purchased on other Macs | |
defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 | |
# Turn on app auto-update | |
defaults write com.apple.commerce AutoUpdate -bool true | |
# Allow the App Store to reboot machine on macOS updates | |
defaults write com.apple.commerce AutoUpdateRestartRequired -bool true | |
# Prevent Photos from opening automatically when devices are plugged in | |
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true | |
# Allow installing user scripts via GitHub Gist or Userscripts.org | |
defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" | |
# Use the system-native print preview dialog | |
defaults write com.google.Chrome DisablePrintPreview -bool true | |
defaults write com.google.Chrome.canary DisablePrintPreview -bool true | |
# Use `~/Documents/Torrents` to store incomplete downloads | |
defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true | |
defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" | |
# Don’t prompt for confirmation before downloading | |
defaults write org.m0k.transmission DownloadAsk -bool false | |
defaults write org.m0k.transmission MagnetOpenAsk -bool false | |
# Trash original torrent files | |
defaults write org.m0k.transmission DeleteOriginalTorrent -bool true | |
# Hide the donate message | |
defaults write org.m0k.transmission WarningDonate -bool false | |
# Hide the legal disclaimer | |
defaults write org.m0k.transmission WarningLegal -bool false | |
# IP block list. | |
# Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ | |
defaults write org.m0k.transmission BlocklistNew -bool true | |
defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" | |
defaults write org.m0k.transmission BlocklistAutoUpdate -bool true | |
# Change default file browser | |
defaults write -g NSFileViewer -string org.yanex.marta | |
############################################################################### | |
# Kill affected applications # | |
############################################################################### | |
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ | |
"Dock" "Finder" "Google Chrome" "Google Chrome Canary" "Mail" "Messages" \ | |
"Opera" "Photos" "Safari" "SizeUp" "Spectacle" "SystemUIServer" "Terminal" \ | |
"Transmission" "Tweetbot" "Twitter" "iCal"; do | |
killall "${app}" &> /dev/null | |
done | |
echo "Done. Note that some of these changes require a logout/restart to take effect." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1/bin/bash | |
# Remove Dock items | |
echo -b 'Setting defaults for Dock...' | |
main() { | |
if type dockutil &>/dev/null; then | |
dockutil --no-restart \ | |
--remove 'System Preferences' \ | |
--remove 'App Store' \ | |
--remove 'Maps' \ | |
--remove 'Notes' \ | |
--remove 'Photos' \ | |
--remove 'Messages' \ | |
--remove 'Contacts' \ | |
--remove 'Calendar' \ | |
--remove 'Reminders'\ | |
--remove 'FaceTime' \ | |
--remove 'Feedback Assistant' \ | |
--remove 'Siri' \ | |
--remove 'Launchpad' \ | |
--remove 'Numbers' \ | |
--remove 'Pages' \ | |
--remove 'Keynote' \ | |
--remove 'iTunes' \ | |
--remove 'iBooks' \ | |
--remove 'Mail' \ | |
--remove 'TV' \ | |
--remove 'News' \ | |
&>/dev/null | |
killall cfprefsd &>/dev/null | |
killall -HUP Dock &>/dev/null | |
else | |
echo 'ERROR: dockutil not found' | |
fi | |
} | |
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ensure path arrays do not contain duplicates. | |
typeset -gU cdpath fpath manpath mailpath path | |
# Language | |
export LANGUAGE=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
export LC_CTYPE=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
# XDG | |
if [[ -z "$XDG_CONFIG_HOME" ]]; then | |
export XDG_CONFIG_HOME="$HOME"/.config | |
fi | |
# Remove delay | |
export KEYTIMEOUT=1 | |
# PAGER | |
export PAGER=less | |
export LESS='-F -g -i -M -R -S -w -X -z-4 -j4' | |
# Set the the list of directories that cd searches. | |
cdpath=( | |
$cdpath | |
) | |
# Set the list of directories that Zsh searches for programs. | |
path=( | |
$HOME/bin | |
${HOMEBREW_PREFIX}/opt/curl/bin(N-/) | |
${HOMEBREW_PREFIX}/opt/openssl@*/bin(Nn[-1]-/) | |
${HOMEBREW_PREFIX}/opt/gnu-sed/libexec/gnubin(N-/) | |
${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin(N-/) | |
${HOMEBREW_PREFIX}/opt/python/libexec/bin(N-/) | |
$HOME/.local/bin | |
$HOME/.gem/ruby/2.6.0/bin | |
$HOME/.config/composer/vendor/bin | |
$HOME/.cargo/bin | |
$HOME/.go | |
/usr/local/{bin,sbin} | |
$path | |
) | |
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig" | |
export LDFLAGS="-L/usr/local/opt/readline/lib" | |
export CPPFLAGS="-I/usr/local/opt/readline/include" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WORDCHARS="*?_-.[]~=&;!#$%^(){}<>" | |
if [[ ! -d ${HOME}/.zplugin ]]; then | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zplugin/master/doc/install.sh)" | |
fi | |
### Added by Zplugin's installer | |
source ~/.zplugin/bin/zplugin.zsh | |
autoload -Uz _zplugin | |
(( ${+_comps} )) && _comps[zplugin]=_zplugin | |
### End of Zplugin's installer chunk | |
export PURE_PROMPT_SYMBOL="🔸" | |
zplugin ice pick"async.zsh" src"pure.zsh" | |
zplugin light sindresorhus/pure | |
# source /Users/langolf/Library/Preferences/org.dystroy.broot/launcher/bash/br | |
#fnm | |
# export PATH=/var/folders/dj/r260cmx91hl6sk8g0mj9bkw00000gp/T/fnm-shell-8673932/bin:$PATH | |
# export FNM_MULTISHELL_PATH=/var/folders/dj/r260cmx91hl6sk8g0mj9bkw00000gp/T/fnm-shell-8673932 | |
# export FNM_DIR=/Users/langolf/.fnm | |
# export FNM_NODE_DIST_MIRROR=https://nodejs.org/dist | |
# export FNM_LOGLEVEL=info | |
zplugin ice silent wait"0a" atload"zpcompinit" | |
zplugin light zsh-users/zsh-completions | |
export HISTORY_SUBSTRING_SEARCH_FUZZY=1 | |
zplugin ice silent wait"0b" | |
zplugin light zsh-users/zsh-history-substring-search | |
zplugin ice silent wait"1b" | |
zplugin light zdharma/fast-syntax-highlighting | |
autoload -Uz compinit promptinit | |
setopt prompt_subst | |
# load colors | |
autoload -U colors && colors | |
# Use case-insensitve globbing. | |
unsetopt case_glob | |
# glob dotfiles as well | |
setopt globdots | |
# use extended globbing | |
setopt extendedglob | |
# Automatically change directory if a directory is entered | |
setopt autocd | |
# Smart URLs | |
autoload -Uz url-quote-magic | |
zle -N self-insert url-quote-magic | |
# Allow brace character class list expansion. | |
setopt brace_ccl | |
# Combine zero-length punctuation characters (accents) with the base character. | |
setopt combining_chars | |
# Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. | |
setopt rc_quotes | |
# Don't print a warning message if a mail file has been accessed. | |
unsetopt mail_warning | |
# | |
# Jobs | |
# | |
# List jobs in the long format by default. | |
setopt long_list_jobs | |
# Attempt to resume existing job before creating a new process. | |
setopt auto_resume | |
# Report status of background jobs immediately. | |
setopt notify | |
# Don't run all background jobs at a lower priority. | |
unsetopt bg_nice | |
# Don't kill jobs on shell exit. | |
unsetopt hup | |
# Don't report on jobs when shell exit. | |
unsetopt check_jobs | |
# turn on corrections | |
setopt correct | |
# Complete from both ends of a word. | |
setopt complete_in_word | |
# Move cursor to the end of a completed word. | |
setopt always_to_end | |
# Perform path search even on command names with slashes. | |
setopt path_dirs | |
# Show completion menu on a successive tab press. | |
setopt auto_menu | |
# Automatically list choices on ambiguous completion. | |
setopt auto_list | |
# If completed parameter is a directory, add a trailing slash. | |
setopt auto_param_slash | |
setopt no_complete_aliases | |
# Do not autoselect the first completion entry. | |
setopt menu_complete | |
# Disable start/stop characters in shell editor. | |
unsetopt flow_control | |
# | |
# completion module options | |
# | |
# group matches and describe. | |
zstyle ':completion:*:*:*:*:*' menu select | |
zstyle ':completion:*:matches' group yes | |
zstyle ':completion:*:options' description yes | |
zstyle ':completion:*:options' auto-description '%d' | |
zstyle ':completion:*:corrections' format '%F{green}-- %d (errors: %e) --%f' | |
zstyle ':completion:*:descriptions' format '%F{yellow}-- %d --%f' | |
zstyle ':completion:*:messages' format '%F{purple}-- %d --%f' | |
zstyle ':completion:*:warnings' format '%F{red}-- no matches found --%f' | |
zstyle ':completion:*' format '%F{yellow}-- %d --%f' | |
zstyle ':completion:*' group-name '' | |
zstyle ':completion:*' verbose yes | |
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' '+r:|?=**' | |
# directories | |
if (( ! ${+LS_COLORS} )); then | |
# Locally use same LS_COLORS definition from utility module, in case it was not set | |
local LS_COLORS='di=1;34:ln=35:so=32:pi=33:ex=31:bd=1;36:cd=1;33:su=30;41:sg=30;46:tw=30;42:ow=30;43' | |
fi | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories | |
zstyle ':completion:*:*:cd:*:directory-stack' menu yes select | |
zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'expand' | |
zstyle ':completion:*' squeeze-slashes true | |
# enable caching | |
zstyle ':completion::complete:*' use-cache on | |
zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-${HOME}}/.zcompcache" | |
# ignore useless commands and functions | |
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec)|prompt_*)' | |
# completion sorting | |
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters | |
# Man | |
zstyle ':completion:*:manuals' separate-sections true | |
zstyle ':completion:*:manuals.(^1*)' insert-sections true | |
# history | |
zstyle ':completion:*:history-words' stop yes | |
zstyle ':completion:*:history-words' remove-all-dups yes | |
zstyle ':completion:*:history-words' list false | |
zstyle ':completion:*:history-words' menu yes | |
# ignore multiple entries. | |
zstyle ':completion:*:(rm|kill|diff):*' ignore-line other | |
zstyle ':completion:*:rm:*' file-patterns '*:all-files' | |
unsetopt beep nomatch | |
# Treat the '!' character specially during expansion. | |
setopt bang_hist | |
# Write to the history file immediately, not when the shell exits. | |
setopt inc_append_history | |
# Share history between all sessions. | |
setopt share_history | |
# Expire a duplicate event first when trimming history. | |
setopt hist_expire_dups_first | |
# Do not record an event that was just recorded again. | |
setopt hist_ignore_dups | |
# Delete an old recorded event if a new event is a duplicate. | |
setopt hist_ignore_all_dups | |
# Do not display a previously found event. | |
setopt hist_find_no_dups | |
# Do not record an event starting with a space. | |
setopt hist_ignore_space | |
# Do not write a duplicate event to the history file. | |
setopt hist_save_no_dups | |
# Do not execute immediately upon history expansion. | |
setopt hist_verify | |
# Show timestamp in history | |
setopt extended_history | |
# Allow command line editing in an external editor. | |
autoload -Uz edit-command-line | |
zle -N edit-command-line | |
DIRSTACKSIZE=20 | |
setopt auto_pushd pushd_silent pushd_to_home | |
# Remove duplicate entries | |
setopt pushd_ignore_dups | |
# This reverts the +/- operators. | |
setopt pushd_minus | |
alias up="source ~/.zshrc" | |
alias v="nvim" | |
alias e=$EDITOR | |
# Badoo sync | |
syncd3() { | |
unrealsync -exclude .git -exclude node_modules -exclude **/node_modules/** -exclude _deploy/node_modules -exclude _deploy/desktopweb/node_modules -exclude _deploy/desktopweb/styleguide/node_modules -exclude _deploy/desktopweb/styleguide-builder -exclude images/-/booking/node_modules /Users/langolf/Work/badoo www1.d3:badoo | |
} | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
typeset -AU __FZF | |
if (( $+commands[fd] )); then | |
__FZF[CMD]='fd --hidden --no-ignore-vcs --exclude ".git" --exclude "node_modules" --exclude ".DS_Store"' | |
__FZF[DEFAULT]="${__FZF[CMD]} --type f" | |
__FZF[ALT_C]="${__FZF[CMD]} --type d ." | |
elif (( $+commands[rg] )); then | |
__FZF[CMD]='rg --no-messages --no-ignore-vcs' | |
__FZF[DEFAULT]="${__FZF[CMD]} --files" | |
else | |
__FZF[DEFAULT]='git ls-tree -r --name-only HEAD || find .' | |
fi | |
export FZF_DEFAULT_COMMAND="${__FZF[DEFAULT]}" | |
export FZF_PREVIEW_COMMAND="bat --style=numbers,changes --wrap never --color always {} || cat {} || tree -C {}" | |
export FZF_CTRL_T_COMMAND="${__FZF[CMD]}" | |
export FZF_ALT_C_COMMAND="${__FZF[ALT_C]}" | |
export FZF_DEFAULT_OPTS="--reverse --tabstop 2 --multi --color=bg+:-1 --bind '?:toggle-preview'" | |
export FZF_CTRL_T_OPTS="--preview '($FZF_PREVIEW_COMMAND) 2> /dev/null' --preview-window down:60%:noborder" | |
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:wrap:hidden --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --header 'Press CTRL-Y to copy command into clipboard'" | |
export FZF_ALT_C_OPTS="--preview 'tree -C {} 2> /dev/null'" | |
fbr() { | |
local branches branch | |
branches=$(git branch --all | grep -v HEAD) && | |
branch=$(echo "$branches" | | |
fzf-tmux -d $((2 + $(wc -l <<<"$branches"))) +m) && | |
git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##") | |
} | |
_fzf_compgen_path() { | |
fd --hidden --follow --exclude ".git" --exclude ".Trash" . "$1" | |
} | |
# Use fd to generate the list for directory completion | |
_fzf_compgen_dir() { | |
fd --type d --hidden --follow --exclude ".git" ".Trash" . "$1" | |
} | |
# Setting fd as the default source for fzf | |
# To apply the command to CTRL-T as well | |
alias chromed='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222' | |
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment