-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim_install
executable file
·59 lines (46 loc) · 1.6 KB
/
vim_install
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
#!/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 <<EOF > ~/.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."