Skip to content

Latest commit

 

History

History
203 lines (169 loc) · 5.68 KB

File metadata and controls

203 lines (169 loc) · 5.68 KB

Tips for install & configure vim 8.x on CentOS 7.6

:octocat: Just a memo for me for setup VIM as IDE

$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

Install all the prerequisite libraries

$ yum install gcc make ncurses ncurses-devel
$ yum install ctags git tcl-devel \
ruby    ruby-devel     \
lua     lua-devel      \
luajit  luajit-devel   \
python  python-devel   \
python3 python3-devel  \
perl    perl-devel     \
perl-ExtUtils-ParseXS  \
perl-ExtUtils-XSpp     \
perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed

Remove the existing Vim if you have already installed it

$ yum list installed | grep -i vim
$ yum remove vim-enhanced vim-common vim-filesystem

Download Vim source

$ git clone https://github.com/vim/vim.git
$ cd vim

Configure

$ ./configure --with-features=huge \
--enable-multibyte \
--enable-python3interp \
--enable-rubyinterp \
--enable-perlinterp \
--enable-luainterp \
--enable-cscope \
--enable-largefile \
--enable-fail-if-missing \
--prefix=/usr/local/

🏷️ Note:

VIM does NOT support python and python3 at the same time.
UltiSnips.vim has some problem with python, error like below would occur with python

E837: This Vim cannot execute :py3 after using :python  

🚩It is recommended to compile vim with python3 support.

You can use below method to check your vim's python enablement: Enter command mode, type :echo has('python3') or :echo has('python'). If the output is '1', it means supported, else the output is '0'.

Build and install

$ make
$ make install

Check Vim version

$ vim --version | less

check if: +lua +multi_byte +perl +python3 +ruby vim python enablement

Change color scheme of vim

  1. Enter command mode and input ":terminal"
  2. Check available color scheme in the system by command
$ ls -l /usr/share/vim/vim*/colors/
  1. Edit "~/.vimrc" and add below lines
syntax on
colorscheme torte

Note: The torte here is the color scheme you choose for update

  • Add ls related command to /usr/bin
$ ln -s /usr/local/bin/vim /usr/bin/vim 
$ ln -s /usr/local/bin/vimdiff /usr/bin/vimdiff 
$ ln -s /usr/local/bin/vimtutor /usr/bin/vimtutor 

To customize VIM into one IDE

✔️ Install the dependency, including nodejs, ag

  1. First, update the local repository to ensure you install the latest versions of Node.js and npm. Type in the following command:
$ sudo yum update
  1. Next, add the NodeSource repository to the system with:
$ curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
  1. The output will prompt you to use the following command if you want to install Node.js and npm:
$ sudo yum install -y nodejs
  1. Finally, verify the installed software with the commands:
$ node -version
$ npm -version

🏷️Reference

  1. Installing ag on CentOS

Prerequistes

Download, build and install
$ sudo yum install -y pcre-devel
$ sudo yum install xz-devel
$ cd /usr/local/src
$ sudo git clone https://github.com/ggreer/the_silver_searcher.git
$ cd the_silver_searcher
$ sudo ./build.sh
$ sudo make install
$ which ag

## Another way to install ag
$ yum install -y the_silver_searcher

🏷️Reference

  1. Clone and install vim config
$ git clone https://github.com/sebdah/vim-ide.git
$ cd vim-ide
$ sudo ./install.sh

neovim installation:atom:

## https://github.com/neovim/neovim/wiki/Installing-Neovim
$ yum -y install epel-release
$ curl -o /etc/yum.repos.d/dperson-neovim-epel-7.repo https://copr.fedorainfracloud.org/coprs/dperson/neovim/repo/epel-7/dperson-neovim-epel-7.repo 
$ yum -y install neovim --enablerepo=epel

The default path of Neovim:

  • ~/.vimrc has been replaced with ~/.config/nvim/init.vim. If you install neovim success but this folder does not display, you can create it manually.
  • ~/.vim folder has been replaced with ~/.local/share/nvim/site folder.

🏷️ Reference

How to fix VIM could not display color scheme properly in TMUX sessions

Add or update the TERM in /etc/proflie and set it to xterm-256color as below

TERM=xterm-256color
export TERM

To make the change take effects, you need to reboot host or source /etc/profile Besides, please make sure below configuration exists in your ~/.vimrc

set t_Co=256
set background=dark

How to check the configuration vim used?

:echo $MYVIMRC

Note: :version tells what locations are searched, but doesn't give any info regarding what files were found. For that the $MYVIMRC variable is useful, as is looking at output of :scriptnames for full list of all loaded script files, including all vimrc files

How to copy to clipboard in vim?

vim ~/.vimrc.local and add below lines

set mouse=v
set clipboard=unnamedplus

Learning Git