Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.

Implement more text objects (for quotes and brackets) - #229

Closed
jamesamcl wants to merge 2 commits into
atom:masterfrom
jamesamcl:master
Closed

jamesamcl wants to merge 2 commits into
atom:masterfrom
jamesamcl:master

Conversation

@jamesamcl

Copy link
Copy Markdown
Contributor

This allows one to use things like ci" to change in quotes and ci( to change in brackets. Like Vim, it works across lines and understands escaped quotes and nested brackets.

It could perhaps be more elegant - I wasn't 100% on the APIs for selecting stuff, but at least it seems to work alright.

Comment thread lib/text-objects.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a named function out of the check so that this line can be an easily-readable return unless insideQuotes()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@casimir

casimir commented May 12, 2014

Copy link
Copy Markdown

By any chance do you plan to support the % key and tag blocks?

I have almost zero experience in coffee script and not much in atom API, would it be envisageable regarding the possibilities of the edition API?

edit: I just saw that was disscussed here #141.

Comment thread lib/text-objects.coffee

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still having trouble reading select. Could this chunk of code be refactored into something like (warning, pseudocode:)

end = @findClosingQuote(start)
return [false] unless end
editor.selectToPosition(end)
[true]

@caleb

caleb commented May 16, 2014

Copy link
Copy Markdown

This is great! This is probably the single feature I miss most from vim when using other editors.
I would like to see square brackets added to this list, and maybe back ticks.

I'd love to see this merged with vim-mode

@bhuga

bhuga commented May 16, 2014

Copy link
Copy Markdown
Contributor

I'm excited about this too. It's painful to have ciw and not ci"! Just needs some cleanup.

@tonatiuh

Copy link
Copy Markdown

Excellent. I hope to see this functionality integrated soon.

@cadwallion

Copy link
Copy Markdown
Contributor

Is there any chance of an ETA to update this, @udp ? I'm itching for this functionality and resisting the urge to update this branch locally because it's so close to finished.

@jamesamcl

Copy link
Copy Markdown
Contributor Author

I don't have any time to work on this at the moment, but the code works fine. If someone wants to update it to fix the style issues/whatever that'd be welcome.

EDIT: Not sure why Travis is failing (there aren't any tests for these text objects), so I guess that needs investigating too.

carlosdcastillo referenced this pull request in carlosdcastillo/vim-mode May 28, 2014
@bhuga

bhuga commented May 31, 2014

Copy link
Copy Markdown
Contributor

Closing in preference to #286

@bhuga bhuga closed this May 31, 2014
MarkusSN pushed a commit to MarkusSN/vim-mode that referenced this pull request May 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants