<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Rob McBroom wrote:
<blockquote cite="mid:E253E005-A742-4EC5-A23B-33868612BA7B@skurfer.com"
 type="cite">
  <pre wrap="">All of these characters are invisible and the "Show  
Invisibles" command represents them all with the same diamond  
character. I hate to say it, but if you need to deal with literal  
control characters in a file, you should probably use something in the  
Terminal, like Vim.
  </pre>
</blockquote>
<br>
I'm kind of surprised TextMate doesn't already have a way to do this,
and I'm really surprised that you can't use octal escape sequences such
as \001 as a replacement expression in the Find/Replace dialog. But you
can work around it...<br>
<br>
For general conversions, here's a simple command:<br>
<br>
    <tt>/usr/bin/tr 'a-zA-Z' '\001-\032\001-\032'</tt><br>
<br>
Use the Bundle Editor to make a new command, input = "Selected Text" or
"Character", output = "Replace Selected Text". Type and select a letter
and run that command to turn it into the equivalent control character.<br>
<br>
If you just have a specific few characters you often need to insert it
might be easier to make them into tab triggers.  For example, if you
need to insert a control-X create a tab trigger like:<br>
<br>
    <tt>echo 'x' | /usr/bin/tr 'a-zA-Z' '\001-\032\001-\032'</tt><br>
<br>
And assign it a key sequence you find convenient.<br>
<br>
(And, hopefully TM2 will have some way to assign unique symbols to
different control characters when "show invisibles" is on!)<br>
<br>
<div class="moz-signature">-- <br>
<address
 style="font-family: sans-serif; font-style: italic; font-size: smaller;">
Steve King<br>
Sr. Software Engineer<br>
Arbor Networks<br>
+1 734 821 1461<br>
<a href="http://www.arbornetworks.com/">www.arbornetworks.com</a>
</address>
</div>
</body>
</html>