Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Select to matched bracket #17

Description

@lloeki

Ctrl-M places the cursor to a bracket according to some rule. Ctrl-Shift-M should smartly† select from the current cursor position to the new one.

† This is very useful for indenting blocks, changing function arguments, modifying array/dict/hash indices or content... so best judgement must be used to set the selection properly. E.g calling it twice in a row from anywhere inside a bracketed array or parens should select whatever the inside of the brackets is. Calling it a third time could grow the selection to include the brackets.

Inspiration: vim's ci[/di[/ca[/da[

Activity

  1. kevinsawicki commented on Apr 7, 2014

    @kevinsawicki
    Contributor

    I really like this idea, unfortunately the cmd-shift-m keybinding is in use by the markdown-preview package, any other ideas for a keybinding to use?

  2. lloeki commented on Apr 7, 2014

    @lloeki
    Author

    There are not much brackets in markdown, and the keybinding is active only in Markdown documents.

    Also other keybindings would really make no sense: when "action" does a movement, people reasonably usually (i.e. about 297% of the time) expect "Shift+action" to move and select.

    I think we can talk with the Markdown folks about this, and at best have them move their keybinding to Cmd+Alt+M, at worst keep the status quo and have people resolve the issue in their config file. It's not like it's unexpected to have conflicting keybindings across plugins, especially ones that make sense in a very specific context (such as Markdown preview).

  3. kevinsawicki commented on Apr 7, 2014

    @kevinsawicki
    Contributor

    I added this feature but bound it to ctrl-cmd-m to start with to no conflict, it will be included in the 0.85.0 release. We can discuss changing keybindings in a different PR/issue, I definitely see your point though about ctrl-shift-m being the expected keybinding for this action.

  4. dmnd commented on Jul 31, 2014

    @dmnd

    I tried to use the ctrl-shift-m bind and since it didn't work I opened up Sublime instead. Then when I went to file a bug I found this had already been discussed. Consider this comment another vote that ctrl-shift-m should belong to this command, not the markdown previewer.

  5. scttnlsn commented on Oct 6, 2014

    @scttnlsn

    @lloeki originally mentioned that repeatedly hitting ctrl-cmd-m should grow the selection. @kevinsawicki, is this implemented? I'd love to be able to hit ctrl-cmd-m twice to select everything inside and including the brackets.

  6. kevinsawicki commented on Oct 6, 2014

    @kevinsawicki
    Contributor

    is this implemented? I'd love to be able to hit ctrl-cmd-m twice to select everything inside and including the brackets.

    Growing isn't implemented currently, mind creating a new issue for it?

  7. brunetton commented on May 11, 2015

    @brunetton

    Referenced in #124

  8. brunetton commented on May 11, 2015

    @brunetton
  9. brunetton commented on May 11, 2015

    @brunetton

    While waiting for the pull request to be included on next Atom release, we can customize our keymap.cson adding this :

    'atom-text-editor':
      'ctrl-shift-m': 'bracket-matcher:select-inside-brackets'
    'atom-text-editor[data-grammar="source gfm"]':
      'ctrl-shift-m': 'markdown-preview:toggle'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions