chrisgrieser / nvim-spider

Use the w, e, b motions like a spider. Move by subwords and skip insignificant punctuation.
MIT License
667 stars 13 forks source link

Feature Request: Add instructions for adding keymaps to lazy config #30

Closed Anthony-Fiddes closed 1 year ago

Anthony-Fiddes commented 1 year ago

Feature Requested

Since the default is for this plugin to be lazy loaded, maybe a section could be added explaining how to load the plugin when one of the motions is pressed? (I may be missing something super simple)

I found that my lazy config for the plugin looks like this:

    {
      "chrisgrieser/nvim-spider",
      keys = { "w", "e", "b", "ge" },
      config = function()
        vim.keymap.set({ "n", "o", "x" }, "w", "<cmd>lua require('spider').motion('w')<CR>", { desc = "Spider-w" })
        vim.keymap.set({ "n", "o", "x" }, "e", "<cmd>lua require('spider').motion('e')<CR>", { desc = "Spider-e" })
        vim.keymap.set({ "n", "o", "x" }, "b", "<cmd>lua require('spider').motion('b')<CR>", { desc = "Spider-b" })
        vim.keymap.set({ "n", "o", "x" }, "ge", "<cmd>lua require('spider').motion('ge')<CR>", { desc = "Spider-ge" })
      end,
      lazy = true,
    },

If I don't add the keymaps or set lazy=false, then the subword motions don't work.

Relevant Screenshot

No response

Checklist

chrisgrieser commented 1 year ago

can be easier done via keys. See the updated README

Anthony-Fiddes commented 1 year ago

The change is awesome, thanks!