Emacs kill-sentence

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Emacs kill-sentence

Sam Halliday
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




______________________________________________________________________
For new threads USE THIS: [hidden email]
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Emacs kill-sentence

Sam Halliday
On 15 Jan 2007, at 08:28, Sam Halliday wrote:
> I noticed that there is no Emacs kill-sentence support, so I  
> implemented it:-

One small note: my version is more like "cut-sentence" as it adds the  
sentence to the clipboard, not the kill ring.



______________________________________________________________________
For new threads USE THIS: [hidden email]
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Emacs kill-sentence

Jacob Rus-2
Sam Halliday wrote:
> On 15 Jan 2007, at 08:28, Sam Halliday wrote:
>> I noticed that there is no Emacs kill-sentence support, so I
>> implemented it:-
>
> One small note: my version is more like "cut-sentence" as it adds the
> sentence to the clipboard, not the kill ring.

TextMate doesn't really have a kill ring, and it doesn't implement the
yankAndSelect: selector.  It does have a 'clipboard ring' of sorts
though.  Anyway, TextMate commands can't really put stuff in the kill
buffer to be yanked back with C-y.


______________________________________________________________________
For new threads USE THIS: [hidden email]
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Emacs kill-sentence

Sam Halliday
Jacob Rus-2 wrote
TextMate doesn't really have a kill ring, and it doesn't implement the
yankAndSelect: selector.  It does have a 'clipboard ring' of sorts
though.  Anyway, TextMate commands can't really put stuff in the kill
buffer to be yanked back with C-y.
That's really odd because when I had the "local clipboard" option selected, I was sure that after running my macro, ^y would paste (yank) the text, but @v would respect my previous @c copied text.
Loading...