-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-mac4dev.sh
More file actions
executable file
·892 lines (747 loc) · 27.6 KB
/
setup-mac4dev.sh
File metadata and controls
executable file
·892 lines (747 loc) · 27.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
#!/bin/bash
# =============================================================================
# Mac Development Environment Setup Script
# For TypeScript Microservices Development
# =============================================================================
# This script is idempotent - safe to run multiple times
# =============================================================================
set -e # Exit on error
set -u # Exit on undefined variable
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Logging functions
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
log_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Helper function to install cask only if not already installed
install_cask_if_missing() {
local cask_name=$1
local app_name=${2:-$cask_name} # Optional app name in /Applications, defaults to cask_name
# Check if already installed via Homebrew
if brew list --cask "$cask_name" &>/dev/null; then
log_info "$cask_name is already installed via Homebrew, skipping..."
return 0
fi
# Check if app exists in /Applications (common app names)
local app_paths=(
"/Applications/${app_name}.app"
"/Applications/${app_name//-/.}.app" # Replace hyphens with dots
"/Applications/${app_name//-/ }.app" # Replace hyphens with spaces
)
for app_path in "${app_paths[@]}"; do
if [ -d "$app_path" ]; then
log_info "$app_name is already installed in Applications, skipping..."
return 0
fi
done
# Not installed, proceed with installation
log_info "Installing $cask_name..."
if ! brew install --cask "$cask_name"; then
log_error "Failed to install cask: $cask_name"
return 1
fi
}
# Check if running on macOS
if [[ "$OSTYPE" != "darwin"* ]]; then
log_error "This script is designed for macOS only"
exit 1
fi
log_info "Starting Mac Development Environment Setup..."
echo "================================================"
# =============================================================================
# 1. Install Homebrew (if not already installed)
# =============================================================================
log_info "Checking for Homebrew..."
if ! command -v brew &> /dev/null; then
log_info "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH for Apple Silicon Macs
if [[ $(uname -m) == 'arm64' ]]; then
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
log_success "Homebrew installed"
else
log_success "Homebrew already installed"
brew update
fi
# =============================================================================
# 2. Install Core Development Tools
# =============================================================================
log_info "Installing core development tools..."
# Git
brew install git
# Node.js and npm (using nvm for version management)
log_info "Installing NVM (Node Version Manager)..."
if [ ! -d "$HOME/.nvm" ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Install latest LTS version
nvm install --lts
nvm use --lts
nvm alias default node # Set default to current version
log_success "NVM and Node.js LTS installed"
log_info "Node version: $(node --version)"
else
log_success "NVM already installed"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
fi
# Note: We'll use npx for tools instead of global installs
# This ensures tools are version-specific and project-based
log_info "Installing alternative package managers..."
npm install -g pnpm yarn # These are better as globals for bootstrapping
log_success "Core development tools installed"
log_info "Tip: Use 'npx' to run tools without global installation (e.g., 'npx typescript', 'npx ts-node')"
# =============================================================================
# 3. Install IDEs and Code Editors
# =============================================================================
log_info "Installing code editors..."
# Visual Studio Code
install_cask_if_missing "visual-studio-code" "Visual Studio Code"
# Cursor (AI-powered IDE)
install_cask_if_missing "cursor" "Cursor"
log_success "Code editors installed"
# =============================================================================
# 4. Install VS Code Extensions
# =============================================================================
log_info "Installing VS Code extensions..."
# Check if VS Code CLI is available
if command -v code &> /dev/null; then
# Function to install extension only if not already installed
install_vscode_extension() {
local extension=$1
if code --list-extensions | grep -qi "^${extension}$"; then
log_info "Extension ${extension} already installed, skipping..."
else
log_info "Installing ${extension}..."
code --install-extension "$extension" --force
fi
}
# Essential TypeScript/JavaScript extensions
install_vscode_extension "dbaeumer.vscode-eslint"
install_vscode_extension "esbenp.prettier-vscode"
install_vscode_extension "ms-vscode.vscode-typescript-next"
install_vscode_extension "ms-vscode.vscode-typescript-tslint-plugin"
install_vscode_extension "streetsidesoftware.code-spell-checker"
install_vscode_extension "eamodio.gitlens"
install_vscode_extension "ms-azuretools.vscode-docker"
install_vscode_extension "ms-vscode-remote.remote-containers"
install_vscode_extension "christian-kohler.npm-intellisense"
install_vscode_extension "eg2.vscode-npm-script"
install_vscode_extension "wix.vscode-import-cost"
install_vscode_extension "usernamehw.errorlens"
install_vscode_extension "bradlc.vscode-tailwindcss"
install_vscode_extension "prisma.prisma"
install_vscode_extension "mongodb.mongodb-vscode"
# REST API testing
install_vscode_extension "humao.rest-client"
install_vscode_extension "rangav.vscode-thunder-client"
# Popular Theme Extensions
install_vscode_extension "zhuangtongfa.material-theme"
install_vscode_extension "PKief.material-icon-theme"
install_vscode_extension "dracula-theme.theme-dracula"
install_vscode_extension "GitHub.github-vscode-theme"
install_vscode_extension "sdras.night-owl"
install_vscode_extension "wesbos.theme-cobalt2"
install_vscode_extension "akamud.vscode-theme-onedark"
install_vscode_extension "monokai.theme-monokai-pro-vscode"
# install_vscode_extension "antfu.theme-vitesse"
install_vscode_extension "sainnhe.gruvbox-material"
log_success "VS Code extensions installed"
else
log_warning "VS Code CLI not available yet. Extensions will be skipped."
log_warning "Run script again after opening VS Code once, or install manually."
fi
# =============================================================================
# 5. Install Containerization Tools
# =============================================================================
log_info "Installing containerization tools..."
# OrbStack (recommended - faster and lighter than Docker Desktop)
install_cask_if_missing "orbstack" "OrbStack"
# Docker CLI tools
brew install docker
brew install docker-compose
brew install docker-buildx
log_success "Containerization tools installed"
log_warning "OrbStack installed. It's recommended over Docker Desktop for Mac."
log_warning "Launch OrbStack from Applications to complete setup."
# =============================================================================
# 6. Install Database Clients
# =============================================================================
log_info "Installing database clients..."
# TablePlus - Universal database client
install_cask_if_missing "tableplus" "TablePlus"
# DBeaver - Free alternative
install_cask_if_missing "dbeaver-community" "DBeaver"
# MongoDB Compass - Official MongoDB GUI
install_cask_if_missing "mongodb-compass" "MongoDB Compass"
# PostgreSQL and MongoDB CLI tools
brew install postgresql@15
brew install mongosh # MongoDB Shell
brew install pgcli # Enhanced PostgreSQL CLI with auto-completion
brew install mycli # Enhanced MySQL/MariaDB CLI with auto-completion
log_success "Database clients installed"
# =============================================================================
# 7. Install Communication Tools
# =============================================================================
log_info "Installing communication tools..."
install_cask_if_missing "slack" "Slack"
install_cask_if_missing "zoom" "zoom.us"
log_success "Communication tools installed"
# =============================================================================
# 8. Install Browsers
# =============================================================================
log_info "Installing browsers..."
install_cask_if_missing "brave-browser" "Brave Browser"
install_cask_if_missing "google-chrome" "Google Chrome"
install_cask_if_missing "firefox" "Firefox"
log_success "Browsers installed"
# =============================================================================
# 9. Install Terminal and Fonts
# =============================================================================
log_info "Installing iTerm2 and fonts..."
# iTerm2
install_cask_if_missing "iterm2" "iTerm"
# Install Nerd Fonts
# brew tap homebrew/cask-fonts
install_cask_if_missing "font-fira-code-nerd-font"
install_cask_if_missing "font-jetbrains-mono-nerd-font"
install_cask_if_missing "font-meslo-lg-nerd-font"
log_success "iTerm2 and Nerd Fonts installed"
# =============================================================================
# 10. Install and Configure Zsh with Starship
# =============================================================================
log_info "Setting up Zsh with Starship prompt..."
# Install Starship
brew install starship
# Zsh plugins (without Oh My Zsh)
ZDOTDIR="${ZDOTDIR:-$HOME}"
ZSH_PLUGINS_DIR="$HOME/.zsh"
mkdir -p "$ZSH_PLUGINS_DIR"
# zsh-autosuggestions
if [ ! -d "$ZSH_PLUGINS_DIR/zsh-autosuggestions" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_PLUGINS_DIR/zsh-autosuggestions"
fi
# zsh-syntax-highlighting
if [ ! -d "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting"
fi
# zsh-completions
if [ ! -d "$ZSH_PLUGINS_DIR/zsh-completions" ]; then
git clone https://github.com/zsh-users/zsh-completions "$ZSH_PLUGINS_DIR/zsh-completions"
fi
# zsh-history-substring-search
if [ ! -d "$ZSH_PLUGINS_DIR/zsh-history-substring-search" ]; then
git clone https://github.com/zsh-users/zsh-history-substring-search "$ZSH_PLUGINS_DIR/zsh-history-substring-search"
fi
# Update .zshrc
log_info "Configuring .zshrc..."
if [ -f "$HOME/.zshrc" ]; then
cp "$HOME/.zshrc" "$HOME/.zshrc.backup"
log_info "Backup of .zshrc created at ~/.zshrc.backup"
fi
# Configure .zshrc with plugins and Starship
cat > "$HOME/.zshrc" << 'EOF'
# =============================================================================
# Zsh Configuration with Starship
# =============================================================================
# History configuration
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
# Directory navigation
setopt AUTO_CD
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
setopt PUSHD_SILENT
# Completion
autoload -Uz compinit
compinit
# Case-insensitive completion
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Load Zsh plugins
ZSH_PLUGINS_DIR="$HOME/.zsh"
# Syntax highlighting (must be loaded before history-substring-search)
if [ -f "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then
source "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
fi
# Auto-suggestions
if [ -f "$ZSH_PLUGINS_DIR/zsh-autosuggestions/zsh-autosuggestions.zsh" ]; then
source "$ZSH_PLUGINS_DIR/zsh-autosuggestions/zsh-autosuggestions.zsh"
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
fi
# Additional completions
if [ -d "$ZSH_PLUGINS_DIR/zsh-completions/src" ]; then
fpath=($ZSH_PLUGINS_DIR/zsh-completions/src $fpath)
fi
# History substring search
if [ -f "$ZSH_PLUGINS_DIR/zsh-history-substring-search/zsh-history-substring-search.zsh" ]; then
source "$ZSH_PLUGINS_DIR/zsh-history-substring-search/zsh-history-substring-search.zsh"
# Bind arrow keys
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
fi
# NVM Configuration
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Lazy load NVM to speed up shell startup
# Uncomment to enable lazy loading:
# export NVM_LAZY_LOAD=true
# export NVM_COMPLETION=true
# Homebrew (for Apple Silicon)
if [[ $(uname -m) == 'arm64' ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Custom PATH additions
export PATH="$HOME/.local/bin:$PATH"
# Development aliases
[ -f ~/.dev_aliases ] && source ~/.dev_aliases
# Initialize Starship prompt (must be at the end)
eval "$(starship init zsh)"
EOF
# Configure Starship
log_info "Configuring Starship..."
mkdir -p "$HOME/.config"
cat > "$HOME/.config/starship.toml" << 'EOF'
# Starship Configuration for Development
format = """
[╭─](bold green)$username$hostname$directory$git_branch$git_status$nodejs$docker_context$kubernetes
[╰─](bold green)$character"""
# Prompt character
[character]
success_symbol = "[➜](bold green)"
error_symbol = "[✗](bold red)"
# Username
[username]
show_always = false
format = "[$user]($style)@"
style_user = "bold yellow"
# Hostname
[hostname]
ssh_only = false
format = "[$hostname]($style) "
style = "bold blue"
disabled = true
# Directory
[directory]
truncation_length = 3
truncate_to_repo = true
format = "[$path]($style)[$read_only]($read_only_style) "
style = "bold cyan"
read_only = " "
# Git branch
[git_branch]
symbol = " "
format = "on [$symbol$branch]($style) "
style = "bold purple"
# Git status
[git_status]
format = '([\[$all_status$ahead_behind\]]($style) )'
style = "bold red"
conflicted = "🏳"
ahead = "⇡${count}"
behind = "⇣${count}"
diverged = "⇕⇡${ahead_count}⇣${behind_count}"
untracked = "?${count}"
stashed = "${count}"
modified = "!${count}"
staged = "+${count}"
renamed = "»${count}"
deleted = "✘${count}"
# Node.js
[nodejs]
symbol = " "
format = "via [$symbol($version )]($style)"
style = "bold green"
detect_extensions = ["js", "mjs", "cjs", "ts", "tsx"]
detect_files = ["package.json", ".node-version", ".nvmrc"]
# Docker
[docker_context]
symbol = " "
format = "via [$symbol$context]($style) "
style = "bold blue"
# Kubernetes
[kubernetes]
symbol = "☸ "
format = 'on [$symbol$context( \($namespace\))]($style) '
disabled = false
style = "cyan bold"
# Package version
[package]
symbol = "📦 "
format = "is [$symbol$version]($style) "
style = "208 bold"
# Time
[time]
disabled = true
format = '🕙[\[ $time \]]($style) '
time_format = "%T"
style = "bold yellow"
# Command duration
[cmd_duration]
min_time = 500
format = "took [$duration]($style) "
style = "bold yellow"
EOF
log_success "Zsh configured with Starship prompt and plugins"
# =============================================================================
# 11. Install Neovim and AstroNvim
# =============================================================================
log_info "Installing Neovim and AstroNvim..."
# Install Neovim
brew install neovim
# Install dependencies for AstroNvim and plugins
brew install ripgrep # Required for Telescope (fuzzy finder)
brew install lazygit # Git TUI integration
brew install gdu # Disk usage analyzer
brew install bottom # System monitor
brew install tree-sitter # Better syntax highlighting
# Node.js is already installed via NVM - needed for LSP servers
# Install Python
brew install python@3.11
# Install Python support for Neovim
# >python3 -m pip install --user --upgrade pynvim
# Install language servers and tools for TypeScript development
log_info "Installing Node.js global tools..."
npm list -g neovim &>/dev/null || npm install -g neovim
npm list -g tree-sitter-cli &>/dev/null || npm install -g tree-sitter-cli
npm list -g typescript-language-server &>/dev/null || npm install -g typescript-language-server
npm list -g vscode-langservers-extracted &>/dev/null || npm install -g vscode-langservers-extracted
npm list -g yaml-language-server &>/dev/null || npm install -g yaml-language-server
npm list -g dockerfile-language-server-nodejs &>/dev/null || npm install -g dockerfile-language-server-nodejs
npm list -g bash-language-server &>/dev/null || npm install -g bash-language-server
# Install additional formatters and linters
npm list -g prettier &>/dev/null || npm install -g prettier
npm list -g eslint_d &>/dev/null || npm install -g eslint_d
# Backup existing nvim config if it exists
if [ -d "$HOME/.config/nvim" ]; then
if [ ! -f "$HOME/.config/nvim/.astronvim_installed" ]; then
log_warning "Existing Neovim config found. Creating backup..."
BACKUP_TIME=$(date +%Y%m%d_%H%M%S)
mv "$HOME/.config/nvim" "$HOME/.config/nvim.backup.$BACKUP_TIME"
[ -d "$HOME/.local/share/nvim" ] && mv "$HOME/.local/share/nvim" "$HOME/.local/share/nvim.backup.$BACKUP_TIME"
[ -d "$HOME/.local/state/nvim" ] && mv "$HOME/.local/state/nvim" "$HOME/.local/state/nvim.backup.$BACKUP_TIME"
[ -d "$HOME/.cache/nvim" ] && mv "$HOME/.cache/nvim" "$HOME/.cache/nvim.backup.$BACKUP_TIME"
else
log_success "AstroNvim already installed, skipping..."
fi
fi
# Install AstroNvim only if not already installed
if [ ! -d "$HOME/.config/nvim" ] || [ ! -f "$HOME/.config/nvim/.astronvim_installed" ]; then
log_info "Installing AstroNvim..."
git clone --depth 1 https://github.com/AstroNvim/template "$HOME/.config/nvim"
rm -rf "$HOME/.config/nvim/.git"
touch "$HOME/.config/nvim/.astronvim_installed" # Marker file
# Create user configuration for AstroNvim optimized for TypeScript
mkdir -p "$HOME/.config/nvim/lua/user"
cat > "$HOME/.config/nvim/lua/user/init.lua" << 'EOF'
return {
-- Configure AstroNvim updates
updater = {
remote = "origin",
channel = "stable",
version = "latest",
branch = "nightly",
commit = nil,
pin_plugins = nil,
skip_prompts = false,
show_changelog = true,
auto_quit = false,
},
-- Colorscheme
colorscheme = "astrodark",
-- Diagnostics configuration
diagnostics = {
virtual_text = true,
underline = true,
},
lsp = {
-- Enable language servers
servers = {
"tsserver", -- TypeScript
"eslint", -- ESLint
"html", -- HTML
"cssls", -- CSS
"jsonls", -- JSON
"yamlls", -- YAML
"dockerls", -- Docker
"bashls", -- Bash
},
formatting = {
format_on_save = {
enabled = true,
allow_filetypes = {
"typescript",
"javascript",
"typescriptreact",
"javascriptreact",
"json",
"yaml",
"markdown",
},
},
},
config = {
tsserver = {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
},
},
},
-- Default theme configuration
default_theme = {
diagnostics_style = { italic = true },
highlights = {
Normal = { bg = "NONE", ctermbg = "NONE" },
},
},
-- Plugins configuration
plugins = {
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"typescript",
"javascript",
"tsx",
"json",
"yaml",
"html",
"css",
"markdown",
"bash",
"dockerfile",
"lua",
"vim",
},
},
},
},
-- Mappings
mappings = {
n = {
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<leader>bD"] = {
function()
require("astronvim.utils.status").heirline.buffer_picker(
function(bufnr) require("astronvim.utils.buffer").close(bufnr) end
)
end,
desc = "Pick to close",
},
},
},
-- Polish - runs after all plugins are loaded
polish = function()
-- Enable transparent background
-- vim.cmd("highlight Normal guibg=NONE ctermbg=NONE")
-- vim.cmd("highlight NormalNC guibg=NONE ctermbg=NONE")
end,
}
EOF
log_success "AstroNvim installed and configured"
else
log_success "AstroNvim configuration already exists"
fi
log_info "On first launch, Neovim will install all plugins automatically"
log_info "This may take a few minutes. Please be patient."
# Create an alias for nvim
if ! grep -q "alias vim='nvim'" "$HOME/.zshrc"; then
echo "" >> "$HOME/.zshrc"
echo "# Neovim alias" >> "$HOME/.zshrc"
echo "alias vim='nvim'" >> "$HOME/.zshrc"
echo "alias vi='nvim'" >> "$HOME/.zshrc"
fi
log_success "Neovim and AstroNvim setup complete"
# =============================================================================
# 12. Additional Useful Tools
# =============================================================================
log_info "Installing additional development tools..."
# API testing
install_cask_if_missing "postman" "Postman"
# Version control GUI
install_cask_if_missing "sourcetree" "Sourcetree"
# File transfer
brew install wget curl
# JSON processor
brew install jq
# HTTP client
brew install httpie
# Process monitoring
brew install htop
# Modern replacements for classic tools
brew install bat # Better cat
# >brew install exa # Better ls
brew install ripgrep # Better grep
brew install fd # Better find
brew install fzf # Fuzzy finder
# Kubernetes tools (useful for microservices)
brew install kubectl
brew install helm
brew install kubectx
# Cloud CLIs
brew install awscli
brew tap azure/azd && brew install azd
brew install stats
log_success "Additional development tools installed"
# =============================================================================
# 13. Create helpful aliases file
# =============================================================================
log_info "Creating helpful development aliases..."
cat > "$HOME/.dev_aliases" << 'EOF'
# Development Aliases
# Docker shortcuts
alias d='docker'
alias dc='docker-compose'
alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
alias dex='docker exec -it'
alias dlogs='docker logs -f'
alias dprune='docker system prune -a'
# Git shortcuts
alias g='git'
alias gs='git status'
alias ga='git add'
alias gc='git commit -m'
alias gp='git push'
alias gl='git pull'
alias gco='git checkout'
alias gb='git branch'
alias glog='git log --oneline --graph --decorate'
# Node/npm shortcuts
alias ni='npm install'
alias nid='npm install --save-dev'
alias nr='npm run'
alias ns='npm start'
alias nt='npm test'
alias nb='npm run build'
# TypeScript shortcuts
alias tsc='npx tsc'
alias tsn='npx ts-node'
# Directory shortcuts
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
# Modern tool replacements
if command -v bat &> /dev/null; then
alias cat='bat'
fi
if command -v exa &> /dev/null; then
alias ls='exa'
alias ll='exa -lah'
alias tree='exa --tree'
fi
EOF
# Add source to .zshrc if not already there
if ! grep -q ".dev_aliases" "$HOME/.zshrc"; then
echo "" >> "$HOME/.zshrc"
echo "# Development aliases" >> "$HOME/.zshrc"
echo "[ -f ~/.dev_aliases ] && source ~/.dev_aliases" >> "$HOME/.zshrc"
fi
log_success "Development aliases created"
# =============================================================================
# 14. Configure Git
# =============================================================================
log_info "Configuring Git..."
# Check if Git is already configured
GIT_USER_NAME=$(git config --global user.name 2>/dev/null || echo "")
GIT_USER_EMAIL=$(git config --global user.email 2>/dev/null || echo "")
if [ -z "$GIT_USER_NAME" ] || [ -z "$GIT_USER_EMAIL" ]; then
echo ""
read -p "Enter your Git username: " git_username
read -p "Enter your Git email: " git_email
git config --global user.name "$git_username"
git config --global user.email "$git_email"
log_success "Git user configured"
else
log_success "Git already configured (User: $GIT_USER_NAME, Email: $GIT_USER_EMAIL)"
fi
# Set other Git configurations (idempotent)
git config --global init.defaultBranch main
git config --global core.editor "code --wait"
git config --global pull.rebase false
log_success "Git configured"
# =============================================================================
# Final Steps and Summary
# =============================================================================
echo ""
echo "================================================"
log_success "🎉 Setup Complete!"
echo "================================================"
echo ""
log_info "Installed Tools Summary:"
echo " ✅ Homebrew (package manager)"
echo " ✅ Git, NVM, Node.js (LTS)"
echo " ✅ VS Code + Cursor with extensions and themes"
echo " ✅ Neovim + AstroNvim (terminal IDE)"
echo " ✅ OrbStack (Docker replacement)"
echo " ✅ Database clients (TablePlus, DBeaver, MongoDB Compass)"
echo " ✅ Database CLI tools (pgcli, mycli, mongosh)"
echo " ✅ Communication (Slack, Zoom)"
echo " ✅ Browsers (Brave, Chrome, Firefox)"
echo " ✅ iTerm2 + Nerd Fonts"
echo " ✅ Zsh with Starship prompt and plugins"
echo " ✅ API testing tools (Postman, Insomnia)"
echo " ✅ CLI tools and utilities"
echo ""
log_warning "Next Steps:"
echo " 1. Restart your terminal or run: source ~/.zshrc"
echo " 2. Open iTerm2 and set font to 'FiraCode Nerd Font Mono' in Preferences"
echo " 3. Launch OrbStack from Applications to complete Docker setup"
echo " 4. Open VS Code/Cursor to verify extensions"
echo " 5. Run 'nvim' to start Neovim - AstroNvim will install plugins on first launch"
echo " 6. Use 'nvm install <version>' to install specific Node versions"
echo " 7. Use 'npx <tool>' instead of global installs (e.g., 'npx typescript')"
echo ""
log_info "Useful commands:"
echo " - 'nvim' or 'vim' to open Neovim (with AstroNvim)"
echo " - 'code .' to open current directory in VS Code"
echo " - 'cursor .' to open current directory in Cursor"
echo " - 'dc up' for docker-compose up"
echo " - 'pgcli' for enhanced PostgreSQL CLI"
echo " - 'mycli' for enhanced MySQL CLI"
echo " - 'lazygit' for Git TUI"
echo " - 'nvm use <version>' to switch Node versions"
echo " - Check ~/.dev_aliases for more shortcuts"
echo ""
log_info "AstroNvim quick tips:"
echo " - Leader key is <Space>"
echo " - <Space>ff - Find files"
echo " - <Space>fw - Find word"
echo " - <Space>e - Toggle file explorer"
echo " - <Space>gg - Open LazyGit"
echo " - Visit https://docs.astronvim.com for full documentation"
echo ""
log_success "Happy coding! 🚀"