#!/bin/bash # Verificar se o Vim está instalado if ! command -v vim &> /dev/null then echo "Vim não encontrado, instalando o Vim..." sudo apt-get update sudo apt-get install -y vim else echo "Vim já está instalado." fi # Diretório do Vundle VUNDLE_DIR=~/.vim/bundle/Vundle.vim # Verificar se o Vundle está instalado if [ ! -d "$VUNDLE_DIR" ]; then echo "Instalando o Vundle..." git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim else echo "Vundle já está instalado." fi # Configurar o .vimrc echo "Configurando o .vimrc..." cat < ~/.vimrc set nocompatible " necessário para evitar conflitos filetype off " necessário para Vundle " Iniciar o Vundle set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " Plugins Plugin 'VundleVim/Vundle.vim' Plugin 'preservim/nerdtree' " Todos os plugins devem ser adicionados antes de chamar o seguinte comando call vundle#end() " obrigatório filetype plugin indent on " obrigatório " Abrir o NERDTree ao iniciar o Vim, se nenhum ficheiro for especificado autocmd vimenter * if !argc() | NERDTree | endif " Abrir o NERDTree se o diretório for passado como argumento autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | \ execute 'NERDTree' argv()[0] | wincmd p | endif " Abrir o NERDTree em novas abas autocmd TabEnter * NERDTree EOF # Instalar os plugins do Vim echo "Instalando os plugins do Vim..." vim -E -s +PluginInstall +qall echo "Configuração completa! Abra o Vim para verificar."