Table of Contents
1. First, install all necessary libraries including Git. " >1. First, install all necessary libraries including Git.
Home System Tutorial LINUX Learn Vim8 simply and improve Linux code editing efficiency!

Learn Vim8 simply and improve Linux code editing efficiency!

Feb 13, 2024 am 10:39 AM
linux linux tutorial linux system linux command shell script embeddedlinux Getting started with linux linux learning

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.

Learn Vim8 simply and improve Linux code editing efficiency!

1. First, install all necessary libraries including Git.

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
Copy after login

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
Copy after login

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 directory

sudo ln -s /usr/bin/xsubpp /usr/share/perl5/ExtUtils/xsubpp
Copy after login
2. If you have vim installed, delete it.

sudo apt-get remove vim vim-runtime gvim
Copy after login

If 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-nox
Copy after login
3. 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/vim80
Copy after login

On 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 checkinstall
Copy after login

Otherwise, you can use make to install.

cd ~/vim
sudo make install
Copy after login

To 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/vim
Copy after login
4. 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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

See all articles