The Vimwiki logo.
Friday, March 8, 2024

How do I setup lazyvim and vimwiki?

Welcome to my new blog about my daily life as a developer. I’m going to start by explaining how to setup LazyVim and Vimwiki. This is a guide for beginners and experienced users. I hope you find it useful.

What is lazyvim?

Lazyvim is a Neovim setup powered by lazy.nvim that helps you to manage your Neovim configuration. It’s a great tool for beginners because it provides a set of default configurations and plugins that are useful for most users. It also provides a set of commands to manage your configuration.

What is vimwiki?

Vimwiki is a personal wiki for Vim – a number of linked text files that have their own syntax highlighting. It’s a great tool for taking notes, managing to-do lists, and organizing information. I used Vimwiki to write this blog post.

Setting up lazyvim

Personally I set a git repository for my Lazyvim configuration, so I can easily share it across different machines. This repository is practically a copy of the lazyvim minimal configuration. There are two folders that are important to me inside lua folder: config and plugins. The config folder contains the configuration for the plugins, and the plugins folder contains the plugins that I use. Today we are going to focus on the plugins folder.

In the plugins folder, I have a file called vimwiki.lua that contains the configuration for Vimwiki. This file is automatically loaded by lazyvim. Here is the content of the file:

return {
  -- The plugin location on GitHub
  -- The event that triggers the plugin
  event = "BufEnter *.md",
  -- The keys that trigger the plugin
  keys = { "<leader>ww", "<leader>wt" },
  -- The configuration for the plugin
  init = function()
    vim.g.vimwiki_list = {
        -- Here will be the path for your wiki
        path = "~/vimwiki/",
        -- The syntax for the wiki
        syntax = "markdown",
        ext = "md",
    vim.g.vimwiki_ext2syntax = { }

Here we can see an important part of my own configuration. I set the syntax for the wiki to markdown, this is because I use Obsidian to manage my notes and I want to be able to use the same syntax for my notes. I also set the path for my wiki to ~/vimwiki/. This is the default path, but you can set it to any path you want.

With this minimal configuration, you can start using Vimwiki. To open the wiki, you can use the command :VimwikiIndex and to create a new wiki page, you can use the command :VimwikiMakeDiaryNote.

Share on Twitter Twitter logo