Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:cur[sor] #7506

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

:cur[sor] #7506

wants to merge 10 commits into from

Conversation

elazarcoh
Copy link
Contributor

@elazarcoh elazarcoh commented Feb 16, 2022

What this PR does / why we need it:
Add cursors by search pattern. fixes #7152
Can add cursor at a specific location using special indicator. Currently I'm using \#.

Feature:
Consider this example: (cursor indicated by |)

def foo():
|def bar(): 
def bizbaz():
def moo():
  1. :cur def (all matches)
    |def foo():
    |def bar():
    |def bizbaz():
    |def moo():
  2. :cur 2 def (limit number of matches)
    def foo():
    |def bar():
    |def bizbaz():
    def moo():
  3. :cur de\#f (at specified location)
    de|f foo():
    de|f bar():
    de|f bizbaz():
    de|f moo():
  4. :cur \#de\#f (multiple cursor)
    |de|f foo():
    |de|f bar():
    |de|f bizbaz():
    |de|f moo():
  5. :cur def \w+\# (using regex)
    def foo|():
    def bar|():
    def bizbaz|():
    def moo|():
  6. vj :'<,'>cur def (in selection range)
    def foo():
    |def bar():
    |def bizbaz():
    def moo():

Edit:
Added cursor from current word/selection in case of empty pattern

  1. :cur (select current word as pattern)
    |def foo():
    |def bar():
    |def bizbaz():
    |def moo():
  2. :cur 2 (select current word as pattern, with limit)
    def foo():
    |def bar():
    |def bizbaz():
    def moo():
  3. lvll:'<,'>cur 2 (the selection is used for pattern, similar to * in visual mode)
    def foo():
    d|ef bar():
    d|ef bizbaz():
    def moo():

Which issue(s) this PR fixes

Special notes for your reviewer:

@elazarcoh elazarcoh changed the title cur[sor] :cur[sor] Feb 16, 2022
@elazarcoh elazarcoh marked this pull request as ready for review February 16, 2022 15:35
@elazarcoh
Copy link
Contributor Author

Added new feature: cursors from current word/selection, when not giving a pattern to the command.
examples is PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

:cur[sor]
2 participants