Home > Article > System Tutorial > Learn Vim8 simply and improve Linux code editing efficiency!
As a Linux developer, do you often feel that you are not efficient when editing code, or do you hope to have a better code editor to improve work efficiency? If so, then you need to learn Vim8! Vim8 is a very powerful code editor and it is widely regarded as one of the best editors on Linux systems. Now, let us learn how to use Vim8 to improve our code editing efficiency.
For a Debian-like Linux distribution, such as Ubuntu, the command is as follows:
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \ libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \ libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \ python3-dev ruby-dev lua5.1 lua5.1-dev libperl-dev git
On Ubuntu 16.04, the name of the lua development package is liblua5.1-dev instead of lua5.1-dev.
If you know which language you will be using, feel free to remove packages you don't need. For example: Python2 python-dev or Ruby ruby-dev. This principle applies to much of this article.
For Fedora 20, it would be the following command:
sudo yum install -y ruby ruby-devel lua lua-devel luajit \ luajit-devel ctags git python python-devel \ python3 python3-devel tcl-devel \ perl perl-devel perl-ExtUtils-ParseXS \ perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \ perl-ExtUtils-Embed
This step is required on Fedora 20 to correct problems when installing XSubPP:
Make a symbolic link to xsubpp (perl) from /usr/bin to the perl directorysudo ln -s /usr/bin/xsubpp /usr/share/perl5/ExtUtils/xsubpp2. If you have vim installed, delete it.
sudo apt-get remove vim vim-runtime gvimIf it is Ubuntu 12.04.2, you may also need to delete the following packages at the same time:
sudo apt-get remove vim-tiny vim-common vim-gui-common vim-nox3. Get vim source code.
Note: If you use python, your configuration directory may have a specific machine name (such as config-3.5m-x86_64-linux-gnu). Check the /usr/lib/python[2/3/3.5] directory to find your python configuration directory and change the parameters of python-config-dir and/or python3-config-dir accordingly.
Add/remove the compilation parameters below to suit your setup. For example, if you don't plan to write any Lua scripts, you can remove enable-luainterp. At the same time, if you are not using vim8.0, please confirm that the following VIMRUNTIMEDIR parameters are set correctly (for example, if you use vim8.0a, use /usr/share/vim/vim80a). Remember, some vim installations install directly from /usr/share/vim
Under
; adjust the parameters to suit your system:
cd ~ git clone https://github.com/vim/vim.git cd vim ./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp=yes \ --enable-pythoninterp=yes \ --with-python-config-dir=/usr/lib/python2.7/config \ --enable-python3interp=yes \ --with-python3-config-dir=/usr/lib/python3.5/config \ --enable-perlinterp=yes \ --enable-luainterp=yes \ --enable-gui=gtk2 --enable-cscope --prefix=/usr make VIMRUNTIMEDIR=/usr/share/vim/vim80On Ubuntu 16.04, Python support will not work since both Python2 and Python3 are enabled at the same time. Read chirinosky's answer for a workaround.
If you want to easily uninstall vim in the future, you can use checkinstall to install it.
sudo apt-get install checkinstall cd ~/vim sudo checkinstallOtherwise, you can use make to install.
cd ~/vim sudo make installTo make vim your default editor, use update-alternative.
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1 sudo update-alternatives --set editor /usr/bin/vim sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1 sudo update-alternatives --set vi /usr/bin/vim4. Confirm the Vim application version.
If your gvim is not working (on ubuntu 12.04.1 LTS), try changing the –enable-gui=gtk2 parameter to –enable-gui=gnome2.
If you encounter problems, double-check that configure is configured using the correct Python configuration directory as mentioned at the beginning of step 3.
These configure and make commands assume that you are a Debian distribution, and the Vim runtime file directory is placed in /usr/share/vim/vim80/, which is not the default path of vim. The same is true for –prefix=/usr in the configure command. These parameters may be different for a Linux distribution that is not based on Debian, in which case try removing the –prefix variable in the configure command and VIMRUNTIMEDIR in the make command (in other words, use these parameter's default value).
Through this article, we have learned about some basic commands and usage techniques of Vim8. Whether you are a newbie or an experienced developer, learning Vim8 is worthwhile because it can help you edit code faster and work more efficiently. I hope this article is helpful to you and can inspire your interest in more in-depth learning and exploration in Linux systems. ###
The above is the detailed content of Learn Vim8 simply and improve Linux code editing efficiency!. For more information, please follow other related articles on the PHP Chinese website!