README.md

August 4, 2025 ยท View on GitHub

exercism.nvim

License People Stars Forks Watches Last Updated

Exercism Meets Neovim ๐Ÿ’ช๐Ÿง 

exercism.nvim in action
exercism.nvim in action

exercism.nvim integrates exercism into Neovim by providing a set of commands and keybindngs to help you solve exercises faster.

โœจ Features

  • Browse and choose exercises from the entire exercism library from within Neovim
  • Quickly test and submit your solutions
  • Review your existing solution for an exercise
  • Track and revisit recently opened exercises
  • Simple keybindings and commands to make your workflow faster

โšก Setup

โš™๏ธ Requirements

  • utils.nvim for utility functions

  • termin.nvim for terminal support

  • exercism-cli installed and configured

    • Make sure to login with exercism configure
  • tmux-tea (optional, recommended) for separate tmux sessions for each exercise

    • Use set -g @tea-default-command 'nvim' for a better experience

๐Ÿ’ป Installation

-- Lazy
{
    '2kabhishek/exercism.nvim',
    cmd = { 'Exercism' },
    keys = { '<leader>exa', '<leader>exl', '<leader>exr' }, -- add your preferred keybindings
    dependencies = {
        '2kabhishek/utils.nvim', -- required, for utility functions
        '2kabhishek/termim.nvim', -- optional, better UX for running tests
    },
    -- Add your custom configs here, keep it blank for default configs (required)
    opts = {},
},

๐Ÿš€ Usage

Configuration

exercism.setup({
    exercism_workspace = '~/exercism', -- Default workspace for exercism exercises
    default_language = 'ruby', -- Default language for exercise list
    add_default_keybindings = true, -- Whether to add default keybindings
    max_recents = 30, -- Maximum number of recent exercises to keep
    icons = {
        concept = '๏…', -- Icon for concept exercises
        practice = '๏”ง', -- Icon for practice exercises
    },
})

Commands

exercism.nvim provides a unified command interface with tab completion:

  • Exercism languages - Lists all available languages, select one to list exercises
  • Exercism list [language] - Lists exercises for the specified language, show exercises for default language if not specified
  • Exercism test - Runs tests for the current exercise
  • Exercism submit - Submits the current exercise
  • Exercism open <language> <exercise> - Opens a specific exercise directly in the specified language
  • Exercism exercise <exercise> - Opens a specific exercise directly using the default language
  • Exercism recents - Shows recently opened exercises in a fuzzy searchable list

Keybindings

Here are the default keybindings:

KeybindingCommandDescription
<leader>exaExercism languagesList all available languages
<leader>exlExercism list [language]List exercises for the specified language
<leader>extExercism testRun tests for the current exercise
<leader>exsExercism submitSubmit the current exercise

You can change these by setting add_default_keybindings to false and adding your own keybindings.

Help

Run :help exercism.txt for more details.

๐Ÿ—๏ธ What's Next

โœ… To-Do

  • Add tests

โ›… Behind The Code

๐ŸŒˆ Inspiration

I really like exercism but the back and forth between the browser and the terminal was a bit annoying. So I decided to integrate it with Neovim.

๐Ÿ’ก Challenges/Learnings

  • I build exercism-fetcher to fetch exercises from exercism's github repos.
  • Reused knowledge from octohub.nvim, not too many challenges here.

๐Ÿ” More Info


โญ hit the star button if you found this useful โญ

Source | Blog | Twitter | LinkedIn | More Links | Other Projects