Chibimagic's Weblog

TextWrangler with piping!

Posted on: February 8, 2011

I hate all pagers: more, less, pg, the whole lot. I can’t read fixed width fonts for that long without my eyes bleeding and my soul crying. Plus:

  • no scroll wheel
  • no copy pasting long sections
  • search is horrendous
  • etc. etc.

So, next step? Pipe to local TextWrangler, of course!

function edit {
  command=""
  if [[ $1 ]]
  then
    if [[ ${1:0:1} = "/" ]]
    then
      abs_path="$1"
    else
      abs_path="`pwd`/$1"
    fi
    command="sftp://remote_user_name@remote_host/$abs_path"
  fi
  ssh -p 10022 local_user_name@localhost "edit $command"
}

And the single line version:


function edit { command=""; if [[ $1 ]]; then if [[ ${1:0:1} = "/" ]]; then abs_path="$1"; else abs_path="`pwd`/$1"; fi; command="sftp://remote_user_name@remote_host/$abs_path"; fi; ssh -p 10022 local_user_name@localhost "edit $command"; }

Now these all work:

edit file_in_this_directory.txt
edit /absolute/path/to/file.txt
man ls | edit

1 Response to "TextWrangler with piping!"

I love more. :-D Okay, not really. I’m just trying to say that I don’t need this per se, but it’s a cool looking hack. I’m saving this for future reference if I ever need to do something like this. Yay thanks!

And I read fixed-width font all day (in LaTeX). I can’t imagine a world where I have to use variable width. That would make me cry. :-P

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


  • None
  • Marketing Consultant: You're an great writer. You have brought up some really interesting insights. Just wanted to say fantastic blogs! I know tons of people see your write
  • optical franchise opportunities: Right now it looks like Wordpress is the preferred blogging platform out there right now. (from what I've read) Is that what you are using on your blo
  • startup speaker: Interesting content. A magnificent article. It is very informative and you are obviously very knowledgeable in this area.

Categories

%d bloggers like this: