CONFIG

lua/plugins.lua

#org-config #neovim
Published — Updated

There’s no officially blessed way to add extensions from external sources, so naturally there are about 20,000 options.

I use packer.nvim, which was inspired by Emacs use-package. I like the way use-package tries to manage things, so I figured “inspired by” works for me.

You can set up a little bootstrap code to install packer.nvim and your plugins.

local fn = vim.fn

local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
  packer_bootstrap = fn.system(
    {
      'git',
      'clone',
      '--depth', '1',
      'https://github.com/wbthomason/packer.nvim',
      install_path
    }
  )
end

This makes sure you have a copy of packer on your system. Then you make plugin synchronization a regular part of Neovim’s startup:


<<config-nvim-packer-bootstrap>>

return require('packer').startup(function(use)
  use "wbthomason/packer.nvim"

  <<config-nvim-plugins>>

  -- Automatically set up your configuration after cloning packer.nvim
  if packer_bootstrap then
    require('packer').sync()
  end
end)

So what plugins have I installed?

Catpuccino.nvim

Catppuccino is a lovely little batch of Neovim color schemes, which integrates with several other plugins and tools.

use {
    "Pocco81/Catppuccino.nvim",
    config = function()
        vim.cmd[[colorscheme catppuccino]]
    end
}

nvim-web-devicons

neovim-web-devicons lets you associate icons with file types and plugin actions, assuming you have a sufficiently patched font.

use "kyazdani42/nvim-web-devicons"

telescope.nvim

telescope is a finder / filterer / previewer / picker thing that handles fuzzy finding and more.

use {
    "nvim-telescope/telescope.nvim",
    requires = { {"nvim-lua/plenary.nvim"} },
}

Define some global key mappings to get at telescope functionality. For now I put these in init.lua.

map("n", "<space>ff", ":Telescope find_files<cr>")
map("n", "<space>fg", ":Telescope live_grep<cr>")
map("n", "<space>fb", ":Telescope buffers<cr>")
map("n", "<space>fh", ":Telescope help_tags<cr>")

vimwiki

  use "vimwiki/vimwiki"
  -- global wiki settings
  vim.g.vimwiki_auto_header = 1
  vim.g.vimwiki_conceal_onechar_markers = 0
  vim.g.vimwiki_dir_link = 'index'
  vim.g.vimwiki_folding = 'expr'
  vim.g.vimwiki_use_calendar = 0

  wiki_prime = {
    auto_diary_index = 1,
    auto_generate_links = 1,
    auto_generate_tags = 1,
    auto_tags = 1,
    auto_toc = 1,
    automatic_nested_syntaxes = 1,
    diary_caption_level = 2,
    list_margin = 0,
    name = 'prime',
    nested_syntaxes = {
      python = "python",
      lua = "lua"
    },
    path = '~/vimwiki/prime'
  }

  vim.g.vimwiki_list = {wiki_prime}

orgmode.nvim

Just because I’m using Org Mode doesn’t mean I want to be doing so in Emacs all the time. That’s where orgmode.nvim comes in.

use {'nvim-treesitter/nvim-treesitter'}
use {
  'kristijanhusak/orgmode.nvim',
  config = function()
    require('orgmode').setup{}
  end
}