chrisgrieser / nvim-spider Goto Github PK
View Code? Open in Web Editor NEWUse the w, e, b motions like a spider. Move by subwords and skip insignificant punctuation.
License: MIT License
Use the w, e, b motions like a spider. Move by subwords and skip insignificant punctuation.
License: MIT License
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.
No response
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.
0.8.3
w, e, and b mappings are snappy. However, there is a noticeable lag with the ge mapping.
No response
No response
0.8.3
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.
No response
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?
ℹ️ 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! :)
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>
Starting position:
Ending position:
Expected ending position:
Pressing "w" after this does still move to:
The token is not being ignored consistently. I think that the "b" motion should go to that ending parentheses.
Steps to reproduce visualized in the above images.
NVIM v0.9.0-dev-2535+geb1da498d-Homebrew
c-w should work just like dw and the rest. c-w is used to delete word in insert mode.
No response
wildfire.nvim
- plugin for based node
selection
requested thing!
CamelCaseMotion
work for visual-mode
as in wildfire.nvim
CamelCaseMotion
for Case
here is the relevant issue
thank you !
No response
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.
Code to try it out:
$selection = eceff4
$background = 2e3440
$red = EF5350
$green = 66BB6A
$yellow = E2C12F
$blue = 42A5F5
$mageta = AB47BC
$cyan = 26C6DA
$foreground = D8DEE9
0.9.4
No response
cw
, de
, …), I read the notes on operator-pending mode in the README.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.
...
0.9.4
not that I know of.
cw
, de
, …), I read the notes on operator-pending mode in the README.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.
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
NVIM v0.9.0-dev-2557+gfd32a9875-Homebrew
cw
, de
, …), I read the notes on operator-pending mode in the README.virtualedit=all
or virtualedit=onemore
.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?
0.8.3
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.
No response
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`
^____________^
No response
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.
No response
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
No response
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:
Irrelevant
v0.9.0 (latest)
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.
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.
No response
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
No response
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
.
No response
// 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
v0.9.0-dev-1312+g908494889
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?
Initial position:
Position after
<Cmd>lua require('spider').motion('w')<CR>
The word "over" was skipped. The cursor should have jumped to:
No response
NVIM v0.9.0-dev-2535+geb1da498d-Homebrew
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!
No response
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.
before: CamelCase
----------^--------------
after: PascalamelCase
expected: PascalCase
v0.10.0-dev
No response
cw
, de
, …), I read the notes on operator-pending mode in the README.[deleted]
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
No response
cw
or dw
, I have read the note on w
in operator pending mode.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,
},
operation used: dw
before:
foo bar
-- ^
baz
after:
foo
^
--
baz
What I expected as per what I understood from the README,
foo baz
^
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
No response
CTRL-W will delete the word before the cursor, could this plugin support remap CTRL-W to delete subword?
No response
Would be nice to just use the default keymaps if we like them, therefore reducing the need to explicitly adding the keymaps in config.
No response
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)
No response
cw
or dw
, I have read the note on w
in operator pending mode.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".
c<cmd>lua
^ cursor on first letter
command cefoo<Esc>
Actual text after: foo>lua
Expected text after foo<cmd>lua
0.9.5
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.
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.
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.
v0.9.0
No.
cw
, de
, …), I read the notes on operator-pending mode in the README.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.
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:
dw
on the last word of the last line.Expected Behavior:
dw
on the last word of the last line.Example - dw
on the last word of last line:
Sample (t)ext\n.
=> Sample (t)ext.\n
Sample (t)ext\n.
=> Sample ().\n
Behavior:
cw
on the last word of the last line.Expected Behavior:
cw
on the last word of the last line.Example - cw
on the last word of last line:
Sample (t)ext\n.
=> Sample |text.\n
Sample (t)ext\n.
=> Sample |.\n
Behavior:
dw
on the last word of a line.Expected Behavior:
dw
on the last word of a line.Example - dw
on the last word of a line:
Sample (t)ext\n.
=> Sample ()
Sample (t)ext\n.
=> Sample ().\n
Behavior:
cw
on the last word of a line.Expected Behavior:
cw
on the last word of a line.Example - cw
on the last word of last line:
Sample (t)ext\n.
=> Sample |
Sample (t)ext\n.
=> Sample |.\n
There are two possible solutions to this problem.
These solutions can be made opt-in or default behavior - I don't mind implementing either.
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.
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.