In Vim there's a really nice feature to find/replace the first occurrence in each line. This is afaik actually the default behavior. How can I obtain the same behavior in sublime text?
I need to be able to mark/find the FIRST (and the first only!) character, e.g. '=', in each line, so that I easily can mark/copy/cut what's before and what's after that specific character. Mind you, there might be many of this specific character in each line.
Concrete example:
I have a long list of java properties in the form:
my.property.link1=<a href="asdfs">Link 1</a>
my.property.link22=<a href="asdfs">Link 22</a>
my.property.link333=<a href="asdfs">Link 333</a>
my.property.link4444=<a href="asdfs">Link 4444</a>
I want to mark the first "=" in each line, to be able to select all the preceding text (indifferent from the amount of text preceding the "=") to cut or copy the text. The paste-result of such action would be:
my.property.link1
my.property.link22
my.property.link333
my.property.link4444
Splitting the Selection into Lines Select a block of lines, and then split it into many selections, one per line, using: Windows/Linux: Ctrl+Shift+L. Mac: ⇧+⌘+L.
While you can place multiple text cursors in Sublime Text with Cmd–Click (Mac) or Ctrl–Click (Windows), here's another technique that comes in handy. Hold Ctrl–Shift (Mac) or Ctrl–Alt (Windows) and hit Up or Down Arrow to place an additional text cursor above or below the current cursor.
I actually wrote a sublime plugin called SelectUntil that addresses this exact problem: https://github.com/xavi-/sublime-selectuntil
Once it's install you can do the following
The experience should look something like this:
Supposing you have the following text:
my.property.link1=<a href="asdfs">Link 1</a>
my.property.link22=<a href="asdfs">Link 22</a>
my.property.link333=<a href="asdfs">Link 333</a>
my.property.link4444=<a href="asdfs">Link 4444</a>
Press Ctrl + F (or click Find->Find)
Enable regular expressions
Type in the search field: ^.*?(?==)
Preess Alt + Enter (or click Find All)
Now all the text before =
is selected, you just need to copy it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With