I'm working with a legacy codebase, some of which uses CRLF line endings, mixed with more recent updates which use LF.
Textmate displays these as <CR>
Is there an existing bundle item which will strip the <CR> and make the full file LF consistent?
I'd rather this was a manual action rather than Save As... or done transparently, because it can complicate git conflicts if its not managed.
Thanks
On Sep 29, 2014, at 5:26 AM, Carpii UK carpii.uk@gmail.com wrote:
Is there an existing bundle item which will strip the <CR> and make the full file LF consistent?
I use BBEdit (or its free little brother TextWrangler) for this. With BBEdit you can just create a text engine that batch-processes your files. m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
Thanks, I was a paid up BBEdit user before I moved to TM2, but it fell out of favour after a few bugs (one of them was due to mismatched line endings funnily enough, it would often misreport line numbers)
Im able to do it in TM by using Text -> Filter Through Command
But a specific bundle item would be nice so I could assign a key combo and bypass the dialog (which often has other commands Ive used in it)
On 29 September 2014 16:37, Matt Neuburg matt@tidbits.com wrote:
On Sep 29, 2014, at 5:26 AM, Carpii UK carpii.uk@gmail.com wrote:
Is there an existing bundle item which will strip the <CR> and make the
full file LF consistent?
I use BBEdit (or its free little brother TextWrangler) for this. With BBEdit you can just create a text engine that batch-processes your files. m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Carpii UK wrote
Thanks, I was a paid up BBEdit user before I moved to TM2, but it fell out of favour after a few bugs (one of them was due to mismatched line endings funnily enough, it would often misreport line numbers)
Im able to do it in TM by using Text -> Filter Through Command
But a specific bundle item would be nice so I could assign a key combo and bypass the dialog (which often has other commands Ive used in it)
On 29 September 2014 16:37, Matt Neuburg <
matt@
> wrote:
On Sep 29, 2014, at 5:26 AM, Carpii UK <
carpii.uk@
> wrote:
Is there an existing bundle item which will strip the
<CR> and make the > full file LF consistent? > > > > I use BBEdit (or its free little brother TextWrangler) for this. With > BBEdit you can just create a text engine that batch-processes your files. > m. > > -- > matt neuburg, phd = http://www.apeth.net/matt/ > pantes anthropoi tou eidenai oregontai phusei > Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do > iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do > RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html > > > > _______________________________________________ > textmate mailing list >
textmate@.macromates
textmate mailing list
textmate@.macromates
Hi Carpii and Matt,
I just quickly created a bundle item for the task you asked, Carpii. It uses `tr` to delete all carriage returns from your current document. Just press `^⌥⌘-R` to use the command on the current file. I hope you like it. If not, just leave a reply with your suggestions to make the command better, and I will try to incorporate them.
Kind regards, René
Carpii.zip http://textmate.1073791.n5.nabble.com/file/n28290/Carpii.zip
-- View this message in context: http://textmate.1073791.n5.nabble.com/Convert-CRLF-to-LF-tp28286p28290.html Sent from the textmate users mailing list archive at Nabble.com.
Hi René,
Awesome, thanks so much for taking the time to create this!
I didn't realise you could add new menu items with a simple bash scripts like that (Ive looked at bundles in the past but they were hard to decipher).
One question.. The bundle works from the saved file (and so any unsaved changes you've made since are not passed to tr). Likewise the bundle cannot run on a unsaved buffer.
I wonder if there's a way around that? Its not an issue for your bundle as I can just save it, but would be useful to know for the future
Thanks Paul
On 29 September 2014 17:52, sanssecours sanssecours@f-m.fm wrote:
Carpii UK wrote
Thanks, I was a paid up BBEdit user before I moved to TM2, but it fell
out
of favour after a few bugs (one of them was due to mismatched line
endings
funnily enough, it would often misreport line numbers)
Im able to do it in TM by using Text -> Filter Through Command
But a specific bundle item would be nice so I could assign a key combo
and
bypass the dialog (which often has other commands Ive used in it)
On 29 September 2014 16:37, Matt Neuburg <
matt@
> wrote:
On Sep 29, 2014, at 5:26 AM, Carpii UK <
carpii.uk@
> wrote:
Is there an existing bundle item which will strip the
<CR> and make the > full file LF consistent? > > > > I use BBEdit (or its free little brother TextWrangler) for this. With > BBEdit you can just create a text engine that batch-processes your
files.
m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
textmate mailing list
textmate@.macromates
textmate mailing list
textmate@.macromates
Hi Carpii and Matt,
I just quickly created a bundle item for the task you asked, Carpii. It uses `tr` to delete all carriage returns from your current document. Just press `^⌥⌘-R` to use the command on the current file. I hope you like it. If not, just leave a reply with your suggestions to make the command better, and I will try to incorporate them.
Kind regards, René
Carpii.zip http://textmate.1073791.n5.nabble.com/file/n28290/Carpii.zip
-- View this message in context: http://textmate.1073791.n5.nabble.com/Convert-CRLF-to-LF-tp28286p28290.html Sent from the textmate users mailing list archive at Nabble.com.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Paul,
You can just use find and replace on \r in regular expression mode. Or control+option+enter will create a CR so you can use that in the find and replace as well. You can run find and replace on the entire project folder to get rid of all of them.
Steven
On Sep 29, 2014, at 2:35 PM, Carpii UK carpii.uk@gmail.com wrote:
Hi René,
Awesome, thanks so much for taking the time to create this!
I didn't realise you could add new menu items with a simple bash scripts like that (Ive looked at bundles in the past but they were hard to decipher).
One question.. The bundle works from the saved file (and so any unsaved changes you've made since are not passed to tr). Likewise the bundle cannot run on a unsaved buffer.
I wonder if there's a way around that? Its not an issue for your bundle as I can just save it, but would be useful to know for the future
Thanks Paul
On 29 September 2014 17:52, sanssecours sanssecours@f-m.fm wrote: Carpii UK wrote
Thanks, I was a paid up BBEdit user before I moved to TM2, but it fell out of favour after a few bugs (one of them was due to mismatched line endings funnily enough, it would often misreport line numbers)
Im able to do it in TM by using Text -> Filter Through Command
But a specific bundle item would be nice so I could assign a key combo and bypass the dialog (which often has other commands Ive used in it)
On 29 September 2014 16:37, Matt Neuburg <
matt@
> wrote:
On Sep 29, 2014, at 5:26 AM, Carpii UK <
carpii.uk@
> wrote:
Is there an existing bundle item which will strip the
<CR> and make the > full file LF consistent? > > > > I use BBEdit (or its free little brother TextWrangler) for this. With > BBEdit you can just create a text engine that batch-processes your files. > m. > > -- > matt neuburg, phd = http://www.apeth.net/matt/ > pantes anthropoi tou eidenai oregontai phusei > Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do > iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do > RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html > > > > _______________________________________________ > textmate mailing list >
textmate@.macromates
textmate mailing list
textmate@.macromates
Hi Carpii and Matt,
I just quickly created a bundle item for the task you asked, Carpii. It uses `tr` to delete all carriage returns from your current document. Just press `^⌥⌘-R` to use the command on the current file. I hope you like it. If not, just leave a reply with your suggestions to make the command better, and I will try to incorporate them.
Kind regards, René
Carpii.zip http://textmate.1073791.n5.nabble.com/file/n28290/Carpii.zip
-- View this message in context: http://textmate.1073791.n5.nabble.com/Convert-CRLF-to-LF-tp28286p28290.html Sent from the textmate users mailing list archive at Nabble.com.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi Steven, thanks for the reply
I do understand I can convert it interactively, I was just looking for a one-shot key combo really.
I can also convert them all en-masse via a quick bash loop, but doing this creates a few problems in git, since any historic branches suddenly conflict when I later merge them (and because all the line endings have changed, the whole file is different rather than just blocks of code)
For this reason I prefer to just deal with them on a case by case basis as I encounter them
Cheers Paul
On 30 September 2014 00:13, Steven Clukey saclukey@live.com wrote:
Paul,
You can just use find and replace on \r in regular expression mode. Or control+option+enter will create a CR so you can use that in the find and replace as well. You can run find and replace on the entire project folder to get rid of all of them.
Steven
On Sep 29, 2014, at 2:35 PM, Carpii UK carpii.uk@gmail.com wrote:
Hi René,
Awesome, thanks so much for taking the time to create this!
I didn't realise you could add new menu items with a simple bash scripts like that (Ive looked at bundles in the past but they were hard to decipher).
One question.. The bundle works from the saved file (and so any unsaved changes you've made since are not passed to tr). Likewise the bundle cannot run on a unsaved buffer.
I wonder if there's a way around that? Its not an issue for your bundle as I can just save it, but would be useful to know for the future
Thanks Paul
On 29 September 2014 17:52, sanssecours sanssecours@f-m.fm wrote:
Carpii UK wrote
Thanks, I was a paid up BBEdit user before I moved to TM2, but it fell
out
of favour after a few bugs (one of them was due to mismatched line
endings
funnily enough, it would often misreport line numbers)
Im able to do it in TM by using Text -> Filter Through Command
But a specific bundle item would be nice so I could assign a key combo
and
bypass the dialog (which often has other commands Ive used in it)
On 29 September 2014 16:37, Matt Neuburg <
matt@
> wrote:
On Sep 29, 2014, at 5:26 AM, Carpii UK <
carpii.uk@
> wrote:
Is there an existing bundle item which will strip the
<CR> and make the > full file LF consistent? > > > > I use BBEdit (or its free little brother TextWrangler) for this. With > BBEdit you can just create a text engine that batch-processes your
files.
m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
textmate mailing list
textmate@.macromates
textmate mailing list
textmate@.macromates
Hi Carpii and Matt,
I just quickly created a bundle item for the task you asked, Carpii. It uses `tr` to delete all carriage returns from your current document. Just press `^⌥⌘-R` to use the command on the current file. I hope you like it. If not, just leave a reply with your suggestions to make the command better, and I will try to incorporate them.
Kind regards, René
Carpii.zip http://textmate.1073791.n5.nabble.com/file/n28290/Carpii.zip
-- View this message in context: http://textmate.1073791.n5.nabble.com/Convert-CRLF-to-LF-tp28286p28290.html Sent from the textmate users mailing list archive at Nabble.com.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 30 Sep 2014, at 1:26, Carpii UK wrote:
I do understand I can convert it interactively, I was just looking for a one-shot key combo really.
Edit → Macros → Start Recording ⌘F, search for \r, replace with empty string and click Replace All. Edit → Macros → Stop Recording Edit → Macros → Save Macro
Now you have a macro for this to which you can assign a key equivalent or call up with ⌃⌘T.
Very cool, thanks Allan
Starting to realise I don't know TM as well as I thought I did :-)
On 30 September 2014 00:38, Allan Odgaard mailinglist@textmate.org wrote:
On 30 Sep 2014, at 1:26, Carpii UK wrote:
I do understand I can convert it interactively, I was just looking for a
one-shot key combo really.
Edit → Macros → Start Recording ⌘F, search for \r, replace with empty string and click Replace All. Edit → Macros → Stop Recording Edit → Macros → Save Macro
Now you have a macro for this to which you can assign a key equivalent or call up with ⌃⌘T.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi Paul,
Carpii UK wrote
Hi René,
Awesome, thanks so much for taking the time to create this!
I didn't realise you could add new menu items with a simple bash scripts like that (Ive looked at bundles in the past but they were hard to decipher).
One question.. The bundle works from the saved file (and so any unsaved changes you've made since are not passed to tr). Likewise the bundle cannot run on a unsaved buffer. I wonder if there's a way around that?
Allan already mentioned one possibility. Another one would be to use the current document as input for the command. I updated the bundle command accordingly. It now uses a small piece of Python code to remove all carriage return symbols from the current document.
Carpii UK wrote
Its not an issue for your bundle as I can just save it, but would be useful to know for the future
Thanks Paul
Kind regards, René
Carpii.zip http://textmate.1073791.n5.nabble.com/file/n28300/Carpii.zip
-- View this message in context: http://textmate.1073791.n5.nabble.com/Convert-CRLF-to-LF-tp28286p28300.html Sent from the textmate users mailing list archive at Nabble.com.