How To Install vim-snipmate on Ubuntu 20.04

In this tutorial we learn how to install vim-snipmate on Ubuntu 20.04. vim-snipmate is Vim script that implements some of TextMates snippets features.

Introduction

In this tutorial we learn how to install vim-snipmate on Ubuntu 20.04.

What is vim-snipmate

vim-snipmate is:

SnipMate.vim aims to be an unobtrusive, concise vim script that implements some of TextMate’s snippets features in Vim. A snippet is a piece of often-typed text that you can insert into your document using a trigger word followed by a .

For instance, in a C file using the default installation of snipMate.vim, if you type “for” in insert mode, it will expand a typical for loop in C:

for (i = 0; i < count; i++) {

}

To go to the next item in the loop, simply over to it; if there is repeated code, such as the “i” variable in this example, you can simply start typing once it’s highlighted and all the matches specified in the snippet will be updated.

snipMate.vim has the following features among others:

  • The syntax of snippets is very similar to TextMate’s, allowing easy conversion.
  • The position of the snippet is kept transparently (i.e., it does not use marks/placeholders inserted into the buffer), allowing you to escape out of an incomplete snippet, something particularly useful in Vim.
  • Variables in snippets are updated as-you-type.
  • Snippets can have multiple matches.
  • Snippets can be out of order. For instance, in a do…while loop, the condition can be added before the code.

There are three methods to install vim-snipmate on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install vim-snipmate Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install vim-snipmate using apt-get by running the following command:

sudo apt-get -y install vim-snipmate

Install vim-snipmate Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install vim-snipmate using apt by running the following command:

sudo apt -y install vim-snipmate

Install vim-snipmate Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install vim-snipmate using aptitude by running the following command:

sudo aptitude -y install vim-snipmate

How To Uninstall vim-snipmate on Ubuntu 20.04

To uninstall only the vim-snipmate package we can use the following command:

sudo apt-get remove vim-snipmate

Uninstall vim-snipmate And Its Dependencies

To uninstall vim-snipmate and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove vim-snipmate

Remove vim-snipmate Configurations and Data

To remove vim-snipmate configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge vim-snipmate

Remove vim-snipmate configuration, data, and all of its dependencies

We can use the following command to remove vim-snipmate configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge vim-snipmate

References

Summary

In this tutorial we learn how to install vim-snipmate package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.