Tip 1Installing Vim 8
images/vim-8-only.png

You probably have Vim installed on your system, but you may not have the latest version. In this tip, you’ll get some pointers on how to install version 8 of Vim.

You can find out which version of Vim you have installed using the --version flag. This excerpt shows the version currently installed on my Mac:

=> $ vim --version
<= VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Aug 15 2017 05:26:25)
 MacOS X (unix) version
 Included patches: 1-946
 Huge version without GUI. Features included (+) or not (-):
 +acl +file_in_path +mouse_sgr +tag_old_static
 +arabic +find_in_path -mouse_sysmouse -tag_any_white
 +autocmd +float +mouse_urxvt -tcl
 ...

The first line shows that this is version 8.0, and you can also see which features have been enabled in your build of Vim. You want to make sure that your build has the +job, +channel, +timers, and +packages features enabled.

If you’re on an older version of Vim, you’ll need to upgrade. You could download a prebuilt binary using your package manager, or you could download the source code from GitHub and build it yourself. Following are instructions for installing Vim on Debian and macOS.

Installing Vim 8 on Linux

Linux users should be able to get Vim with their package manager. For example, on Debian, you’d install Vim by running:

=> $ sudo apt-get install vim

If you’re still on version 7 after running that command, then you’ll need to install the Personal Package Archive (PPA):

=> $ sudo add-apt-repository ppa:jonathonf/vim
=> $ sudo apt update
=> $ sudo apt install vim

Installing Vim 8 on macOS

On macOS, you can install Vim using Homebrew:

=> $ brew install vim

If you previously used Homebrew to install an older version of Vim, then you’ll want to run this instead:

=> $ brew upgrade vim

Contextual Instructions for Vim

Throughout this book, you’ll come across generalized instructions that look like this:

=> $ mkdir -p $VIMCONFIG/pack/bundle/start
=> $ mkdir -p $VIMDATA/undo

When running Vim on Unix, you could execute those commands by running:

=> $ mkdir -p ~/.vim/pack/bundle/start
=> $ mkdir -p ~/.vim/undo

Alternatively, you could set the $VIMCONFIG and $VIMDATA variables for your shell. For example, in bash you would run:

=> $ export VIMCONFIG=~/.vim
=> $ export VIMDATA=~/.vim

Having set these variables, you could then run the mkdir -p $VIMCONFIG/pack/bundle/start and mkdir -p $VIMDATA/undo commands verbatim.

You might be wondering why there are two variables set to the same value. That’s because Neovim uses different directories to store configuration and data, whereas Vim makes no such distinction.

What’s Next?

After upgrading to Vim 8, your existing vimrc should continue to work just fine. You don’t need to change anything, but you might choose to modernize your configuration by using the new packages feature to install your plugins. Skip ahead to Chapter 2, Installing Plugins to learn more.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.199.243