[TxMt] Emacs kill-sentence

Sam Halliday sam.halliday at gmail.com
Mon Jan 15 08:28:49 UTC 2007


Hi all,

I've only recently started to use TextMate, and I'm doing what you  
all did in your first week... implementing the Emacs commands I can't  
live without :-)

I noticed that there is no Emacs kill-sentence support, so I  
implemented it:-

  http://fommil.me.uk/Emacs%20Sentence.zip

Including the commands to cut from the cursor to the end of the  
current sentence, and navigate back/forward sentences.

Emacs defines a sentence (with one space after the fullstop) as

  [.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*

but I edited that to use extended regexes and count colons. Emacs  
also cheats and uses a bunch of other special tests for paragraphs  
without a fullstop etc, so I included that too

  [.?!:;][\]"')]*\s+?|$\s*?$|\Z

which is unfortunately hard-coded into all the macros as I didn't  
know how to create a bundle-wide constant.

There is a little bug which means if you navigate back on the first  
sentence in the first line of a file, you will be off by one. This is  
such a small bug that I can't be bothered to fix it, although I'm  
open to suggestions for fixes.

I bound navigation to alt-left/right (as I use ctrl-left/right for  
word navigation) and kill-sentence as alt-k (same as Emacs). shift- 
alt-right will work as expected, but I do not know what to do about  
shift-alt-left; I'd like to hear any hints on how to get that to work.

cheers,
Sam

-- 
http://fommil.me.uk


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://lists.macromates.com/textmate/attachments/20070115/3871c468/attachment.sig>


More information about the textmate mailing list