如何在Fedora Linux 29上安装增强的VIM

时间:2020-01-09 10:39:27  来源:igfitidea点击:

默认的vi在Fedora Linux 29上默认不为打开的文件提供语法高亮显示。
它的工作原理类似于原始vi编辑器。
如何在Fedora Linux 29上安装提供语法高亮显示的vim增强版本?
简介默认情况下,Fedora Linux附带提供vi命令的vim-minimal软件包。

vi命令没有语法突出显示。
因此,您必须安装VIM的增强版本。

本教程将学习"如何在Fedora Linux 29上安装VIM(已改进的可视编辑器)"。

如何在Fedora上搜索VIM的增强版

运行以下dnf命令和grep命令:

dnf search vim
dnf search vim | grep enhancements

输出示例:

Last metadata expiration check: 0:22:45 ago on Friday 18 January 2019 11:22:12 PM IST.
vim-enhanced.x86_64 : A version of the VIM editor which includes recent

获取有关Fedora Linux中vim增强软件包的信息,运行:

dnf info vim-enhanced

可用软件包:

Name         : vim-enhanced
Epoch        : 2
Version      : 8.1.575
Release      : 1.fc29
Arch         : x86_64
Size         : 1.3 M
Source       : vim-8.1.575-1.fc29.src.rpm
Repo         : updates
Summary      : A version of the VIM editor which includes recent enhancements
URL          : http://www.vim.org/
License      : Vim and MIT
Description  : VIM (VIsual editor iMproved) is an updated and improved version of the
             : vi editor.  Vi was the first real screen-based editor for UNIX, and is
             : still very popular.  VIM improves on vi by adding new features:
             : multiple windows, multi-level undo, block highlighting and more.  The
             : vim-enhanced package contains a version of VIM with extra, recently
             : introduced features like Python and Perl interpreters.
             : 
             : Install the vim-enhanced package if you'd like to use a version of the
             : VIM editor which includes recently added enhancements like
             : interpreters for the Python and Perl scripting languages.  You'll also
             : need to install the vim-common package.

如何在Fedora Linux 29上安装增强的VIM

增强安装vim的过程如下。

步骤1.更新Fedora Linux软件

执行以下命令以更新软件包数据库:

sudo dnf update

第2步。在Fedora中安装vim-enhanced

执行以下dnf命令:

sudo dnf install vim-enhanced

使用dnf在我的Fedora Linux工作站上安装VIM增强软件包

步骤3.验证Fedora Linux中的VIM安装

接下来,验证vim是否正常工作:

vim
vim script.sh

步骤4.创建bash shell别名

将以下别名添加到~/.bashrc文件中,执行:

vim ~/.bashrc

追加以下代码:

alias vi='vim'

保存并关闭vim中的文件。
使用source命令加载新的别名:

source ~/.bashrc