zoukankan      html  css  js  c++  java
  • CentOS安装vim

    VMware下CentOS安装成功后,默认自带vi,但vi功能没vim丰富。以下为CentOS中安装vim:

    用yum产看源中的vim安装包:

    [xi@localhost ~]$ yum search vim
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
     * base: ftp.jaist.ac.jp
     * extras: ftp.jaist.ac.jp
     * updates: ftp.jaist.ac.jp
    =============================== N/S matched: vim ===============================
    golang-vim.noarch : Vim plugins for Go
    protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers
                        : descriptions
    vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
    vim-common.x86_64 : The common files needed by any version of the VIM editor
    vim-enhanced.x86_64 : A version of the VIM editor which includes recent
                        : enhancements
    vim-filesystem.x86_64 : VIM filesystem layout
    vim-minimal.x86_64 : A minimal version of the VIM editor
    
      Name and summary matches only, use "search all" for everything.
    

    其中,vim编辑器需要安装三个包

    vim-enhanced-7.0.109-7.el5
    vim-minimal-7.0.109-7.el5
    vim-common-7.0.109-7.el5

    1. 查看本机已存在的vim包,确认一下vim包是否已经安装:

    [xi@localhost ~]$ rpm -qa|grep vim
    vim-minimal-7.4.160-1.el7.x86_64
    vim-filesystem-7.4.160-1.el7.x86_64
    vim-common-7.4.160-1.el7.x86_64
    vim-enhanced-7.4.160-1.el7.x86_64
    

    2.如果未出现以上的安装包,执行以下命令即可完成vim包的安装:

    $ yum -y install vim*

    3.测试vim包是否安装成功:

    [xi@localhost ~]$ vim --version
    VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 10 2014 06:55:55)

    --------------------------------------------------------------------------------------------------------------------------

    P.S. vim编辑器环境配置:

    是在用户登录的~目录下创建一个 .vimrc文件,在其中进行自己习惯的编程环境的设置,这样当别的用户使用时并不相互影响。

    [xi@localhost ~]$ cd ~
    [xi@localhost ~]$ ls
    Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
    [xi@localhost ~]$ touch .vimrc
    [xi@localhost ~]$ vim .vimrc
    

    在.vimr c文件中输入以下内容:

    set nu // 设置显示行号 
    set showmode //设置在命令行界面最下面显示当前模式等。
    set ruler //设置在右下角显示光标所在的行数等信息   
    set autoindent // 设置每次单击Enter键后,光标移动到下一行时与上一行的起始字符对>齐
    syntax on // 即设置语法检测,当编辑C或者Shell脚本时,关键字会用特殊颜色显示
  • 相关阅读:
    springboot访问redis序列化问题
    观察者模式在源码中的使用
    抽象工厂模式在源码中的使用
    工厂方法模式在源码中的应用
    策略模式的应用
    springcloud实现限流
    Elasticsearch
    java8新特性(二)StreamApi
    thinkpaidE450 win10 进入bios
    restframe_work2
  • 原文地址:https://www.cnblogs.com/xixihuang/p/5404648.html
Copyright © 2011-2022 走看看