If you've just installed a fresh server and want a better editing experience with Vim, this one-liner will:
- Install Vim Enhanced
- Make vi use Vim automatically
- Enable syntax highlighting
- Show line numbers
- Improve search functionality
- Enable auto-indent
- Create a backup directory
Code: Select all
dnf -y install vim-enhanced &&
echo "alias vi='vim'" >> ~/.bashrc &&
source ~/.bashrc &&
mkdir -p ~/backup &&
cat > ~/.vimrc <<'EOF'
set nocompatible
set encoding=utf-8
set fileencodings=utf-8
set fileformats=unix,dos
set backup
set backupdir=~/backup
set history=50
set ignorecase
set smartcase
set hlsearch
set incsearch
set number
set showmatch
set autoindent
syntax on
highlight Comment ctermfg=LightCyan
set wrap
EOF
Code: Select all
vi script.sh