Vim简单配置(Ubuntu) | Ubuntu+Vim

Linux下Vim非常重要,重要并非不可替代,但Vim确实是最好的选择。

0.本文所用操作系统

  • Ubuntu20.04.1 LTS

1.安装Vim

sudo apt install vim

2.Vim简单配置及说明

配置文件路径:/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.我的配置

不与vi兼容,显示行号,tab为4,缩进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

猜你喜欢

转载自blog.csdn.net/qq_40759015/article/details/110472770