Question

I'm curious if anyone has figured out a way to prevent TextMate from deleting the next "word" if passing a newline. For example, in most editors...

output += chunk.toString(); 

})|<-

option-delete from the caret at this point will remove })

output += chunk.toString();

|<-

option-delete from this point will remove the \n.

output += chunk.toString();
|<-

in a lot of editors, option-delete here will remove the final \n and place the caret at the end of chunk.toString();|<-. In TextMate, it removes the \n along with the next "word" ();.

Was it helpful?

Solution

If I understand correctly, you want ⌥⌫ to act as regular when at the beginning of a line.

What you can do is overload ⌥⌫ for the case where you are at the beginning of a line (assuming you are using TextMate 2).

  1. Edit → Macros → Start Recording (⌥⌘M)
  2. Press delete ()
  3. Edit → Macros → Stop Recording (⌥⌘M)
  4. Edit → Macros → Save Macro… (⌃⌘M)
  5. Select a bundle for where to save your macro
  6. Set key equivalent to option-delete (⌥⌫)
  7. Set the scope selector to: L:dyn.caret.begin
  8. Press ⌘S to save the macro

Now pressing ⌥⌫ at the beginning of a line will act as if you pressed .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top