diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6ebce2b..fda1067 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,7 +12,7 @@ jobs: - name: panvimdoc uses: kdheepak/panvimdoc@main with: - vimdoc: template + vimdoc: exercism version: "Neovim >= 0.8.0" demojify: true treesitter: true diff --git a/README.md b/README.md index 04516cf..08547aa 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Last Updated -

Ready to go Neovim template 🏗️✈️

+

Ready to go Neovim exercism 🏗️✈️

exercism.nvim in action @@ -34,10 +34,10 @@ exercism.nvim is a neovim plugin that allows neovim users to ``. ## ✨ Features -- Includes a ready to go neovim plugin template +- Includes a ready to go neovim plugin exercism - Comes with a lint and test CI action - Includes a Github action to auto generate vimdocs -- Comes with a ready to go README template +- Comes with a ready to go README exercism - Works with [mkrepo](https://github.com/2kabhishek/mkrepo) ## ⚡ Setup @@ -52,7 +52,7 @@ exercism.nvim is a neovim plugin that allows neovim users to ``. -- Lazy { '2kabhishek/exercism.nvim', - cmd = 'TemplateHello', + cmd = 'ExercismHello', -- Add your custom configs here, keep it blank for default configs (required) opts = {}, -- Use this for local development @@ -63,12 +63,12 @@ exercism.nvim is a neovim plugin that allows neovim users to ``. ## 🚀 Usage 1. Fork the `exercism.nvim` repo -2. Update the plugin name, file names etc, change `template` to `your-plugin-name` +2. Update the plugin name, file names etc, change `exercism` to `your-plugin-name` 3. Add the code required for your plugin, - - Code entrypoint is [template.lua](./lua/template.lua) - - Add user configs to [config.lua](./lua/template/config.lua) - - For adding commands and keybindngs use [commands.lua](./lua/template/commands.lua) - - Separate plugin logic into modules under [modules](./lua/template/) dir + - Code entrypoint is [exercism.lua](./lua/exercism.lua) + - Add user configs to [config.lua](./lua/exercism/config.lua) + - For adding commands and keybindngs use [commands.lua](./lua/exercism/commands.lua) + - Separate plugin logic into modules under [modules](./lua/exercism/) dir 4. Add test code to the [tests](./tests/) directory 5. Update the README 6. Tweak the [docs action](./.github/workflows/docs.yml) file to reflect your username, commit message and plugin name @@ -80,7 +80,7 @@ exercism.nvim is a neovim plugin that allows neovim users to ``. exercism.nvim can be configured using the following options: ```lua -template.setup({ +exercism.setup({ name = 'exercism.nvim', -- Name to be greeted, 'World' by default }) ``` @@ -89,19 +89,19 @@ template.setup({ `exercism.nvim` adds the following commands: -- `TemplateHello`: Shows a hello message with the confugred name. +- `ExercismHello`: Shows a hello message with the confugred name. ### Keybindings It is recommended to use: -- `th,` for `TemplateHello` +- `th,` for `ExercismHello` > NOTE: By default there are no configured keybindings. ### Help -Run `:help template.txt` for more details. +Run `:help exercism.txt` for more details. ## 🏗️ What's Next @@ -117,7 +117,7 @@ Planning to add ``. ### 🌈 Inspiration -exercism.nvim was inspired by [nvim-plugin-template](https://github.com/ellisonleao/nvim-plugin-template), I added some changes on top to make setting up a new plugin faster. +exercism.nvim was inspired by [nvim-plugin-exercism](https://github.com/ellisonleao/nvim-plugin-exercism), I added some changes on top to make setting up a new plugin faster. ### 💡 Challenges/Learnings diff --git a/doc/template.txt b/doc/exercism.txt similarity index 51% rename from doc/template.txt rename to doc/exercism.txt index c04e576..6c3dc80 100644 --- a/doc/template.txt +++ b/doc/exercism.txt @@ -1,27 +1,27 @@ -*template.txt* For Neovim >= 0.8.0 Last change: 2024 November 10 +*exercism.txt* For Neovim >= 0.8.0 Last change: 2024 November 10 ============================================================================== -Table of Contents *template-table-of-contents* +Table of Contents *exercism-table-of-contents* - - Features |template-features| - - Setup |template-setup| - - Usage |template-usage| - - What’s Next |template-what’s-next| - - Behind The Code |template-behind-the-code| + - Features |exercism-features| + - Setup |exercism-setup| + - Usage |exercism-usage| + - What’s Next |exercism-what’s-next| + - Behind The Code |exercism-behind-the-code| -template.nvim is a neovim plugin that allows neovim users to ``. +exercism.nvim is a neovim plugin that allows neovim users to ``. -FEATURES *template-features* +FEATURES *exercism-features* -- Includes a ready to go neovim plugin template +- Includes a ready to go neovim plugin exercism - Comes with a lint and test CI action - Includes a Github action to auto generate vimdocs -- Comes with a ready to go README template +- Comes with a ready to go README exercism - Works with mkrepo -SETUP *template-setup* +SETUP *exercism-setup* REQUIREMENTS ~ @@ -34,30 +34,30 @@ INSTALLATION ~ >lua -- Lazy { - '2kabhishek/template.nvim', - cmd = 'TemplateHello', + '2kabhishek/exercism.nvim', + cmd = 'ExercismHello', -- Add your custom configs here, keep it blank for default configs (required) opts = {}, -- Use this for local development - -- dir = '~/path-to/template.nvim', + -- dir = '~/path-to/exercism.nvim', }, < -USAGE *template-usage* +USAGE *exercism-usage* -1. Fork the `template.nvim` repo +1. Fork the `exercism.nvim` repo -2. Update the plugin name, file names etc, change `template` to `your-plugin-name` +2. Update the plugin name, file names etc, change `exercism` to `your-plugin-name` 3. Add the code required for your plugin, -- Code entrypoint is template.lua <./lua/template.lua> -- Add user configs to config.lua <./lua/template/config.lua> -- For adding commands and keybindngs use commands.lua <./lua/template/commands.lua> -- Separate plugin logic into modules under modules <./lua/template/> dir +- Code entrypoint is exercism.lua <./lua/exercism.lua> +- Add user configs to config.lua <./lua/exercism/config.lua> +- For adding commands and keybindngs use commands.lua <./lua/exercism/commands.lua> +- Separate plugin logic into modules under modules <./lua/exercism/> dir 4. Add test code to the tests <./tests/> directory @@ -76,37 +76,37 @@ username, commit message and plugin name CONFIGURATION ~ -template.nvim can be configured using the following options: +exercism.nvim can be configured using the following options: >lua - template.setup({ - name = 'template.nvim', -- Name to be greeted, 'World' by default + exercism.setup({ + name = 'exercism.nvim', -- Name to be greeted, 'World' by default }) < COMMANDS ~ -`template.nvim` adds the following commands: +`exercism.nvim` adds the following commands: -- `TemplateHello`Shows a hello message with the confugred name. +- `ExercismHello`Shows a hello message with the confugred name. KEYBINDINGS ~ It is recommended to use: -- `th,` for `TemplateHello` +- `th,` for `ExercismHello` NOTE: By default there are no configured keybindings. HELP ~ -Run `:help template.txt` for more details. +Run `:help exercism.txt` for more details. -WHAT’S NEXT *template-what’s-next* +WHAT’S NEXT *exercism-what’s-next* Planning to add ``. @@ -118,13 +118,13 @@ TO-DO ~ - Start typing -BEHIND THE CODE *template-behind-the-code* +BEHIND THE CODE *exercism-behind-the-code* INSPIRATION ~ -template.nvim was inspired by nvim-plugin-template -, I added some changes on +exercism.nvim was inspired by nvim-plugin-exercism +, I added some changes on top to make setting up a new plugin faster. diff --git a/lua/exercism.lua b/lua/exercism.lua new file mode 100644 index 0000000..cbfc4d1 --- /dev/null +++ b/lua/exercism.lua @@ -0,0 +1,6 @@ +return { + setup = function(opts) + require('exercism.config').setup(opts) + require('exercism.commands').setup() + end, +} diff --git a/lua/template/commands.lua b/lua/exercism/commands.lua similarity index 56% rename from lua/template/commands.lua rename to lua/exercism/commands.lua index c3d36d6..1ad4db2 100644 --- a/lua/template/commands.lua +++ b/lua/exercism/commands.lua @@ -1,12 +1,12 @@ -local template_module = require('template.module') -local config = require('template.config') +local exercism_module = require('exercism.module') +local config = require('exercism.config') local M = {} M.setup = function() -- Add all user commands here - vim.api.nvim_create_user_command('TemplateHello', function(opts) - template_module.greet(opts.args) + vim.api.nvim_create_user_command('ExercismHello', function(opts) + exercism_module.greet(opts.args) end, { nargs = '?' }) if config.add_default_keybindings then @@ -15,7 +15,7 @@ M.setup = function() end -- Add all keybindings here - add_keymap('Th', ':TemplateHello Neovim (btw!)', 'Template says hi') + add_keymap('Th', ':ExercismHello Neovim (btw!)', 'Exercism says hi') end end diff --git a/lua/template/config.lua b/lua/exercism/config.lua similarity index 69% rename from lua/template/config.lua rename to lua/exercism/config.lua index 72f86c8..b9e470b 100644 --- a/lua/template/config.lua +++ b/lua/exercism/config.lua @@ -1,19 +1,20 @@ -- Define config structure here, setup function will override defaults with user config ----@class TemplateModule +---@class ExercismModule local M = {} ----@class TemplateConfig +---@class ExercismConfig ---@field name string ---@field add_default_keybindings boolean local config = { name = 'World!', + exercism_workspace = vim.fn.expand('~/exercism'), add_default_keybindings = true, } ----@type TemplateConfig +---@type ExercismConfig M.config = config ----@param args TemplateConfig? +---@param args ExercismConfig? M.setup = function(args) M.config = vim.tbl_deep_extend('force', M.config, args or {}) end diff --git a/lua/template/module.lua b/lua/exercism/module.lua similarity index 81% rename from lua/template/module.lua rename to lua/exercism/module.lua index aaaef3c..f7b70a5 100644 --- a/lua/template/module.lua +++ b/lua/exercism/module.lua @@ -1,6 +1,6 @@ ---@class CustomModule local M = {} -local config = require('template.config').config +local config = require('exercism.config').config ---@return string M.greet = function(name) @@ -12,7 +12,7 @@ end M.show_notification = function(message) vim.notify(message, vim.log.levels.INFO, { - title = 'Template', + title = 'Exercism', timeout = 5000, }) end diff --git a/lua/template.lua b/lua/template.lua deleted file mode 100644 index f54e1c9..0000000 --- a/lua/template.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - setup = function(opts) - require('template.config').setup(opts) - require('template.commands').setup() - end, -} diff --git a/tests/module_spec.lua b/tests/module_spec.lua index 74ebe48..9382d3f 100644 --- a/tests/module_spec.lua +++ b/tests/module_spec.lua @@ -1,14 +1,14 @@ -local template = require('template') -local module = require('template.module') +local exercism = require('exercism') +local module = require('exercism.module') describe('greet', function() it('returns message with config value', function() - template.setup() + exercism.setup() assert(module.greet() == 'Hello World!') end) it('returns message with user arg', function() - template.setup() + exercism.setup() assert(module.greet('Neovim') == 'Hello Neovim') end) end)