diff --git a/.macos b/.macos deleted file mode 100755 index 676b73a..0000000 --- a/.macos +++ /dev/null @@ -1,525 +0,0 @@ -#!/usr/bin/env bash - -#~/.macos - -# based on paul irish .macos (https://github.com/paulirish/dotfiles/blob/main/.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 `.osx` has finished -while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & - -# General UI/UX # -############################################################################################# - -# Set standby delay to 24 hours (default is 1 hour) -sudo pmset -a standbydelay 86400 - -# Disable the sound effects on boot -sudo nvram SystemAudioVolume=" " - -# disbale transparency menu bar -defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false - -# Disable the you sure you want to open this application dialog -defaults write com.apple.LaunchServices LSQuarantine -bool false - -# 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 - -# Adjust toolbar title rollover delay -defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0 - -# Always show scrollbars -defaults write NSGlobalDomain AppleShowScrollBars -string "Always" - -# Expand save panel by default -defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true -defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true - -# Expand print panel by default -defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true -defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true - -# Automatically quit printer app once the print jobs complete -defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true - -# Disable the “Are you sure you want to open this application?” dialog -defaults write com.apple.LaunchServices LSQuarantine -bool false - -# Remove delay when taking a screenshot -defaults write com.apple.screencapture show-thumbnail -bool false - -# 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 - -# 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 Resume system-wide -defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false - -# Edit: ALLOW automatic termination of inactive apps -defaults write NSGlobalDomain NSDisableAutomaticTermination -bool false - -# Set Help Viewer windows to non-floating mode -defaults write com.apple.helpviewer DevMode -bool true - -# Restart automatically if the computer freezes -sudo systemsetup -setrestartfreeze on - -# go into computer sleep mode after 20min -sudo systemsetup -setcomputersleep 20 - -# Disable smart quotes as they’re annoying when typing code -defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false - -# Disable smart dashes as they’re annoying when typing code -defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false - -# Set date display in menu bar -defaults write com.apple.menuextra.clock "DateFormat" "d MMM EEE H.mm" - -# SSD-specific tweaks # -############################################################################### - -# Disable local Time Machine snapshots -sudo tmutil disablelocal - -# Disable hibernation (speeds up entering sleep mode) -sudo pmset -a hibernatemode 0 - -# Remove the sleep image file to save disk space -sudo rm /private/var/vm/sleepimage -# Create a zero-byte file instead… -sudo touch /private/var/vm/sleepimage -# …and make sure it can’t be rewritten -sudo chflags uchg /private/var/vm/sleepimage - -# Disable the sudden motion sensor as it’s not useful for SSDs -sudo pmset -a sms 0 - -# Trackpad, mouse, keyboard, Bluetooth accessories, and input # -############################################################################################# - -# 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 - -# Trackpad: map bottom right corner to right-click -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 - -# Disable “natural” (Lion-style) scrolling -defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false - -# Increase sound quality for Bluetooth headphones/headsets -defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 - -# mute all sounds, incl volume change feedback -defaults write "com.apple.sound.beep.feedback" -int 0 -defaults write com.apple.systemsound 'com.apple.sound.beep.volume' -float 0 -defaults write "com.apple.systemsound" "com.apple.sound.uiaudio.enabled" -int 0 - -# Enable access for assistive devices -echo -n 'a' | sudo tee /private/var/db/.AccessibilityAPIEnabled > /dev/null 2>&1 -sudo chmod 444 /private/var/db/.AccessibilityAPIEnabled - -# Enable full keyboard access for all controls -# (e.g. enable Tab in modal dialogs) -defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 - -# Use scroll gesture with the Ctrl (^) modifier key to zoom -defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true -defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 -# Follow the keyboard focus while zoomed in -defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool false -# Zoom should use nearest neighbor instead of smoothing. -defaults write com.apple.universalaccess 'closeViewSmoothImages' -bool false - -# Disable press-and-hold for keys in favor of key repeat -defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false - -# Set a blazingly fast keyboard repeat rate -defaults write NSGlobalDomain KeyRepeat -int 1 -defaults write NSGlobalDomain InitialKeyRepeat -int 10 - -# Disable auto-correct -defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false - -# Stop iTunes from responding to the keyboard media keys -launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null - -# Screen # -############################################################################################# - -# Save screenshots to the desktop -defaults write com.apple.screencapture location -string "${HOME}/Pictures/Screenshots" - -# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) -defaults write com.apple.screencapture type -string "jpg" - -# Disable shadow in screenshots -defaults write com.apple.screencapture disable-shadow -bool true - -# 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 - -# Finder # -############################################################################################# - -# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons -defaults write com.apple.finder QuitMenuItem -bool true - -# Finder: disable window animations and Get Info animations -defaults write com.apple.finder DisableAllAnimations -bool true - -# Finder: show all filename extensions -defaults write NSGlobalDomain AppleShowAllExtensions -bool true - -# Disable the warning when changing a file extension -defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false - -# Finder: show path bar -defaults write com.apple.finder ShowPathbar -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 - -# Show status bar -defaults write com.apple.finder ShowStatusBar -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 - -# Automatically open a new Finder window when a volume is mounted -defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true -defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true -defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true - -# Increase grid spacing for icons on the desktop and in other icon views -/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist - -# Increase the size of icons on the desktop and in other icon views -/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist - -# 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" - -# Empty Trash securely by default -defaults write com.apple.finder EmptyTrashSecurely -bool true - -# Disable the warning before emptying the Trash -defaults write com.apple.finder WarnOnEmptyTrash -bool false - -# 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 - -# Dock, Dashboard, and hot corners -############################################################################################# - -# Enable highlight hover effect for the grid view of a stack (Dock) -defaults write com.apple.dock mouse-over-hilite-stack -bool true - -# Set the icon size of Dock items to 40 pixels -defaults write com.apple.dock tilesize -int 25 - -# Change minimize/maximize window effect -defaults write com.apple.dock mineffect -string "scale" - -# Minimize windows into their application’s icon -defaults write com.apple.dock minimize-to-application -bool false - -# Enable spring loading for all Dock items -defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true - -# Speed up Mission Control animations -defaults write com.apple.dock expose-animation-duration -float 0.1 - -# Don’t group windows by application in Mission Control -# (i.e. use the old Exposé behavior instead) -defaults write com.apple.dock expose-group-by-app -bool false - -# Show indicator lights for open applications in the Dock -defaults write com.apple.dock show-process-indicators -bool false - -# Don't animate opening applications from the Dock -defaults write com.apple.dock launchanim -bool false - -# Disable Dashboard -defaults write com.apple.dashboard mcx-disabled -bool true - -# Don't show Dashboard as a Space -defaults write com.apple.dock dashboard-in-overlay -bool true - -# Don’t automatically rearrange Spaces based on most recent use -defaults write com.apple.dock mru-spaces -bool false - -# 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 - -# Don't make Dock icons of hidden applications translucent -defaults write com.apple.dock showhidden -bool false - -# Hide 'recent applications' from dock -defaults write com.apple.dock show-recents -bool false - -# Reset Launchpad, but keep the desktop wallpaper intact -find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete - -# Hot corners -# Possible values: -# 0: no-op -# 2: Mission Control -# 3: Show application windows -# 4: Desktop -# 5: Start screen saver -# 6: Disable screen saver -# 7: Dashboard -# 10: Put display to sleep -# 11: Launchpad -# 12: Notification Center - -# Top left screen corner → Put to sleep -defaults write com.apple.dock wvous-tl-corner -int 0 -defaults write com.apple.dock wvous-tl-modifier -int 0 -# Top right screen corner → no-op -defaults write com.apple.dock wvous-tr-corner -int 1 -defaults write com.apple.dock wvous-tr-modifier -int 1048576 -# Bottom left screen corner → no-op -defaults write com.apple.dock wvous-bl-corner -int 1 -defaults write com.apple.dock wvous-bl-modifier -int 1048576 -# Bottom right screen corner → no-op -defaults write com.apple.dock wvous-br-corner -int 1 -defaults write com.apple.dock wvous-br-modifier -int 1048576 - -# Safari & WebKit # -############################################################################################# - -# 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 -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 - -# Show Safari's bookmarks bar by default -defaults write com.apple.Safari ShowFavoritesBar -bool true - -# 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 - -# 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 - -# Remove useless icons from Safari’s bookmarks bar -defaults write com.apple.Safari ProxiesInBookmarksBar "()" - -# Add a context menu item for showing the Web Inspector in web views -defaults write NSGlobalDomain WebKitDeveloperExtras -bool true - -# Do not open previous previewed files (e.g. PDFs) when opening a new one -defaults write com.apple.Preview ApplePersistenceIgnoreState YES - -# Spotlight # -############################################################################################# - -# 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" - -# Disable CMD+space for spotlight -/usr/libexec/PlistBuddy ~/Library/Preferences/com.apple.symbolichotkeys.plist -c "Set AppleSymbolicHotKeys:64:enabled false" - -# Time Machine # -############################################################################### - -# Prevent Time Machine from prompting to use new hard drives as backup volume -defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true - -# Disable local Time Machine backups -hash tmutil &> /dev/null && sudo tmutil disablelocal - -# TextEdit and QuickTimePlayer # -############################################################################### - -# 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 - -# Auto-play videos when opened with QuickTime Player -defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true - -# Mac App Store # -############################################################################### - -# Enable the WebKit Developer Tools in the Mac App Store -defaults write com.apple.appstore WebKitDeveloperExtras -bool true - -# Enable Debug Menu in the Mac App Store -defaults write com.apple.appstore ShowDebugMenu -bool true - -# Photos # -############################################################################### - -# Prevent Photos from opening automatically when devices are plugged in -defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true - -# Messages # -############################################################################### - -# Disable automatic emoji substitution (i.e. use plain text smileys) -defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false - -# Disable smart quotes as it’s annoying for messages that contain code -defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false - -# Disable continuous spell checking -defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false - -# Transmission.app # -############################################################################### - -# 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 - - -# Activity Monitor # -############################################################################### - -# 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 - -# Sets columns for all tabs -defaults read com.apple.ActivityMonitor "UserColumnsPerTab v5.0" -dict \ - '0' '( Command, CPUUsage, CPUTime, Threads, PID, UID, Ports )' \ - '1' '( Command, ResidentSize, Threads, Ports, PID, UID, )' \ - '2' '( Command, PowerScore, 12HRPower, AppSleep, UID, powerAssertion )' \ - '3' '( Command, bytesWritten, bytesRead, Architecture, PID, UID, CPUUsage )' \ - '4' '( Command, txBytes, rxBytes, PID, UID, txPackets, rxPackets, CPUUsage )' - -# Set sort column -defaults write com.apple.ActivityMonitor UserColumnSortPerTab -dict \ - '0' '{ direction = 0; sort = CPUUsage; }' \ - '1' '{ direction = 0; sort = ResidentSize; }' \ - '2' '{ direction = 0; sort = 12HRPower; }' \ - '3' '{ direction = 0; sort = bytesWritten; }' \ - '4' '{ direction = 0; sort = rxBytes; }' -defaults write com.apple.ActivityMonitor SortDirection -int 0 - -# Show Data in the Disk graph (instead of IO) -defaults write com.apple.ActivityMonitor DiskGraphType -int 1 - -# Show Data in the Network graph (instead of packets) -defaults write com.apple.ActivityMonitor NetworkGraphType -int 1 - -# Kill all application # -############################################################################################# - -/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u - -for app in "Activity Monitor" "Calendar" "Contacts" "cfprefsd" \ - "Dock" "Finder" "Messages" "Photos" \ - "Safari" "Firefox" "Floorp" "SystemUIServer" \ - "Terminal" "Transmission" "Raycast"; do - killall "${app}" &> /dev/null -done - -echo "Done. Note that some of these changes require a logout/restart to take effect." diff --git a/Brewfile b/Brewfile index 73c00c7..38f4dd7 100644 --- a/Brewfile +++ b/Brewfile @@ -1,6 +1,4 @@ -tap "espanso/espanso" tap "homebrew/bundle" -tap "localsend/localsend" brew "xz" brew "zstd" brew "libtiff" @@ -9,11 +7,8 @@ brew "c-ares" brew "icu4c@76" brew "libuv" brew "openssl@3" -brew "node" -brew "bitwarden-cli" brew "gettext" brew "glib" -brew "duti" brew "sqlite" brew "gh" brew "git" @@ -30,72 +25,3 @@ brew "pyenv" brew "python-argcomplete" brew "qemu" brew "yarn" -cask "alt-tab" -cask "balenaetcher" -cask "bitwarden" -cask "espanso" -cask "ghostty" -cask "latest" -cask "localsend" -cask "mark-text" -cask "monitorcontrol" -cask "notion-calendar" -cask "notunes" -cask "numi" -cask "pearcleaner" -cask "shottr" -cask "stats" -cask "warp" -cask "yaak" -vscode "aaron-bond.better-comments" -vscode "alefragnani.project-manager" -vscode "bradlc.vscode-tailwindcss" -vscode "christian-kohler.npm-intellisense" -vscode "christian-kohler.path-intellisense" -vscode "chrmarti.regex" -vscode "davidanson.vscode-markdownlint" -vscode "dbaeumer.vscode-eslint" -vscode "denoland.vscode-deno" -vscode "dracula-theme.theme-dracula" -vscode "dsznajder.es7-react-js-snippets" -vscode "editorconfig.editorconfig" -vscode "emmanuelbeziat.vscode-great-icons" -vscode "esbenp.prettier-vscode" -vscode "formulahendry.auto-close-tag" -vscode "formulahendry.auto-rename-tag" -vscode "github.copilot" -vscode "github.copilot-chat" -vscode "github.copilot-workspace" -vscode "github.vscode-github-actions" -vscode "github.vscode-pull-request-github" -vscode "gruntfuggly.todo-tree" -vscode "hashicorp.terraform" -vscode "hbenl.vscode-test-explorer" -vscode "idered.npm" -vscode "maxvanderschee.web-accessibility" -vscode "meganrogge.template-string-converter" -vscode "mikestead.dotenv" -vscode "ms-azuretools.vscode-docker" -vscode "ms-vscode-remote.remote-containers" -vscode "ms-vscode.live-server" -vscode "ms-vscode.test-adapter-converter" -vscode "ms-vsliveshare.vsliveshare" -vscode "mylesmurphy.prettify-ts" -vscode "nicoespeon.abracadabra" -vscode "orta.vscode-jest" -vscode "philnash.ngrok-for-vscode" -vscode "pwabuilder.pwa-studio" -vscode "quicktype.quicktype" -vscode "ritwickdey.liveserver" -vscode "saoudrizwan.claude-dev" -vscode "sburg.vscode-javascript-booster" -vscode "sleistner.vscode-fileutils" -vscode "sonarsource.sonarlint-vscode" -vscode "stevencl.adddoccomments" -vscode "stylelint.vscode-stylelint" -vscode "visualstudioexptteam.intellicode-api-usage-examples" -vscode "visualstudioexptteam.vscodeintellicode" -vscode "wayou.vscode-todo-highlight" -vscode "wmaurer.change-case" -vscode "xabikos.javascriptsnippets" -vscode "yoavbls.pretty-ts-errors" diff --git a/README.md b/README.md index bb4fb9a..b695b53 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,23 @@ # dotfiles -Hey! 👋 - -This repo stores my personal app configs and customizations. I mainly use zsh, but you can adapt for bash or other shells. -Since I work with macOS and Ubuntu, configs are optimized for these OSs. But no worries - you can easily tweak them for other systems too! - -## Usage - +This is my dotfiles for personal app configs and customizations. I mainly use zsh, but you might adapt for bash or other shells. This repo is 100% open for you to explore and customize. Just clone it and swap my configs with yours - makes it super easy to get your dev environment up and running on any new machine. -## Getting Started +## How to use -1. Clone this repository to your local machine: +1. Clone this repository: ```bash git clone git@github.com:tcelestino/dotfiles.git ``` -2. Open folder `dotfiles` and set run file to install +2. Checkout the branch you want to use: `macos` or `ubuntu` ```bash -chmod +x install +git checkout ``` -3. Open `.zshrc` file and change variables "USER_NAME", "USER_EMAIL" and "NPM_SCOPE". You might set `GH_TOKEN` and `NPM_TOKEN` too. -```bash +3. Open `.zshrc` file and set config options for variables `USER_NAME`, `USER_EMAIL` and `NPM_SCOPE`. You might set `GH_TOKEN` and `NPM_TOKEN` too. 4. Run the install script @@ -33,10 +26,41 @@ chmod +x install ``` ⚠️ **Don't forget to set values `GH_TOKEN` and `NPM_TOKEN`!!** +## My Apps + +This is my list of apps and tools that I use. + +### Apps + +| Name | Description | Download URL | +|--------------|-------------------------------------------------------------|---------------------------------------------------------------| +| Terminator | Multi-monitor terminal for Linux | [https://gnome-terminator.org/](https://gnome-terminator.org/) | +| Ulauncher | Spotlight for Linux | [https://ulauncher.io/](https://ulauncher.io/) | +| VSCode | Code editor | [https://code.visualstudio.com/](https://code.visualstudio.com/) | +| Cursor | AI-powered code editor | [https://www.cursor.com/](https://www.cursor.com/) | +| Firefox | Web browser | [https://www.firefox.com/](https://www.firefox.com/) | +| Beekeeper Studio | Database management tool | [https://www.beekeeperstudio.io/](https://www.beekeeperstudio.io/) | + +### Development tools + +| Name | Description | Download URL | +|--------------|-------------------------------------------------------------|-----------------------------------------------------------------| +| Node.js | JavaScript runtime for application development | [https://nodejs.org/](https://nodejs.org/) | +| Yarn | Fast and reliable package manager for Node.js | [https://yarnpkg.com/](https://yarnpkg.com/) | +| Git | Distributed version control system | [https://git-scm.com/](https://git-scm.com/) | + +### NPM packages + +| Name | Description | Download URL | +|--------------|-------------------------------------------------------------|---------------------------------------------------------------| +| fastify-cli | CLI for Fastify framework | [https://www.fastify.io/](https://www.fastify.io/) | +| npm-check-updates | Tool to update npm dependencies | [https://www.npmjs.com/package/npm-check-updates](https://www.npmjs.com/package/npm-check-updates) | +| git-cz | Tool for conventional commits | [https://www.npmjs.com/package/git-cz](https://www.npmjs.com/package/git-cz) | +| @nestjs/cli | NestJS Command Line Interface | [https://docs.nestjs.com/](https://docs.nestjs.com/) | + ## Additional Configurations -- To set the keyboard layout to include the 'ç' character on Ubuntu, follow the steps in the article "[Ajeitando o cedilha errado (ć) no Ubuntu Linux](https://www.danielkossmann.com/pt/ajeitando-cedilha-errado-ubuntu-linux/)" -- If you use iTerm2, you might import the color scheme and other configurations into iTerm2. The settings can be found in the "iterm2" folder. +- To set the keyboard layout to include the 'ç' character on Ubuntu, follow the steps in the article "[Fixing the wrong cedilla (ć) in Ubuntu Linux](https://www.danielkossmann.com/pt/ajeitando-cedilha-errado-ubuntu-linux/)" ## Contributing diff --git a/git/.git-commit-template b/git/.git-commit-template new file mode 100644 index 0000000..02d0a4c --- /dev/null +++ b/git/.git-commit-template @@ -0,0 +1,17 @@ +# Title (maximum 50 characters) +# +# Briefly and imperatively describe the change made + +# Blank line + +# Message body (maximum 72 characters per line) +# +# Explain what and why, not just how. If necessary, provide context, +# motivations, and the impact of the change. Use as many lines as needed. + +# Blank line + +# Footer (optional) +# +# Reference issues, pull requests, or breaking changes, if applicable. +# Example: Closes #123, Related to #456 diff --git a/git/.gitconfig b/git/.gitconfig index c0e34c6..532d94f 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -1,20 +1,23 @@ -# This is Git's per-user configuration file. - [user] - name = "" - email = "" + name = "" # e.g. Tiago Celestino + email = "" # e.g. your.email@provider.com [mergetool] keepBackup = true [core] - editor = vim + editor = $EDITOR excludesfile = ~/.gitignore attributesfile = ~/.gitattributes [init] defaultBranch = main +[push] + autoSetupRemote = true + +[commit] + template = ~/.git-commit-template [alias] ci = commit @@ -33,10 +36,10 @@ fu = fetch origin pum = pull origin master pumn = pull origin main - pud = pull origin dev + pud = pull origin develop fupum = !git co master && git fu && git pum fupumn = !git co main && git fu && git pumn - fupud = !git co dev && git fu && git pud + fupud = !git co develop && git fu && git pud rb = "!f() { \ branch=\"$(git branch 2>/dev/null | grep \\* | awk '{ print $2 }')\" && \ if git rev-parse --verify master >/dev/null 2>&1; then \ diff --git a/install b/install old mode 100644 new mode 100755 index 0b7a3ac..1eaf327 --- a/install +++ b/install @@ -10,23 +10,29 @@ NC='\033[0m' # Get current location DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -# Helper function to print info messages +# Array to store completed steps +declare -a completed_steps=() + +# Register a completed step +# @param $1 Step name +register_completed_step() { + local step="$1" + completed_steps+=("$step") +} + +# Print info messages +# @param $1 Message log() { echo -e "${GREEN}[INFO]${NC} $1" } -# Helper function to print error messages in red and exit +# Print error messages in red and exit +# @param $1 Message error() { echo -e "${RED}[ERROR]${NC} $1" exit 1 } -# Verify if required dependencies (Node.js, Homebrew, Git) are installed -# check_dependencies() { -# command -v node >/dev/null 2>&1 || error "Node.js is required but not installed. https://nodejs.org/" -# command -v git >/dev/null 2>&1 || error "Git is required but not installed. https://git-scm.com/downloads" -# } - # Create a symbolic link # @param $1 Source file path # @param $2 Destination link path @@ -91,134 +97,232 @@ copy_file() { fi } -# Install Homebrew if not already installed +# Install Homebrew install_brew() { - if ! command -v brew >/dev/null 2>&1; then - log "Installing Homebrew..." - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - else + if command -v brew >/dev/null 2>&1; then log "Homebrew is already installed." + register_completed_step "Homebrew (already installed)" + return fi + + log "Installing Homebrew..." + if ! /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; then + error "Failed to install Homebrew" + fi + + register_completed_step "Homebrew" + log "Homebrew installed successfully!" } -# Install Oh My Zsh if not already installed +# Install zsh +install_zsh() { + if command -v zsh >/dev/null 2>&1; then + log "zsh is already installed." + register_completed_step "zsh (already installed)" + return + fi + log "Updating package list..." + if ! sudo apt update; then + error "Failed to update package list (apt update)" + fi + log "Installing zsh..." + if ! sudo apt install -y zsh; then + error "Failed to install zsh" + fi + register_completed_step "zsh" + log "zsh installed successfully!" +} + +# Install oh-my-zsh install_oh_my_zsh() { if [ -d "$HOME/.oh-my-zsh" ]; then - log "oh-my-zsh is already installed." - else - log "Installing oh-my-zsh..." - if ! sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"; then - error "Failed to install oh-my-zsh" - fi + log "oh-my-zsh is already installed." + register_completed_step "oh-my-zsh (already installed)" + return fi + + log "Installing oh-my-zsh..." + + # Download the install script to a temporary file + local temp_script=$(mktemp) + if ! curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -o "$temp_script"; then + error "Failed to download oh-my-zsh install script" + fi + + # Make the script executable and run it + chmod +x "$temp_script" + if ! bash "$temp_script" --unattended; then + rm -f "$temp_script" + error "Failed to install oh-my-zsh" + fi + + # Clean up the temporary script + rm -f "$temp_script" + + register_completed_step "oh-my-zsh" + log "oh-my-zsh installed successfully!" } -# Install Deno runtime if not already installed +# Install Deno runtime install_deno() { - if [ -d "$HOME/.deno/bin/deno" ]; then + if [ -f "$HOME/.deno/bin/deno" ] || command -v deno >/dev/null 2>&1; then log "Deno is already installed.." + register_completed_step "Deno (already installed)" + return else log "Installing Deno" if ! sh -c "$(curl -fsSL https://deno.land/install.sh)"; then error "Failed to install Deno" fi + register_completed_step "Deno" + log "Deno installed successfully!" fi } -# Configure Git settings by linking gitconfig file +# Configure Git settings setup_git() { copy_file "$DIR/git/.gitconfig" "$HOME/.gitconfig" copy_file "$DIR/git/.gitignore" "$HOME/.gitignore" copy_file "$DIR/git/.gitattributes" "$HOME/.gitattributes" + copy_file "$DIR/git/.git-commit-template" "$HOME/.git-commit-template" + register_completed_step "Git" + log "Git configured successfully!" } -# Configure Zsh settings by linking various configuration files +# Configure Zsh settings setup_zsh() { copy_file "$DIR/zsh/.zshrc" "$HOME/.zshrc" copy_dir "$DIR/zsh/themes" "$HOME/.oh-my-zsh/themes" copy_file "$DIR/zsh/aliases.zsh" "$HOME/.oh-my-zsh/custom/aliases.zsh" copy_dir "$DIR/zsh/custom-functions" "$HOME/.oh-my-zsh/plugins/custom-functions" + + register_completed_step "Zsh" + log "Zsh configured successfully!" } -# Install global NPM packages required for development -install_global_npm_pkg() { - log "Installing global npm packages..." - npm install -g git-cz # https://github.com/streamich/git-cz - npm install -g n # https://github.com/tj/n - npm install -g fastify-cli #https://fastify.dev/ +# Configure Homebrew and install packages from Brewfile +setup_brew() { + copy_file "$DIR/Brewfile" "$HOME/Brewfile" + log "Executing brew bundle install..." + if ! brew bundle install; then + error "Brew bundle install failed" + fi + register_completed_step "Homebrew" + log "Homebrew configured successfully!" } -# Configure NPM settings and install global packages +# NPM Settings setup_npm() { copy_file "$DIR/.npmrc" "$HOME/.npmrc" + register_completed_step "NPM" + log "NPM configured successfully!" # Install npm globally without sudo. Based on https://github.com/sindresorhus/guides/blob/main/npm-global-without-sudo.md if [ -d "$HOME/.npm-packages" ]; then log ".npm-packages folder exists" + return else mkdir -p "$HOME/.npm-packages" fi - - install_global_npm_pkg -} - -# Configure Homebrew and install packages from Brewfile -setup_brew() { - copy_file "$DIR/Brewfile" "$HOME/Brewfile" - log "Executing brew bundle install..." - if ! brew bundle install; then - error "Brew bundle install failed" - fi } -# Install custom fonts based on the operating system +# Set my favorite custom fonts setup_fonts() { - if [[ "$OSTYPE" == "darwin"* ]]; then - # macOS - local font_dir="$HOME/Library/Fonts" - if [ ! -d "$font_dir" ]; then - mkdir -p "$font_dir" - fi - log "Installing fonts for macOS..." - cp "$DIR/extras/fonts/"* "$font_dir/" - elif [[ "$OSTYPE" == "linux-gnu"* ]]; then - # Ubuntu/Linux - local font_dir="$HOME/.local/share/fonts" - if [ ! -d "$font_dir" ]; then - mkdir -p "$font_dir" - fi - log "Installing fonts for Linux..." - cp "$DIR/extras/fonts/"* "$font_dir/" - fc-cache -f -v - else - error "Unsupported operating system" + local font_dir="$HOME/.local/share/fonts" + if [ ! -d "$font_dir" ]; then + mkdir -p "$font_dir" fi + copy_dir "$DIR/extras/fonts" "$font_dir" + log "Installing fonts for Linux..." + fc-cache -f -v + + register_completed_step "Fonts" + log "Fonts installed successfully!" } -# Configure macOS system settings if running on macOS -setup_macos() { - if [[ "$OSTYPE" == "darwin"* ]]; then - log "Setting up macOS..." - sh .macos - copy_file "$DIR/extras/duti_picview.config" "$HOME/duti_picview.config" # Configure duti (macOS default application manager) settings - fi +ask_continue() { + local message="$1" + local step="$2" + echo -e "\n${GREEN}[INFO]${NC} Step $step: $message" + echo -e "${GREEN}[INFO]${NC} Options:" + echo -e " ${GREEN}[y]${NC} - Yes, continue" + echo -e " ${GREEN}[n]${NC} - No, skip this step" + echo -e " ${GREEN}[q]${NC} - Exit installation" + read -p "Your choice (y/n/q): " response + + case "$response" in + [Yy]*) + return 0 + ;; + [Nn]*) + log "Step $step skipped." + return 1 + ;; + [Qq]*) + log "Installation interrupted by user." + exit 0 + ;; + *) + log "Invalid option. Please try again." + ask_continue "$message" "$step" + ;; + esac } main() { log "Starting installation from $DIR..." + log "This script will configure your environment with the following steps:" + echo "1. Install zsh" + echo "2. Install oh-my-zsh" + echo "3. Install Homebrew" + echo "4. Install Deno" + echo "5. Configure Zsh" + echo "6. Configure Homebrew and install packages" + echo "7. Configure Git" + echo "8. Configure NPM" + echo "9. Configure the fonts" + + if ask_continue "Install zsh" "1"; then + install_zsh + fi - install_oh_my_zsh - install_brew - install_deno + if ask_continue "Install oh-my-zsh" "2"; then + install_oh_my_zsh + fi + + if ask_continue "Install Homebrew" "3"; then + install_brew + fi + + if ask_continue "Install Deno" "4"; then + install_deno + fi + + if ask_continue "Configure Zsh" "5"; then + setup_zsh + fi - setup_zsh - setup_brew - setup_git - setup_npm - setup_macos - setup_fonts + if ask_continue "Configure Homebrew and install packages" "6"; then + setup_brew + fi + + if ask_continue "Configure Git" "7"; then + setup_git + fi + + if ask_continue "Configure NPM" "8"; then + setup_npm + fi + + if ask_continue "Configure the fonts" "9"; then + setup_fonts + fi - log "Settings completed successfully! 🎉" + log "Configurations completed successfully! 🎉" + log "Steps executed:" + for step in "${completed_steps[@]}"; do + echo "- $step" + done } main "$@" diff --git a/iterm2/Dracula.itermcolors b/iterm2/Dracula.itermcolors deleted file mode 100644 index 619da48..0000000 --- a/iterm2/Dracula.itermcolors +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - Ansi 0 Color - - Blue Component - 0.0 - Green Component - 0.0 - Red Component - 0.0 - - Ansi 1 Color - - Blue Component - 0.3333333432674408 - Green Component - 0.3333333432674408 - Red Component - 1 - - Ansi 10 Color - - Blue Component - 0.4823529411764706 - Green Component - 0.98039215686274506 - Red Component - 0.31372549019607843 - - Ansi 11 Color - - Blue Component - 0.5490196078431373 - Green Component - 0.98039215686274506 - Red Component - 0.94509803921568625 - - Ansi 12 Color - - Blue Component - 0.97647058823529409 - Green Component - 0.57647058823529407 - Red Component - 0.74117647058823533 - - Ansi 13 Color - - Blue Component - 0.77647058823529413 - Green Component - 0.47450980392156861 - Red Component - 1 - - Ansi 14 Color - - Blue Component - 0.99215686274509807 - Green Component - 0.9137254901960784 - Red Component - 0.54509803921568623 - - Ansi 15 Color - - Blue Component - 1 - Green Component - 1 - Red Component - 1 - - Ansi 2 Color - - Blue Component - 0.4823529411764706 - Green Component - 0.98039215686274506 - Red Component - 0.31372549019607843 - - Ansi 3 Color - - Blue Component - 0.5490196078431373 - Green Component - 0.98039215686274506 - Red Component - 0.94509803921568625 - - Ansi 4 Color - - Blue Component - 0.97647058823529409 - Green Component - 0.57647058823529407 - Red Component - 0.74117647058823533 - - Ansi 5 Color - - Blue Component - 0.77647058823529413 - Green Component - 0.47450980392156861 - Red Component - 1 - - Ansi 6 Color - - Blue Component - 0.99215686274509807 - Green Component - 0.9137254901960784 - Red Component - 0.54509803921568623 - - Ansi 7 Color - - Blue Component - 0.73333334922790527 - Green Component - 0.73333334922790527 - Red Component - 0.73333334922790527 - - Ansi 8 Color - - Blue Component - 0.33333333333333331 - Green Component - 0.33333333333333331 - Red Component - 0.33333333333333331 - - Ansi 9 Color - - Blue Component - 0.33333333333333331 - Green Component - 0.33333333333333331 - Red Component - 1 - - Background Color - - Blue Component - 0.15977837145328522 - Green Component - 0.12215272337198257 - Red Component - 0.11765811592340469 - - Bold Color - - Blue Component - 0.90237069129943848 - Green Component - 0.90237069129943848 - Red Component - 0.90237069129943848 - - Cursor Color - - Blue Component - 0.73333334922790527 - Green Component - 0.73333334922790527 - Red Component - 0.73333334922790527 - - Cursor Text Color - - Blue Component - 1 - Green Component - 1 - Red Component - 1 - - Foreground Color - - Blue Component - 0.90032327175140381 - Green Component - 0.90032327175140381 - Red Component - 0.90032327175140381 - - Selected Text Color - - Blue Component - 1 - Green Component - 1 - Red Component - 1 - - Selection Color - - Blue Component - 0.35294118523597717 - Green Component - 0.27843138575553894 - Red Component - 0.26666668057441711 - - - diff --git a/zsh/.zshrc b/zsh/.zshrc index aaa73cc..dd29518 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -2,28 +2,33 @@ export ZSH=$HOME/.oh-my-zsh ZSH_THEME="dracula" -plugins=(alias-finder brew copypath copyfile deno dotenv docker docker-compose extract history iterm2 git macos npm python vscode web-search yarn custom-functions) - +plugins=(brew copypath copyfile custom-functions deno docker docker-compose extract git history npm python vscode web-search yarn) # global -#export JAVA_HOME="$(/usr/libexec/java_home -v 1.$JAVA_VERSION)" # enable this if you are using java export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" -export PATH=/usr/share/maven/bin:$PATH export PATH=$HOME/local/bin:$PATH -export PATH=$HOME/mongodb/bin:$PATH -export PATH=$PATH:~/.composer/vendor/bin -export PATH="/opt/homebrew/bin:$PATH" # brew on Apple Silicon -export PATH="/usr/local/bin:$PATH" # brew on Intel export NPM_PACKAGES="${HOME}/.npm-packages" export PATH="$NPM_PACKAGES/bin:$PATH" export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" -export GH_TOKEN="" # create token at https://github.com/settings/apps select "Personal access tokens" -export NPM_TOKEN="" +#export JAVA_HOME="$(/usr/libexec/java_home -v 1.$JAVA_VERSION)" # enable this if you are using java +#export PATH=/usr/share/maven/bin:$PATH # enable this if you are using maven +#export PATH=$HOME/mongodb/bin:$PATH # enable this if you are using mongodb +#export PATH=$PATH:~/.composer/vendor/bin # enable this if you are using composer + +# github +export GH_TOKEN="" # create token at https://github.com/settings/apps select "Personal access tokens" + +# ssh +export SSH_KEY_PATH="~/.ssh/id_ed25519" + +# node and npm export NODE_ENV="development" -export SSH_KEY_PATH="~/.ssh/id_ed" # set your ssh key path -export USER_NAME="" -export USER_EMAIL="" -export NPM_SCOPE=${USER:-your_username} # e.g. tcelestino +export NPM_TOKEN="" # create token at https://www.npmjs.com/settings/tokens +export NPM_SCOPE="" # e.g. tcelestino + +# local +export USER_NAME="" # e.g. tcelestino +export USER_EMAIL="" # e.g. your.email@provider.com # preferred editor for local and remote sessions if [[ -n $SSH_CONNECTION ]]; then @@ -38,4 +43,10 @@ ZSH_WEB_SEARCH_ENGINES=( linkedin "https://www.linkedin.com/search/results/all/?keywords=" ) +# deno settings +. "$HOME/.deno/env" + +# homebrew +eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + source $ZSH/oh-my-zsh.sh diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index de74613..40e359c 100755 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,16 +1,15 @@ # oh-my-zsh alias zshconfig="$EDITOR ~/.zshrc" alias ohmyzsh="$EDITOR ~/.oh-my-zsh" -alias reload="omz reload" # reload oh-my-zsh -alias zsh-alias="$EDITOR ~/.oh-my-zsh/custom/aliases.zsh" +alias reload="omz reload" +alias custom-alias="$EDITOR ~/.oh-my-zsh/custom/aliases.zsh" # local development -alias server="python -m SimpleHTTPServer" +alias server="python3 -m http.server" alias serveo="ssh -R 80:localhost:3000 serveo.net" -alias redis-start="/opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf" #start redis # https://paulbrowne.xyz/https-localhost -alias https-server='http-server --ssl --cert ~/.ssl/localhost.crt --key ~/.ssl/localhost.key -a localhost -o' +alias https-server="http-server --ssl --cert ~/.ssl/localhost.crt --key ~/.ssl/localhost.key -a localhost -o" # npm alias npm-i='npm install' @@ -22,51 +21,45 @@ alias npm-test='npm test' alias npm-it='npm install && npm test' alias npm-lk='npm link' alias npm-run='npm run' -alias npm-reset='rm -rf node_modules && rm -f package-lock.json && npm install && npx node-notifier-cli -t "Done" -m "npm modules reinstalled" -s Glass -i https://cdn.rawgit.com/npm/logos/31945b5c/npm%20square/n-64.png' alias npm-ri='rm -rf node_modules && npm i' +alias npm-reset='rm -rf node_modules && rm -f package-lock.json && npm install && npx node-notifier-cli -t "Done" -m "npm modules reinstalled" -s Glass -i https://cdn.rawgit.com/npm/logos/31945b5c/npm%20square/n-64.png' -# git +# git-cz alias commit="git-cz --disable-emoji" alias commitall="git add . && git-cz --disable-emoji" -# mac -alias shutdown="sudo shutdown -h now" -alias hosts="sudo $EDITOR /etc/hosts" -alias dns_clear="dscacheutil -flushcache" - # directory -alias downloads='cd ~/Downloads/' -alias projects='cd ~/Projects/' -alias work='cd ~/work' +alias downloads="cd ~/Downloads" +alias work=workFolder # mv, rm, cp -alias mv='mv -v' -alias rm='rm -i -v' -alias cp='cp -v' +alias mv="mv -v" +alias rm="rm -i -v" +alias cp="cp -v" alias rd="rmdir" alias del="rm -i" -alias cl="clear" -alias -- -="cd -" - # docker -alias dockercleand='docker rmi $(docker images -q)' # delete all images -alias dockercleanu='docker rmi $(docker images -q -f dangling=true)' # delete all untagged images -alias dockercleans='docker rm $(docker ps -a -q)' # delete all stopped images -alias dockerstop='docker stop $(docker ps -aq)' # stop all container -alias dcu='docker-compose up' #start with docker-composer -alias dcd='docker-compose down' #stop with docker-composer -alias dcr='docker-compose restart' #restart with docker-composer -alias dcb='docker-compose build' #build with docker-composer -alias dcl='docker-compose logs' #logs with docker-composer -alias dcp='docker-compose -f docker-compose.dependencies.yaml up -d' #start dependencies with docker-composer -alias docker_hostclean='export DOCKER_HOST=' # clean DOCKER_HOST +alias docker-rmi="docker rmi $(docker images -q)" # delete all images +alias docker-rmiu="docker rmi $(docker images -q -f dangling=true)" # delete all untagged images +alias docker-rmus="docker rm $(docker ps -a -q)" # delete all stopped images +alias docker-stop="docker stop $(docker ps -aq)" # stop all container +alias docker-ch="export DOCKER_HOST=" + +# docker-compose +alias dcu="docker-compose up" #start with docker-compose +alias dcd="docker-compose down" #stop with docker-compose +alias dcdv="docker-compose down -v" #stop with docker-compose and remove volumes +alias dcr="docker-compose restart" #restart with docker-compose +alias dcb="docker-compose build" #build with docker-compose +alias dcl="docker-compose logs" #logs with docker-compose +alias dcp="docker-compose -f docker-compose.dependencies.yaml up -d" #start dependencies with docker-compose -alias fs="stat -f \"%z bytes\"" -alias chmox='chmod -x' +# utils +alias fs="stat -c "%s bytes"" +alias chmox="chmod -x" alias where=which alias killnode="killall -9 node" - -alias checkport=checkPort # use my zsh custom plugin -alias killport=killPort # use my zsh custom plugin alias what_shell=ps -p $$ -o pid,comm= # show current shell +alias checkport=checkPort +alias killport=killPort diff --git a/zsh/custom-functions/custom-functions.plugin.zsh b/zsh/custom-functions/custom-functions.plugin.zsh index 6e719f2..0c82182 100755 --- a/zsh/custom-functions/custom-functions.plugin.zsh +++ b/zsh/custom-functions/custom-functions.plugin.zsh @@ -67,3 +67,18 @@ function logprocess() { journalctl -f -u "$1" 2>/dev/null || tail -f /var/log/syslog | grep "$1" fi } + +# open work folder +function workFolder() { + if [ -d ~/Projects ]; then + cd ~/Projects + elif [ -d ~/projects ]; then + cd ~/projects + elif [ -d ~/work ]; then + cd ~/work + elif [ -d ~/Work ]; then + cd ~/Work + else + echo "Folder ~/Projects, ~/projects, ~/work or ~/Work does not exist" + fi +}