Git Product home page Git Product logo

nvim-spider's Issues

[Bug]: Unexpected behavior with cw command

Bug Description

I found and issue with the cw command. The default vim behavior when entering cw on a word in sentence is to preserve the post space which allows you to type a word and not have to add a space. This is in contrast to the dw command that deletes the post word space to make that word seem like it was never there.

Another unexpected behavior is that pressing cw on the last word in the line deletes the newline character as well. This makes the next line append to what is left of the current line.

ciw does work as expected and is recommended to use over cw but I thought I would raise it to your attention.

Relevant Screenshot

No response

To Reproduce

Type text, go to the begining of a word, and use the cw command. Type multiple lines and use cw command on any line but the last.

neovim version

0.8.3

Make sure you have done the following

  • I have updated to the latest version of the plugin.

[Bug]: ge mapping is slow

Bug Description

w, e, and b mappings are snappy. However, there is a noticeable lag with the ge mapping.

Relevant Screenshot

No response

To Reproduce

No response

neovim version

0.8.3

Make sure you have done the following

  • I have updated to the latest version of the plugin.

Feature Request: Pull in .editorconfig from your template repository

Feature Requested

Having adopted nvim-spider then digging into its code a little, I noted that it uses hard tabs but there's no .editorconfig file in this repository. It looks like the suitable editorconfig was added to your plugin template repo after this plugin's creation. It'd be great to see that file added here, to make contributors' lives easier when working on PRs.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Feature Request: Allow option for empty lines to be a significant punctuation (especially for change)

Feature Requested

Let's consider the case that we want to change a word in a phrase that isn't ended by significant punctuation and there are new lines after that. If we change a word, it will go to the next significant punctuation, which ends up being a completely new line. See the linked video example. I think this is a significant issue considering that it can delete a lot of space unexpectedly.

I think that making an option for empty lines being a significant punctuation is a decent solution to this, but I wanted to start a conversation to see what might be the best. Maybe one solution is seeing if there is a way that we can customize the behavior of Spider-w/e/b/ge such that when we are moving without any commands, it skips over new lines, but chained in commands it doesn't?

Relevant Screenshot

Screen.Recording.2023-05-10.at.7.27.37.PM.mov

Checklist

  • The feature would be useful to more users than just me.

[Question] Why ignore iskeyword?

The README mentions:

ℹ️ This plugin ignores vim's iskeyword option.

Can you elaborate on why a user would choose this plugin over setting the iskeyword option, and why this plugin doesn't use that internally?

Is it possible to achieve similar behavior using the built-in iskeyword option?

Thank you for your work on these various plugins! :)

[Bug]: motion("b") skipping over punctuation.

Bug Description

When moving from one line of text to the previous, using the "b" motion, the last punctuation token in the above line gets skipped, even though the "w" motion does not skip it. This behavior is a little bit unexpected.

Command used:

<Cmd>lua require('spider').motion('b')<CR>

Relevant Screenshot

Starting position:

image

Ending position:

image

Expected ending position:

image

Pressing "w" after this does still move to:

image

The token is not being ignored consistently. I think that the "b" motion should go to that ending parentheses.

To Reproduce

Steps to reproduce visualized in the above images.

neovim version

NVIM v0.9.0-dev-2535+geb1da498d-Homebrew

Make sure you have done the following

  • I have updated to the latest version of the plugin.

Feature Request: c-w (ctrl-w) should work

Feature Requested

c-w should work just like dw and the rest. c-w is used to delete word in insert mode.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Feature Request: support `wildfire.nvim`

Feature Requested

wildfire.nvim - plugin for based node selection
requested thing!

  • how to the OG dev can make CamelCaseMotion work for visual-mode as in wildfire.nvim
  • describe help for word selection which is already inside of word as CamelCaseMotion for Case

here is the relevant issue
thank you !

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

[Bug]: numbers in hex values are not ignored

Bug Description

Hey it's me again.

since the fix for bug #31 now motions in hex colors stop at numbers:

I would expect motions to ignore this gibberish but maybe it would be to hard to implement the skip efficently? I know vim knows how to recognize hex values natively because <C-x> and <C-a> can decrement and increment these respectively.

Reproduction & Sample Text

Code to try it out:

$selection  = 	 eceff4
$background = 	 2e3440
$red        = 	 EF5350
$green      = 	 66BB6A
$yellow     = 	 E2C12F
$blue       = 	 42A5F5
$mageta     = 	 AB47BC
$cyan       = 	 26C6DA
$foreground = 	 D8DEE9

neovim version

0.9.4

Special Settings

No response

Make sure you have done the following

[Bug]: Bugs when camelCase names have numbers in them

Bug Description

w and b skip over the number

example (^ are the positions the cursor jumps to with w and b)

divisibleBy10Test
^--------^---^

end skips over subword before number

example:

divisibleBy10Test
--------^---^---^

kebab-case works as expected.

Reproduction & Sample Text

...

neovim version

0.9.4

Special Settings

not that I know of.

Make sure you have done the following

[Bug]: Cursor gets stuck at end of line with multiple punctuation.

Bug Description

Operation: <Cmd>lua require('spider').motion('w')<CR>

This motion operation gets stuck when the last "word" in a line of text consists of only punctuation.

Reproduction & Sample Text

Before:

{( nested thing |)}
next line of text

After:

{( nested thing |)}
next line of text

Expected:

{( nested thing )}
|next line of text

Other example "Before" situations where the cursor gets stuck.

=== Title |===
next line of text
Haha |...
next line of text

neovim version

NVIM v0.9.0-dev-2557+gfd32a9875-Homebrew

Make sure you have done the following

  • In case I have an issue with using the motions in operater-pending mode (cw, de, …), I read the notes on operator-pending mode in the README.
  • I do not have set the options virtualedit=all or virtualedit=onemore.
  • I have updated to the latest version of the plugin.

[Bug]: Jumps are too large with `c`, `d`, `y` ... modifiers

Bug Description

Disclaimer: I'm not sure if this is a bug or expected behavior, but at least for me it's not the behavior I would expect.

Consider this sentence:

I do like nvim-spider
     ^

From here, dw will delete like n and not just like as I would expect in plain nvim. One (not me) might argue that this is actually what should happen in nvim as well, since vw will highlight like n. I am aware that I can achieve my intention with de, but since it's not what I would do in nvim, it feels a bit off. I guess I don't see the utility of deleting up to the first letter of the next word. Maybe that's why nvim doesn't do it either?

neovim version

0.8.3

Make sure you have done the following

  • I have updated to the latest version of the plugin.

Feature Request: iw and aw

Feature Requested

Hi!

Thank you for the great plugin!

Please keep it small and simple in the future.

It also needs iw and aw implementation without any external plugins.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Feature Request: Add WORD motions

Feature Requested

related to #20

I am currently using chaoren/vim-wordmotion, it allows me define uppercase_space

one example I defined = as an uppercase_space when I use W with vim-wordmotion

my_var_name=another_var_name
^___________^

Also I added '/' as a uppercase_space
so

`chrisgrieser/nvim-spider`
 ^____________^

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Feature Request: Word motion on camel case with capitalized acronyms

Feature Requested

At work, my team has a convention of using capitalized acronyms on camel case.

For example, we write anHTTPRequest instead of anHttpRequest.

Currently, spider.motion("w") would immediately move the cursor to R from the start.
With this feature, it would move the cursor to H first, then R on the next call.

I have tried hacking together a solution myself: https://github.com/enigmassive/nvim-spider/commit/46c6be65c15431c920b7b2878d4be5e0b6439645.
It seems to generally work out so far, but it doesn't work on e nor gE.

I think it would be great if this feature could be properly implemented.
Thank you for considering.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Feature Request: add option to disable subwords

Feature Requested

It would be nice to have an option to disable subword motion (independently from skipInsignificantPunctuation)

Use case:

Right now, if you set the following keymap:

vim.keymap.set({ "o" }, "W", "<cmd>lua require('spider').motion('w', { skipInsignificantPunctuation = true} )<CR>", { desc = "Spider-w" })

Using W, will still break on a subword.

It would be nice to have W both skip punctuation AND subwords, which would be more consistent in some cases.

Related: #1

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

[Bug]: Dot repeat is locking up the editor

Bug Description

Dot repeat with dew (I've mapped spider's d/e/b to ed/ee/eb) for example, is locking up the editor until I press enter, after which I get the following error:

E5108: Error executing lua: attempt to call a nil value
stack traceback:

Reproduction & Sample Text

Irrelevant

neovim version

v0.9.0 (latest)

Special Settings

lazy.vim:

return {
  "chrisgrieser/nvim-spider",
  keys = {
    { "ew", function() require("spider").motion("w") end, desc = "Spider-w", mode = { "n", "o", "x" } },
    { "ee", function() require("spider").motion("e") end, desc = "Spider-e", mode = { "n", "o", "x" } },
    { "eb", function() require("spider").motion("b") end, desc = "Spider-b", mode = { "n", "o", "x" } },
    { "ge", function() require("spider").motion("ge") end, desc = "Spider-ge", mode = { "n", "o", "x" } },
  },
  opts = {
    skipInsignificantPunctuation = false,
  },
}


### Make sure you have done the following

- [X] In case I have an issue with using the motions in operater-pending mode (`cw`, `de`, …), I read the [notes on operator-pending mode in the README](https://github.com/chrisgrieser/nvim-spider#notes-on-operator-pending-mode).
- [X] I have updated to the latest version of the plugin.

Feature Request: Add instructions for adding keymaps to lazy config

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

  • The feature would be useful to more users than just me.

Feature Request: Allow option for empty lines to be a significant punctuation (especially for change)

Feature Requested

Let's consider the case that we want to change a word in a phrase that isn't ended by significant punctuation and there are new lines after that. If we change a word, it will go to the next significant punctuation, which ends up being a completely new line. See the linked video example. I think this is a significant issue considering that it can delete a lot of space unexpectedly.

I think that making empty lines a significant punctuation is not the ideal solution to this, but I wanted to start a conversation to see what might be the best. Maybe one solution Is there a way that we can customize the behavior of Spider-w/e/b/ge such that when we are moving without any commands, it is

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Feature Request: Add support for `c`, `d`, and other verbs

Feature Requested

I'm not sure if this is a bug or a feature request, but wanted to err on the side of caution.

When using this plugin to navigate it works as expected. However, when this plugin is enabled, the keybindings are set, and it's set to skip insignificant punctuation it breaks things like cw because it will clear the word and all trailing insignificant punctuation. For example, if I have the string require('ThisCamelCaseFile').setup({...}) and my cursor is on the F in File and I type cw what I expect is that it would clear out File and leave me in insert mode after the e in Case and before the trailing '. Instead it's clearing out File'). and leaving me in insert mode after the e in Case and before the s in setup.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

[Bug]: Last word in line has off-by-one with operators

Bug Description

// no trailing whitespace in the line below
nvim-spider is great
               ^

Doing e.g. ce will leave you with

nvim-spider is t
               ^

It works fine when there is a trailing whitespace

neovim version

v0.9.0-dev-1312+g908494889

Make sure you have done the following

  • I have updated to the latest version of the plugin.

[Bug]: `motion("w")` skipping over a word.

Bug Description

When moving from one line of text to the next, the first word in the next line gets skipped. This only happens when the next line starts from the very first column (left edge).

Note: The "b" motion seems to behave correctly. The "b" motion skips over parentheses and brackets. Should I make a separate issue for that?

Relevant Screenshot

Initial position:

image

Position after

<Cmd>lua require('spider').motion('w')<CR>

image

The word "over" was skipped. The cursor should have jumped to:

image

To Reproduce

No response

neovim version

NVIM v0.9.0-dev-2535+geb1da498d-Homebrew

Make sure you have done the following

  • I have updated to the latest version of the plugin.

Feature Request: Add W, (g)E and B

Feature Requested

Hey, first of all thanks for the plugin!

Right now, there's only motions for w, e and b. In (Neo)vim, there's also W, E and B too. I'd love to see them being added.

Thanks!

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

[Bug]: Cannot bind to e.g. "<leader>w"

Bug Description

In vim I am using CamelCaseMotion and bind those to e.g. "w" when I want camelcase motion and leave w as it is by default. This also works with delete/change, so when my Cursor is at the start of "CamelCase" and I want to change it to "PascalCase" I can do "cwPascal" to do that. However when I try this in neovim either with CamelCaseMotion.vim or your plugin, when I type "c" it basically does the same thing as "s", it deletes the character I am on and puts me into insert mode right away.

Reproduction & Sample Text

before: CamelCase
----------^--------------
after: PascalamelCase
expected: PascalCase

neovim version

v0.10.0-dev

Special Settings

No response

Make sure you have done the following

Feature Request: skipInsignificantPunctuation only in normal mode?

Feature Requested

With some experimentation, although I like skipping punctuation in normal mode when I'm probably just trying to get to some word in the code. In operator or visual mode the original behavior is a bit more intuitive/useful

I could just not bind it but I still want subword motions. I think the most elegant and idiomatic to neovim plugins way is to allow passing a config struct in motion which, key-by-key, overrides the default config. That way a user could even bind multiple versions of the motions to different keys

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

[Bug]: consistent operator pending mode has no effect for me

Make sure you have done the following

Bug Description

Whether I set consistentOperatorPending to true or false, I don't see any change in the behavior of motions.

My configuration is as follows,

{
	"chrisgrieser/nvim-spider",
	lazy = false,
	opts = {
		consistentOperatorPending = true,
	},
	config = function(_, opts)
		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" })
		-- See: https://github.com/chrisgrieser/nvim-spider#operator-pending-mode-the-case-of-cw
		vim.keymap.set("n", "cw", "ce", { remap = true })
	end,
},

Reproduction & Sample Text

operation used: dw
before:

foo bar
--  ^
baz

after:

foo
   ^
--
baz

What I expected as per what I understood from the README,

foo baz
    ^

neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068

Special Settings

No response

Feature Request: Add option to use default keymaps

Feature Requested

Would be nice to just use the default keymaps if we like them, therefore reducing the need to explicitly adding the keymaps in config.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Feature Request: Allow to opt out of certain features

Feature Requested

Since your plugin has multiple very opinionated features it would be nice to be able to opt in and out of them independently. For instance if you want to skip insignificant punctuation but dont want to jump by subwords. I dont think this would be to hard to do either, just have them options for each feature:

opts = {
  skipInsignificantPunctionations = false,
  jumpSubWords = true
}

These could be defaulted to true so that its not annoying to setup. This would be even more useful if you ever consider adding more features to the plugin. And it will allow you to be less constrained by which features you add. (you dont have to have everyone like the feature)

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

[Bug]: Small inconsistency with cw: single letter words

Make sure you have done the following

Bug Description

If we'd want to have backwards compatibility with regular cw, then this case is not covered:

c<cmd>lua 
^  cursor on first letter

ce on the single letter word c initates a change word of the whole chunk c<cmd.
I'm talking about ce here because that's described as the "vanilla nvim cw behaviour".

Reproduction & Sample Text

c<cmd>lua 
^  cursor on first letter

command cefoo<Esc>

Actual text after: foo>lua

Expected text after foo<cmd>lua

neovim version

0.9.5

Special Settings

No response

Thanks for the nice plugin, I think your notion of insignificant punctuation is right. If this issue is just annoying, then let's close it, I just thought it was interesting to discuss this.

[Bug]: Movement stops at non-English accented letters

Bug Description

In normal mode, while the cursor is at the beginning of a word that has at least one accented letter in it, pressing w will jump to the character following that letter instead of to the next word.

Reproduction & Sample Text

before: |tükörfúrógép teszt
after: tü|körfúrógép teszt
expected: tükörfúrógép |teszt

In comparison, if the word has no accented letters in it (as in tukorfurogep teszt), pressing w works as expected.

neovim version

v0.9.0

Special Settings

No.

Make sure you have done the following

Feature Request/Bug? - Strange behavior on the last word of lines

Feature Requested

The Problem:

While spider is more consistent than vim's default w, e, and b motions in most cases, one case where spider falls short, in my opinion, is at the end of lines.

Below are several examples that show the differences between the current behaviors and expected behaviors.

Examples:

Legend:
Letters encased in () show the cursor position in normal mode.
| represents the position of the cursor in insert mode.
\n represents the existence of a newline in the examples (This is the easiest way to visualize a newline being deleted).

Behavior:

  • Spider will do nothing when you use dw on the last word of the last line.

Expected Behavior:

  • Spider should remove the word up to, but not including, the punctuation when using dw on the last word of the last line.

Example - dw on the last word of last line:

  • Current: Sample (t)ext\n. => Sample (t)ext.\n
  • Expected: Sample (t)ext\n. => Sample ().\n

Behavior:

  • Spider will only put the cursor into insert mode when using cw on the last word of the last line.

Expected Behavior:

  • Spider should remove the word up to, but not including, the punctuation when using cw on the last word of the last line.

Example - cw on the last word of last line:

  • Current: Sample (t)ext\n. => Sample |text.\n
  • Expected: Sample (t)ext\n. => Sample |.\n

Behavior:

  • Spider will remove newlines and punctuation when using dw on the last word of a line.

Expected Behavior:

  • Spider should remove the word up to, but not including, the punctuation when using dw on the last word of a line.

Example - dw on the last word of a line:

  • Current: Sample (t)ext\n. => Sample ()
  • Expected: Sample (t)ext\n. => Sample ().\n

Behavior:

  • Spider will remove newlines and punctuation when using cw on the last word of a line.

Expected Behavior:

  • Spider should remove the word up to, but not including, the punctuation when using cw on the last word of a line.

Example - cw on the last word of last line:

  • Current: Sample (t)ext\n. => Sample |
  • Expected: Sample (t)ext\n. => Sample |.\n

The Solution:

There are two possible solutions to this problem.

  1. Do nothing. This is the most simple option because users have the ability to make their own custom patterns.
  2. Make spider end-of-line aware. If spider is aware of the the end of a line then there are two possible ways to solve this problem.
    a. Spider falls back to the default vim binding to avoid deleting newlines and punctuation. Maybe the more simple option? Not sure.
    b. Introduce a new built-in pattern to use when the end-of-line condition is met. Again, might be really simple as well. Needs investigation.

These solutions can be made opt-in or default behavior - I don't mind implementing either.

Final Thoughts:

This may be a problem that is completely unique to me.
But, I do find it frustrating that punctuation and newlines get removed when I use dw or cw at the end of a line.
I wanted extra input before forking/solving/submitting a PR if this is a problem that nobody else cares about besides me.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.