Vim Simple Configuration (Ubuntu) | Ubuntu+Vim

Vim is very important under Linux. Important is not irreplaceable, but Vim is indeed the best choice.

0. Operating system used in this article

  • Ubuntu20.04.1 LTS

1. Install Vim

sudo apt install vim

2. Vim simple configuration and instructions

Configuration file path:/etc/vim/vimrc

" 不允许Vim兼容vi
set nocompatible
" 显示行号
set number

" 允许使用鼠标(不推荐)
set mouse = a
" 使用 utf-8 编码
set encoding = utf-8
" 启用256色
set t_Co=256

" Enter时,下一行缩进自动跟上一行缩进一致
set autoindent

" 按下 Tab 时的空格数
set tabstop = 4
" Tab自动转空格
set expandtab
" Tab转化空格数
set softtabstop=4

" 显示行号
set number
" 高亮当前行
set cursorline

" 不创建交换文件(.swp) 一些误操作会产生,可手动删除
set noswapfile

3. My configuration

Not compatible with vi, display line number, tab 4, indent 4

set nocompatible
set number
set encoding=utf-8
set t_Co=256

set autoindent
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4

Guess you like

Origin blog.csdn.net/qq_40759015/article/details/110472770