diff --git a/README.md b/README.md index 29ea594..a75607a 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,24 @@ + # nvim-spider 🕷️🕸️ + Use the `w`, `e`, `b` motions like a spider. Move by subwords and skip insignificant punctuation. -Lua implementation of CamelCaseMotion, with extra consideration of punctuation. Works in normal, visual, and operator-pending mode. Supports counts and dot-repeat. +A lua implementation of [CamelCaseMotion](https://github.com/bkad/CamelCaseMotion), with extra consideration of punctuation. Works in normal, visual, and operator-pending mode. Supports counts and dot-repeat. + + - - [Features](#features) - - [Subword Motion](#subword-motion) - - [Skipping Insignificant Punctuation](#skipping-insignificant-punctuation) + * [Subword Motion](#subword-motion) + * [Skipping Insignificant Punctuation](#skipping-insignificant-punctuation) - [Installation](#installation) - [Configuration](#configuration) - [Notes on Operator-pending Mode](#notes-on-operator-pending-mode) - [Subword Text Object](#subword-text-object) - [Credits](#credits) - + + ## Features The `w`, `e`, `b` (and `ge`) motions work the same as the default ones by vim, except for two differences: @@ -73,10 +77,30 @@ use { "chrisgrieser/nvim-spider" } No keybindings are created by default. Below are the mappings to replace the default `w`, `e`, and `b` motions with this plugin's version of them. ```lua -vim.keymap.set({"n", "o", "x"}, "w", "lua require('spider').motion('w')", { desc = "Spider-w" }) -vim.keymap.set({"n", "o", "x"}, "e", "lua require('spider').motion('e')", { desc = "Spider-e" }) -vim.keymap.set({"n", "o", "x"}, "b", "lua require('spider').motion('b')", { desc = "Spider-b" }) -vim.keymap.set({"n", "o", "x"}, "ge", "lua require('spider').motion('ge')", { desc = "Spider-ge" }) +vim.keymap.set( + { "n", "o", "x" }, + "w", + "lua require('spider').motion('w')", + { desc = "Spider-w" } +) +vim.keymap.set( + { "n", "o", "x" }, + "e", + "lua require('spider').motion('e')", + { desc = "Spider-e" } +) +vim.keymap.set( + { "n", "o", "x" }, + "b", + "lua require('spider').motion('b')", + { desc = "Spider-b" } +) +vim.keymap.set( + { "n", "o", "x" }, + "ge", + "lua require('spider').motion('ge')", + { desc = "Spider-ge" } +) ``` > __Note__ @@ -87,15 +111,17 @@ The `.setup()` call is optional. Currently, its only option is to disable the sk ```lua -- default value -require("spider").setup({ - skipInsignificantPunctuation = true -}) +require("spider").setup { + skipInsignificantPunctuation = true, +} ``` You can also pass this configuration table to the `motion` function: + ```lua -require('spider').motion('w', { skipInsignificantPunctuation = false }) +require("spider").motion("w", { skipInsignificantPunctuation = false }) ``` + Any options passed here will be used, and any options not passed will use the default configuration (from `setup()` or the default configuration) ## Notes on Operator-pending Mode @@ -106,7 +132,7 @@ In this plugin, such small inconsistencies are therefore deliberately not implem ## Subword Text Object -This plugins supports `w`, `e`, and `b` in operater-pending mode, but does not include a subword-variant of `iw`. For a version of `iw` that considers camelCase, check out the `subword` text object of [nvim-various-textobjs](https://github.com/chrisgrieser/nvim-various-textobjs). +This plugin supports `w`, `e`, and `b` in operater-pending mode, but does not include a subword-variant of `iw`. For a version of `iw` that considers camelCase, check out the `subword` text object of [nvim-various-textobjs](https://github.com/chrisgrieser/nvim-various-textobjs). ## Credits __Thanks__