Logo

dev-resources.site

for different kinds of informations.

Enhancing Elixir Development in LazyVim: Quick Documentation Access by Telescope

Published at
12/16/2024
Categories
elixir
lazyvim
neovim
Author
abreujp
Categories
3 categories in total
elixir
open
lazyvim
open
neovim
open
Author
7 person written this
abreujp
open
Enhancing Elixir Development in LazyVim: Quick Documentation Access by Telescope

When working with Elixir in LazyVim, having quick access to documentation is essential for maintaining a smooth development workflow. This article explores how to set up and use the elixir-extras.nvim plugin to access Elixir documentation directly within your Neovim environment.

Setting Up elixir-extras.nvim

First, you'll need to add the plugin configuration to your LazyVim setup. Create or modify your plugins configuration file with the following code:

return {
  {
    "emmanueltouzery/elixir-extras.nvim",
    lazy = true,
    ft = "elixir",
    dependencies = {
      "nvim-telescope/telescope.nvim",
    },
    keys = {
      { "<leader>ed", function() require("elixir-extras").elixir_view_docs({}) end, desc = "Elixir View Docs" },
      { "<leader>em", function() require("elixir-extras").elixir_view_docs({ include_mix_libs = true }) end, desc = "Elixir View Docs (mix libs)" },
      { "<leader>ec", function() require("elixir-extras").module_complete() end, desc = "Elixir Module Complete" },
    },
    config = function()
      require("elixir-extras").setup_multiple_clause_gutter()
    end,
  },
}
Enter fullscreen mode Exit fullscreen mode

Understanding the Configuration

Let's break down the key components:

  • lazy = true: Enables lazy loading for better startup performance
  • ft = "elixir": Activates the plugin only for Elixir files
  • dependencies: Requires Telescope for the documentation viewer
  • keys: Maps specific key combinations for different documentation features

Key Bindings

The configuration sets up three main key bindings:

  1. <leader>ed: View Elixir core documentation
  2. <leader>em: View documentation including mix dependencies
  3. <leader>ec: Access module completion

Documentation Examples

Here's how the documentation viewer looks in Neovim:

Core Elixir Documentation (<leader>ed)

Core Elixir Documentation showing Enum module

Mix Dependencies Documentation (<leader>em)

Mix Documentation showing ExDoc.Markdown module

Accessing Third-Party Documentation

To ensure documentation for third-party libraries is available, you need to:

  1. Add ex_doc to your project dependencies:
defp deps do
  [
    {:ex_doc, "~> 0.35", only: :dev, runtime: false}
  ]
end
Enter fullscreen mode Exit fullscreen mode
  1. Generate the documentation:
mix deps.get
mix docs
Enter fullscreen mode Exit fullscreen mode

Benefits

This configuration provides several advantages:

  • Instant documentation access without leaving Neovim
  • Seamless integration with LazyVim's existing features
  • Quick access to both core Elixir and third-party documentation
  • Improved development workflow efficiency

Conclusion

By integrating elixir-extras.nvim with LazyVim, you can significantly enhance your Elixir development experience. The quick access to documentation helps maintain flow while coding and reduces context switching between your editor and external documentation sources.

Remember to keep your documentation up to date by running mix docs when adding new dependencies to ensure comprehensive documentation coverage in your development environment.

neovim Article's
30 articles in total
Favicon
How to Enable Undercurl in Neovim: Terminal and Tmux Setup Guide
Favicon
Hassle free flutter Development in Hyprland with Neovim
Favicon
How to setup VueJs in Neovim (January 2025)
Favicon
Setting Up NeoVim + LazyVim on My New Mac Mini M4 💻✨
Favicon
Zed IDE vs. NeoVim and Other IDEs: The Future of Modern Coding Environments
Favicon
Enhancing Elixir Development in LazyVim: Quick Documentation Access by Telescope
Favicon
Lazyvim version 14.x in WSL
Favicon
From Vi to NeoVim: A Journey into the Heart of Text Editing
Favicon
As a beginner I use Arch, Neovim and code in assembly btw
Favicon
How to Setup Vim for Kotlin Development
Favicon
This developer created a 2K star repo from his phone
Favicon
Atomic Note-Taking Guide
Favicon
obsidian neovim markdown
Favicon
What I've Learned About My Editing Skills
Favicon
Vim Regex Tricks - Capitalize Every First Letter
Favicon
Lite 🚀 ApolloNvim Distro 2024
Favicon
[SOLVED] Vue 3 + TypeScript + Inlay Hint support in NeoVim
Favicon
Migrating from VSCode to Neovim: A Journey of Learning, Confusion, and Triumph! 🚀
Favicon
Managing LSPs in Neovim: Enable/Disable for the Entire Session
Favicon
Create a New Note for Your Obsidian Vault from the Terminal
Favicon
Faking the tmux experience on Windows using AutoHotkey
Favicon
How to resume neovim session
Favicon
Can't believe I've created 20 vim plugins since 2016
Favicon
Top 5 Neovim Repositories in this Week
Favicon
Compile Neovim in Debian/Ubuntu Linux
Favicon
Neovim for beginners
Favicon
Make environment to develop commonlisp with NeoVim
Favicon
Setting up neovim for web development in Golang
Favicon
Github copilot setup on Austronvim
Favicon
How I Developed My First Neovim Plugin: A Step-by-Step Guide

Featured ones: