Trang chủ » Cài đặt và cấu hình vim trên CentOS 7

Cài đặt và cấu hình vim trên CentOS 7

bởi Vinh Leo
6,1K views
3/5 - (2 bình chọn)

Vim là gì?

Vim là một trong những trình biên soạn dòng lệnh mạnh và phổ biến nhất. Nó chỉ sẵn có trên nền của Linux và Unix, những sau đó nó cũng xuất hiện cả trên Windows. Giao diện của nó thì gọn gàng và đơn giản, và bạn có thể kết hợp các phím để thực hiện các công việc như copy-paste, tìm kiếm và thay thế, xóa một số dòng, và nhiều chức năng khác nữa.

1. Cài đặt vim

yum -y install vim-enhanced

2. Thêm Alias vào profile

 vi /etc/profile

– Thêm dòng lệnh sau:

alias vi='vim'

– Reload profile

source /etc/profile

3. Cấu hình vim

Áp dụng cho user bên dưới. Nếu bạn áp dụng cho tất cả user, hãy viết các cài đặt tương tự trong /etc/vimrc, một số cài đặt mặc định được áp dụng.

# use extended function of vim (no compatible with vi)
set nocompatible

# specify encoding
set encoding=euc-jp

#specify file encoding
set fileencodings=iso-2022-jp,sjis

# specify file formats
set fileformats=unix,dos

# take backup
# if not, specify [ set nobackup ]
set backup

# specify backup directory
set backupdir=~/backup

# take 50 search histories
set history=50

# ignore Case
set ignorecase

# distinct Capital if you mix it in search words
set smartcase

# highlights matched words
# if not, specify [ set nohlsearch ]
set hlsearch

# use incremental search
# if not, specify [ set noincsearch ]
set incsearch

# show line number
# if not, specify [ set nonumber ]
set number

# Visualize break ( $ ) or tab ( ^I )
set list

# highlights parentheses
set showmatch

# show color display
# if not, specify [ syntax off ]
syntax on

# change colors for comments if it's set [ syntax on ]
highlight Comment ctermfg=LightCyan

# wrap lines
# if not, specify [ set nowrap ]
set wrap

Chúc các bạn thành công! Mọi thắc mắc, cần hỗ trợ hãy bình luận bên dưới hoặc qua Fanpage Facebook, form liên hệ.

Xem tiếp các bài trong Series Học CentOS 7 căn bản

CÓ THỂ BẠN QUAN TÂM

Subscribe
Thông báo cho
guest
0 Góp ý
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x