vim

What is Vim Org Mode

Vim Org Mode is a plugin for the Vim editor that integrates Org Mode functionality into Vim. Org Mode is a mode that assists with outlining, task management, and note-taking with a plain-text markup language.

The Org Mode is a useful tool for writing and managing tasks that was made for GNU Emacs. However, it can also be used in the Vim editor using a plugin called Vim Org Mode.

In this guide, I will be exploring how to integrate the Vim Org Mode plugin with the Vim editor and how to use it.

Note: Please be advised that for the purposes of this guide, I am using the Linux distribution (Ubuntu 22.04). The instructions will be identical for other Linux distributions but may differ for macOS and Windows.

Prerequisite

You need to install Emacs on Linux to fully utilize the capabilities of Vim Org Mode. To install Emacs on Linux through the APT package manager, use:

sudo apt install emacs

The Org Mode is designed for Emacs and is a major part of it. The entire Vim Org Mode plugin relies on Emacs to export the .org files in various formats.

Installing Vim Org Mode

You need a plugin manager to integrate the Org Mode in the Vim editor. The plugin manager is the easiest way to install plugins for Vim. Unfortunately, no plugin manager comes by default with the Vim editor, it has to be installed manually.

Different plugin managers such as Vim-Plug, Pathogen, Vundle, and Volt exist. All plugin managers are perfect, but in this guide, I will be installing Vim-Plug because it is easy to set up.

To install the Vim-Plug plugin manager, execute the following commands:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \

https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Now, place the call plug#begin() and call plug#end() tags in the vimrc file.

call plug#begin()

<Plugin Codes>

call plug#end()

In Vim, the plugins come in the form of codes, which can be placed between these two tags.

Let’s place the Org Mode plugin code in these tags:

call plug#begin()

Plug 'jceb/vim-orgmode' "Org Mode Plugin

Plug 'tpope/vim-speeddating' "To Insert Dates

Plug 'vim-scripts/utl.vim' "To Insert URLs

call plug#end()

The code is taken from a well-known Vim plugin source, VimAwesome.

You also need other plugins called SPEEDDATING and UTL to quickly insert the dates and URLs while editing the Org documents in Vim using Org Mode.

Save and quit the vimrc file using shift+zz keys or :wq command.

Open the Vim editor and run :PlugInstall command to install the Org Mode plugin.

:PlugInstall

The :PlugInstall command is used to install the plugins that are placed in the vimrc file. To delete the plugin, remove the plugin code from the vimrc file and run :PlugClean command in the Vim editor.

The Org Mode is successfully integrated with the Vim editor.

Using Vim Org Mode

Let’s create an Org file in the Vim editor to practically use the Org Mode in Vim.

# Org Document About LinuxHint

* Welcome to Linuxhint

A place to learn about Linux and open-source software.

** Main Categories

+ *Ubuntu*

+ Installing Vim

~sudo apt install vim~

+ Installing VLC

~sudo apt install vlc~

+ Configuring Apache

+ *Linux Commands*

+ cut Command

+ dig Command

+ grep Command

+ *Vim*

To learn more about Linux, Visit [[www.linuxhint.com][LinuxHint]]

2023:12:21 Thursday

** TODO Have you visited LinuxHint before?

+ [ ] No

+ [X] Yes

To proceed, launch Vim, paste the contents of the Org file given above, and save it with the .org extension.

You will notice the file is properly formatted with the integration of the Vim Org Mode plugin.

In the above file, the # symbol is used to add comments, while *, **, and *** indicate the heading level 1, 2, and 3. Plus symbol (+) is used to create an unordered list, while ** makes the text bold.

Use the ctrl+a and ctrl+x keys to increment or decrement a date or time component (number or words format), thanks to SPEEDDATING plugin.

Moreover, you can fold and unfold the heading by bringing the cursor over the heading and pressing the tab key.

To learn more about the org file markup, see the cheat sheet given below:

Exporting the Org File using Vim Org Mode

The Org Mode is also used to export the org files in different formats such as PDF, Beamer PDF, Markdown, LateX, and HTML.

Please note that you must have Emacs installed and configured on your Linux system to export the Org file using the Org Mode plugin.

To export the Org file as PDF, use:

:OrgExportToPDF

To export the Org file in HTML, BeamerPDF, LaTeX, and Markdown use the following commands:

:OrgExportToHTML

:OrgExportToMarkdown

:OrgExportToLaTeX

:OrgExportToBeamerPDF

Limitation of Vim Org Mode

It is important to note that Org Mode has not been fully implemented in Vim. Many features are still not available, unlike Emacs, such as:

  • Deadlines
  • Scheduling
  • Agenda Dispatcher
  • Clocking Work time
  • Tag Search
  • Publishing

And many others.

But future updates will surely bring all the major Org Mode features in Vim.

Conclusion

The Org Mode plugin enhances Vim’s functionalities, allowing users to take advantage of Org Mode’s capabilities without leaving Vim. You cannot use Org Mode with Vim out of the box, a plugin needs to be installed. The Org Mode for Vim still lacks many key features that are expected to come in the future. However, Org Mode integration does the job of creating a TODO list, navigating headings, and managing dates and times. Overall, the Org Mode is a valuable tool for those who prefer Vim’s interface while benefiting from Org Mode’s productivity features.

About the author

Sam U

I am a professional graphics designer with over 6 years of experience. Currently doing research in virtual reality, augmented reality and mixed reality.
I hardly watch movies but love to read tech related books and articles.