-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_dev.sh
More file actions
716 lines (629 loc) · 23.3 KB
/
Copy pathsetup_dev.sh
File metadata and controls
716 lines (629 loc) · 23.3 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
#!/bin/bash
# Script de configuração do ambiente de desenvolvimento web
# Autor: Configuração automática para desenvolvimento
# Data: $(date)
set -e # Para sair imediatamente se algum comando falhar
# Cores para output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Função para imprimir mensagens coloridas
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Detectar distribuição Linux
detect_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO=$ID
else
print_error "Não foi possível detectar a distribuição Linux"
exit 1
fi
}
# Função para instalar pacotes baseado na distribuição
install_package() {
case $DISTRO in
ubuntu|debian)
sudo apt update && sudo apt install -y $1
;;
fedora)
sudo dnf install -y $1
;;
centos|rhel)
sudo yum install -y $1
;;
arch|manjaro)
sudo pacman -S --noconfirm $1
;;
*)
print_error "Distribuição não suportada: $DISTRO"
exit 1
;;
esac
}
# Banner inicial
echo "=============================================="
echo " CONFIGURAÇÃO DO AMBIENTE DE DESENVOLVIMENTO"
echo "=============================================="
echo ""
# Detectar distribuição
print_status "Detectando distribuição Linux..."
detect_distro
print_success "Distribuição detectada: $DISTRO"
# 1. Instalar ZSH
print_status "Instalando ZSH..."
case $DISTRO in
ubuntu|debian)
sudo apt update
install_package "zsh curl wget git"
;;
fedora)
install_package "zsh curl wget git"
;;
centos|rhel)
install_package "zsh curl wget git"
;;
arch|manjaro)
install_package "zsh curl wget git"
;;
esac
print_success "ZSH instalado com sucesso!"
# 2. Instalar Oh-My-Zsh
print_status "Instalando Oh-My-Zsh..."
if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
print_success "Oh-My-Zsh instalado!"
else
print_warning "Oh-My-Zsh já está instalado"
fi
# 3. Instalar plugins do ZSH
print_status "Instalando plugins zsh-autosuggestions e zsh-syntax-highlighting..."
# zsh-autosuggestions
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
print_success "zsh-autosuggestions instalado!"
else
print_warning "zsh-autosuggestions já está instalado"
fi
# zsh-syntax-highlighting
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
print_success "zsh-syntax-highlighting instalado!"
else
print_warning "zsh-syntax-highlighting já está instalado"
fi
# Configurar plugins no .zshrc
print_status "Configurando plugins no .zshrc..."
if [ -f "$HOME/.zshrc" ]; then
# Backup do .zshrc atual
cp "$HOME/.zshrc" "$HOME/.zshrc.backup.$(date +%Y%m%d_%H%M%S)"
# Substituir linha de plugins
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting node npm nvm)/' "$HOME/.zshrc"
print_success "Plugins configurados no .zshrc!"
fi
# 4. Configurar Git com atalhos úteis
print_status "Configurando Git com atalhos para desenvolvimento rápido..."
# Verificar se Git já está configurado
git_name=$(git config --global user.name 2>/dev/null || echo "")
git_email=$(git config --global user.email 2>/dev/null || echo "")
if [ -z "$git_name" ] || [ -z "$git_email" ]; then
print_status "Configuração do Git necessária..."
if [ -z "$git_name" ]; then
echo "Digite seu nome para o Git:"
read -p "Nome: " git_name
git config --global user.name "$git_name"
else
print_success "Nome do Git já configurado: $git_name"
fi
if [ -z "$git_email" ]; then
echo "Digite seu email para o Git:"
read -p "Email: " git_email
git config --global user.email "$git_email"
else
print_success "Email do Git já configurado: $git_email"
fi
else
print_success "Git já está configurado!"
print_success "Nome: $git_name"
print_success "Email: $git_email"
fi
# Atalhos úteis do Git
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.cm "commit -m"
git config --global alias.ca "commit -am"
git config --global alias.ps push
git config --global alias.pl pull
git config --global alias.lg "log --oneline --graph --decorate --all"
git config --global alias.last "log -1 HEAD"
git config --global alias.unstage "reset HEAD --"
git config --global alias.visual "!gitk"
git config --global alias.undo "reset --soft HEAD~1"
git config --global alias.amend "commit --amend"
print_success "Git configurado com atalhos úteis!"
# 5. Instalar NVM
print_status "Instalando NVM (Node Version Manager)..."
if [ ! -d "$HOME/.nvm" ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Carregar NVM no shell atual
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
print_success "NVM instalado!"
else
print_warning "NVM já está instalado"
fi
# Adicionar NVM ao .zshrc se não estiver presente
if ! grep -q "NVM_DIR" "$HOME/.zshrc"; then
echo '' >> "$HOME/.zshrc"
echo '# NVM Configuration' >> "$HOME/.zshrc"
echo 'export NVM_DIR="$HOME/.nvm"' >> "$HOME/.zshrc"
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> "$HOME/.zshrc"
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> "$HOME/.zshrc"
print_success "NVM adicionado ao .zshrc!"
fi
# 6. Instalar Node.js LTS via NVM
print_status "Instalando Node.js LTS via NVM..."
# Carregar NVM se não estiver carregado
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
if command -v nvm &> /dev/null; then
nvm install --lts
nvm use --lts
nvm alias default lts/*
print_success "Node.js LTS instalado via NVM!"
# Mostrar versões instaladas
node_version=$(node --version)
npm_version=$(npm --version)
print_success "Node.js: $node_version"
print_success "NPM: $npm_version"
else
print_error "NVM não foi carregado corretamente. Reinicie o terminal e execute: nvm install --lts"
fi
# 7. Instalar dependências do LunarVim
print_status "Instalando dependências do LunarVim..."
# Instalar Python3 e pip3 primeiro
print_status "Atualizando repositórios e instalando Python3 e pip3..."
case $DISTRO in
ubuntu|debian)
# Atualizar repositórios primeiro (crucial!)
sudo apt update
# Instalar python3-pip com -y flag
sudo apt install -y python3-pip python3-venv python3-dev
;;
fedora)
sudo dnf install -y python3 python3-pip python3-devel
;;
centos|rhel)
sudo yum install -y epel-release
sudo yum install -y python3 python3-pip python3-devel
;;
arch|manjaro)
sudo pacman -S --noconfirm python python-pip
;;
esac
# Aguardar um pouco e recarregar o PATH/hash
sleep 3
source ~/.bashrc 2>/dev/null || true
hash -r 2>/dev/null || true
# Verificar múltiplos locais onde pip pode estar
print_status "Verificando instalação do pip..."
PIP_CMD=""
# Verificar pip3 no sistema
if command -v pip3 &> /dev/null; then
PIP_CMD="pip3"
print_success "Encontrado pip3 no sistema!"
elif command -v pip &> /dev/null; then
PIP_CMD="pip"
print_success "Encontrado pip no sistema!"
# Verificar no local do usuário
elif [ -f "$HOME/.local/bin/pip3" ]; then
PIP_CMD="$HOME/.local/bin/pip3"
export PATH="$HOME/.local/bin:$PATH"
print_success "Encontrado pip3 no diretório local!"
elif [ -f "$HOME/.local/bin/pip" ]; then
PIP_CMD="$HOME/.local/bin/pip"
export PATH="$HOME/.local/bin:$PATH"
print_success "Encontrado pip no diretório local!"
# Verificar caminhos específicos do Ubuntu
elif [ -f "/usr/bin/pip3" ]; then
PIP_CMD="/usr/bin/pip3"
print_success "Encontrado pip3 em /usr/bin/!"
elif [ -f "/usr/bin/pip" ]; then
PIP_CMD="/usr/bin/pip"
print_success "Encontrado pip em /usr/bin/!"
else
print_warning "pip não encontrado nos locais padrão. Tentando reinstalar..."
case $DISTRO in
ubuntu|debian)
# Método mais robusto para Ubuntu
sudo apt update
sudo apt install --reinstall -y python3-pip
# Aguardar mais tempo
sleep 5
hash -r 2>/dev/null || true
# Verificar novamente
if command -v pip3 &> /dev/null; then
PIP_CMD="pip3"
elif [ -f "/usr/bin/pip3" ]; then
PIP_CMD="/usr/bin/pip3"
else
print_warning "Tentando método alternativo com get-pip.py..."
cd /tmp
wget -q https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py --user
rm -f get-pip.py
export PATH="$HOME/.local/bin:$PATH"
if [ -f "$HOME/.local/bin/pip3" ]; then
PIP_CMD="$HOME/.local/bin/pip3"
elif [ -f "$HOME/.local/bin/pip" ]; then
PIP_CMD="$HOME/.local/bin/pip"
fi
fi
;;
*)
print_warning "Continuando sem pip para esta distribuição"
;;
esac
fi
if [ -n "$PIP_CMD" ]; then
# Testar se o pip funciona
if $PIP_CMD --version &> /dev/null; then
print_success "pip instalado e funcionando! Usando: $PIP_CMD"
# Mostrar versão
pip_version=$($PIP_CMD --version)
print_success "Versão: $pip_version"
else
print_warning "pip encontrado mas não está funcionando corretamente"
PIP_CMD=""
fi
else
print_warning "Não foi possível instalar pip automaticamente."
print_warning "Você pode tentar manualmente:"
print_warning " sudo apt update && sudo apt install -y python3-pip"
print_warning "Continuando com a instalação..."
fi
# Instalar Neovim (versão mais recente)
print_status "Instalando Neovim (versão mais recente)..."
if ! command -v nvim &> /dev/null; then
print_status "Baixando e instalando Neovim..."
cd /tmp
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
sudo rm -rf /opt/nvim
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
rm -f nvim-linux-x86_64.tar.gz
# Adicionar ao PATH no .zshrc
if ! grep -q "/opt/nvim-linux-x86_64/bin" "$HOME/.zshrc"; then
echo '' >> "$HOME/.zshrc"
echo '# Neovim' >> "$HOME/.zshrc"
echo 'export PATH="$PATH:/opt/nvim-linux-x86_64/bin"' >> "$HOME/.zshrc"
fi
# Adicionar ao PATH atual
export PATH="$PATH:/opt/nvim-linux-x86_64/bin"
print_success "Neovim instalado!"
else
print_success "Neovim já está instalado!"
fi
# Verificar instalação do Neovim
if command -v nvim &> /dev/null || [ -f "/opt/nvim-linux-x86_64/bin/nvim" ]; then
# Usar o caminho completo se necessário
if command -v nvim &> /dev/null; then
nvim_version=$(nvim --version | head -n1)
else
nvim_version=$(/opt/nvim-linux-x86_64/bin/nvim --version | head -n1)
fi
print_success "Neovim funcionando: $nvim_version"
else
print_error "Neovim não foi instalado corretamente!"
print_warning "Pulando instalação do LunarVim..."
SKIP_LUNARVIM=1
fi
# Instalar Rust (necessário para LunarVim)
print_status "Instalando Rust..."
if ! command -v rustc &> /dev/null; then
print_status "Baixando e instalando Rust via rustup..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Carregar Rust no shell atual
source "$HOME/.cargo/env" 2>/dev/null || true
# Adicionar ao .zshrc se não estiver presente
if ! grep -q "cargo/env" "$HOME/.zshrc"; then
echo '' >> "$HOME/.zshrc"
echo '# Rust' >> "$HOME/.zshrc"
echo 'source "$HOME/.cargo/env"' >> "$HOME/.zshrc"
fi
print_success "Rust instalado!"
else
print_success "Rust já está instalado!"
fi
# Verificar instalação do Rust
if command -v rustc &> /dev/null; then
rust_version=$(rustc --version)
print_success "Rust funcionando: $rust_version"
elif [ -f "$HOME/.cargo/bin/rustc" ]; then
rust_version=$($HOME/.cargo/bin/rustc --version)
print_success "Rust funcionando: $rust_version"
export PATH="$HOME/.cargo/bin:$PATH"
else
print_warning "Rust não foi instalado corretamente, mas continuando..."
fi
# Instalar ferramentas Rust modernas (substituições performáticas)
if command -v cargo &> /dev/null || [ -f "$HOME/.cargo/bin/cargo" ]; then
print_status "Instalando ferramentas Rust modernas..."
# Garantir que cargo está no PATH
source "$HOME/.cargo/env" 2>/dev/null || true
export PATH="$HOME/.cargo/bin:$PATH"
# Lista de ferramentas modernas para instalar
print_status "Instalando exa (substituto moderno do ls)..."
if ! command -v exa &> /dev/null; then
cargo install exa
fi
print_status "Instalando bat (substituto moderno do cat)..."
if ! command -v bat &> /dev/null; then
cargo install bat
fi
print_status "Instalando ripgrep (rg - substituto do grep)..."
if ! command -v rg &> /dev/null; then
cargo install ripgrep
fi
print_status "Instalando fd (substituto moderno do find)..."
if ! command -v fd &> /dev/null; then
cargo install fd-find
fi
print_status "Instalando zoxide (substituto inteligente do cd)..."
if ! command -v zoxide &> /dev/null; then
cargo install zoxide
fi
print_status "Instalando starship (prompt moderno e rápido)..."
if ! command -v starship &> /dev/null; then
cargo install starship
fi
print_success "Ferramentas Rust modernas instaladas!"
# Configurar zoxide no .zshrc
if ! grep -q "zoxide init" "$HOME/.zshrc"; then
echo '' >> "$HOME/.zshrc"
echo '# Zoxide (cd inteligente)' >> "$HOME/.zshrc"
echo 'eval "$(zoxide init zsh)"' >> "$HOME/.zshrc"
fi
# Configurar starship no .zshrc
if ! grep -q "starship init" "$HOME/.zshrc"; then
echo '' >> "$HOME/.zshrc"
echo '# Starship prompt' >> "$HOME/.zshrc"
echo 'eval "$(starship init zsh)"' >> "$HOME/.zshrc"
fi
else
print_warning "Cargo não disponível, pulando ferramentas Rust modernas"
fi
# Instalar dependências Python para Neovim
if [ -n "$PIP_CMD" ]; then
print_status "Instalando dependências Python para Neovim..."
$PIP_CMD install --user pynvim
print_success "Dependências Python instaladas!"
else
print_warning "Pulando instalação de dependências Python (pip não disponível)"
fi
# Instalar ripgrep, fd-find, e outras dependências úteis
case $DISTRO in
ubuntu|debian)
install_package "ripgrep fd-find tree-sitter-cli"
;;
fedora)
install_package "ripgrep fd-find"
;;
centos|rhel)
print_warning "ripgrep e fd-find podem precisar ser instalados manualmente no CentOS/RHEL"
;;
arch|manjaro)
install_package "ripgrep fd tree-sitter"
;;
esac
# Instalar dependências adicionais
print_status "Instalando dependências adicionais..."
case $DISTRO in
ubuntu|debian)
install_package "ripgrep fd-find tree-sitter-cli fontconfig"
;;
fedora)
install_package "ripgrep fd-find fontconfig"
;;
centos|rhel)
print_warning "ripgrep e fd-find podem precisar ser instalados manualmente no CentOS/RHEL"
install_package "fontconfig"
;;
arch|manjaro)
install_package "ripgrep fd tree-sitter fontconfig"
;;
esac
# Instalar FiraCode Nerd Font
print_status "Instalando FiraCode Nerd Font..."
FONT_DIR="$HOME/.local/share/fonts"
mkdir -p "$FONT_DIR"
if [ ! -f "$FONT_DIR/FiraCodeNerdFont-Regular.ttf" ]; then
print_status "Baixando FiraCode Nerd Font..."
cd /tmp
wget -q https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip -O FiraCode.zip
if [ -f "FiraCode.zip" ]; then
unzip -q FiraCode.zip -d FiraCode/
cp FiraCode/*.ttf "$FONT_DIR/"
rm -rf FiraCode FiraCode.zip
# Atualizar cache de fontes
fc-cache -fv &>/dev/null
print_success "FiraCode Nerd Font instalada!"
# Configurar fonte do terminal do Pop!_OS (GNOME Terminal)
if command -v gsettings &> /dev/null; then
print_status "Configurando FiraCode como fonte padrão do terminal..."
# Obter perfil padrão do GNOME Terminal
DEFAULT_PROFILE=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d "'")
if [ -n "$DEFAULT_PROFILE" ]; then
# Configurar fonte
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$DEFAULT_PROFILE/ use-system-font false
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$DEFAULT_PROFILE/ font 'FiraCode Nerd Font 12'
print_success "FiraCode configurada como fonte padrão do terminal!"
else
print_warning "Não foi possível configurar fonte automaticamente"
print_warning "Configure manualmente: Terminal > Preferences > Profile > Text > Font"
fi
fi
else
print_warning "Não foi possível baixar FiraCode Nerd Font"
print_warning "Baixe manualmente de: https://github.com/ryanoasis/nerd-fonts/releases"
fi
else
print_success "FiraCode Nerd Font já está instalada!"
fi
print_success "Dependências do LunarVim instaladas!"
# 8. Instalar LunarVim
if [ "$SKIP_LUNARVIM" != "1" ]; then
print_status "Instalando LunarVim (release-1.4)..."
if [ ! -d "$HOME/.local/share/lunarvim" ]; then
# Verificar se Neovim e Rust estão disponíveis
nvim_available=0
if command -v nvim &> /dev/null; then
nvim_available=1
elif [ -f "/opt/nvim-linux-x86_64/bin/nvim" ]; then
export PATH="$PATH:/opt/nvim-linux-x86_64/bin"
nvim_available=1
fi
if [ $nvim_available -eq 1 ]; then
print_status "Executando instalador do LunarVim..."
# Garantir que Rust está no PATH
source "$HOME/.cargo/env" 2>/dev/null || true
# Instalar LunarVim release-1.4
curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh | LV_BRANCH='release-1.4/neovim-0.9' bash
if [ -d "$HOME/.local/share/lunarvim" ]; then
print_success "LunarVim instalado com sucesso!"
else
print_warning "LunarVim pode não ter sido instalado corretamente"
fi
else
print_error "Neovim não encontrado. Não é possível instalar LunarVim."
print_warning "Certifique-se de que Neovim está instalado e no PATH"
fi
else
print_warning "LunarVim já está instalado"
fi
else
print_warning "Pulando instalação do LunarVim (dependências não disponíveis)"
fi
# Adicionar LunarVim ao PATH no .zshrc
if ! grep -q "lunarvim" "$HOME/.zshrc"; then
echo '' >> "$HOME/.zshrc"
echo '# LunarVim' >> "$HOME/.zshrc"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.zshrc"
print_success "LunarVim adicionado ao PATH!"
fi
# 9. Definir ZSH como shell padrão
print_status "Definindo ZSH como shell padrão..."
if [ "$SHELL" != "$(which zsh)" ]; then
chsh -s $(which zsh)
print_success "ZSH definido como shell padrão!"
else
print_warning "ZSH já é o shell padrão"
fi
# 10. Criar arquivo de aliases úteis
print_status "Criando aliases úteis para desenvolvimento..."
cat >> "$HOME/.zshrc" << 'EOF'
# Aliases úteis para desenvolvimento web (incluindo ferramentas Rust)
alias ll='exa -alF --icons'
alias la='exa -A --icons'
alias l='exa -CF --icons'
alias ls='exa --icons'
alias tree='exa --tree --icons'
alias ..='cd ..'
alias ...='cd ../..'
alias cat='bat'
alias grep='rg'
alias find='fd'
alias cd='z' # zoxide
# Git aliases (além dos configurados globalmente)
alias gs='git status'
alias ga='git add'
alias gaa='git add .'
alias gc='git commit'
alias gcm='git commit -m'
alias gp='git push'
alias gpl='git pull'
alias gco='git checkout'
alias gbr='git branch'
alias glog='git log --oneline --graph --decorate'
# NPM/Node aliases
alias ni='npm install'
alias ns='npm start'
alias nt='npm test'
alias nb='npm run build'
alias nid='npm install --save-dev'
alias nrm='rm -rf node_modules package-lock.json && npm install'
# Desenvolvimento
alias serve='python3 -m http.server 8000'
alias lv='lvim'
alias vim='lvim'
# Sistema (usando ferramentas modernas)
alias update='sudo apt update && sudo apt upgrade' # Para Debian/Ubuntu
alias cls='clear'
alias h='history'
alias df='df -h'
alias du='du -h'
alias free='free -h'
alias ps='procs' # Se tiver instalado
EOF
print_success "Aliases criados!"
# Resumo final
echo ""
echo "=============================================="
echo " INSTALAÇÃO CONCLUÍDA!"
echo "=============================================="
echo ""
print_success "Tudo foi instalado e configurado com sucesso!"
echo ""
echo "📦 Instalado:"
echo " ✅ ZSH com Oh-My-Zsh"
echo " ✅ Plugins: zsh-autosuggestions, zsh-syntax-highlighting"
echo " ✅ Git com atalhos úteis"
echo " ✅ NVM com Node.js LTS"
echo " ✅ Neovim (versão mais recente)"
echo " ✅ Rust (rustup)"
echo " ✅ Ferramentas Rust modernas (exa, bat, ripgrep, fd, zoxide, starship)"
echo " ✅ FiraCode Nerd Font"
echo " ✅ LunarVim (release-1.4)"
echo " ✅ Aliases úteis para desenvolvimento"
echo ""
echo "🎯 Próximos passos:"
echo " 1. Reinicie seu terminal ou execute: source ~/.zshrc"
echo " 2. Teste o LunarVim: lvim"
echo " 3. Verifique o Node.js: node --version"
echo " 4. Verifique o Neovim: nvim --version"
echo " 5. Verifique o Rust: rustc --version"
echo " 6. Teste as ferramentas modernas: exa, bat, rg, fd, z (zoxide)"
echo ""
echo "🚀 Ferramentas Rust modernas:"
echo " • exa → substitui ls (com ícones e cores)"
echo " • bat → substitui cat (com syntax highlighting)"
echo " • rg → substitui grep (muito mais rápido)"
echo " • fd → substitui find (sintaxe mais simples)"
echo " • z → substitui cd (navegação inteligente)"
echo " • starship → prompt moderno e rápido"
echo ""
echo "📚 Atalhos do Git configurados:"
echo " git st = git status"
echo " git co = git checkout"
echo " git cm = git commit -m"
echo " git ps = git push"
echo " git pl = git pull"
echo " git lg = git log --oneline --graph"
echo ""
echo "🚀 Seu ambiente está pronto para desenvolvimento web!"
echo ""
print_warning "IMPORTANTE: Reinicie seu terminal para aplicar todas as configurações!"