I Love Quicksilver’s way with text files

Why would I need this?

You work with text files often, and would love a way to easily add, change, or delete text within those files on the fly, without opening them.

And yes, Quicksilver does that!

How do I …

We’re going play with part of a text file from Mathias Bynens’ OS X dotfiles, which lists a number of Terminal commands to change your Mac’s settings. (I highly recommend checking it out. There may be some settings there you didn’t know you could change!) Below is a screenshot of some of the commands, saved as a text file.

1111_01_te_text_file

We want to add a note to the second comment without opening the file, searching for the line, saving the file and closing the window. (Waaaay too much work.) To do this, we’re going to use the Change To… action, which allows you to change a line within a text file. In our screenshot below, we’ve got our text file in our first pane. (We selected the file in Finder and then pressed command-escape to pipe the file into Quicksilver. We could have also typed in some of the letters of the file name to have Quicksilver search for the file.)

To the right, there is an icon of a gear with the words Large Type below it. That is the second pane of Quicksilver, where we select the action we want to perform.

By the way, it’s best if the file is closed while performing these actions. In certain situations, you can edit a text file using Quicksilver while that file is open and have the changes you make via Quicksilver save, but that’s not always the case.

If your Quicksilver looks different from the screenshots, we’re using the Cube Interface, available in Preferences > Plugins. After installing it, go to Preferences > Appearance to select and customize it.

1111_02_qs_pane_01

Pressing the right arrow key gives us every single line within our text file, each as a separate actionable item in our results window. (We can do this with any text file, as long as it has a txt or text extension.) We’ve resized the results window to see more of the lines.

1111_03_qs_pane_01

We know that the line we want to change contains the word screenshot. To reduce the number of results returned, we’ll type this so Quicksilver can fine-tune our search results.

With less results to wade through, we can easily find and select the line we want to change. Now that we’ve done that, we can press tab to go to second pane.

1111_04_qs_pane_01

In the second pane, we’ll type change to until it appears. On the left is a minimized icon of our text document, sitting in our first pane. At the top, a summarization of what we’ve entered so far. On the right, a minimized icon of text in our third pane. There’s a reason it’s not empty. Let’s tab there and find out why.

1111_05_qs_pane_02

Our third pane comes pre-populated with the line of text we want to edit, already selected. Quicksilver placed it here when we selected the line of text we wanted to act upon. Since we only want to add to the line, so we’re going to press the right arrow key to move the cursor to the end of the line. (If you make a mistake and start typing, unintentionally erasing text you want to keep, press control-z to undo.)

1111_06_qs_pane_03

We’ve pasted a note to the end of the line. Now, we’ll press enter to add our edits to the file.

1111_07_qs_pane_03

Opening our file, we can see the line has been updated.

1111_08_te_text_file

Other useful actions are Append Text… and Append To…. We’ll talk about the difference between two after looking at Append Text….

We’re going to work with a different text file containing other commands from Bynens’ OS X dotfiles.

1111_09_te_text_file

Wait. We forgot to add a command, and it’s a really useful one. We’ve copied the forgotten command on our clipboard; now, let’s add it to our file.

1111_10_finder_textclipping

Activate Quicksilver. Below, we’ve typed findef to search for our file and it appears in the first pane. (If a different file appeared, we could either press the down arrow key or wait a few seconds for Quicksilver to present a window of the other files which matched our search.)

1111_11_qs_pane_01

We want to use a different action, so we’ll tab to the second pane and type append. The first action which matches is Append To…. After a brief delay, Quicksilver displays the other match, Append Text….

1111_12_qs_pane_02

Let’s tab to the third pane to enter the text we want to append. Here is where we paste the text we want to append and press enter. Before we do, one thing to note is that Quicksilver will add a new line if the last line of your text file is not blank. If the last line of your text file is a blank line, Quicksilver will add your text on that last blank line.

To add blank lines before the text we’re appending, we’ll pressoption-enter before pasting our text.

1111_13_qs_pane_03

Let’s go check our file.

And there’s our addition, at the end of the file

1111_14_te_text_file

Append To is the essentially the same action, except that the first pane contains the text you want to append and third pane contains the file.

Prepend Text… and Prepend To… work the same way, except that they add text to the beginning of the file.

What if you need to add text before or after a line in a text file? That’s easy. You can select a line of the text file (as we did earlier in when using the Change To… action), then use Append Text…or Prepend Text… to place your new line of text before or after the selected line. Similarly, you can place your new line of text in the first pane, choose the Append To or Prepend To… actions, then select the line of text to place your new line of text before or after.

Wait! We almost forgot Delete Line, which does exactly what it says it does. In the screenshot below, I’ve already selected the text file, displayed the lines contained within, and navigated to the last line of our file.

1111_15_qs_pane_01

Now, we simply tab to the second pane, type delete line (or delline or even leten), and press enter when the Delete Line action appears.

1111_16_qs_pane_02

Our file now is missing that last line. All of this with a few keystrokes, and Quicksilver.

1111_17_te_text_file

Why doesn’t it work on my Mac?

Note that in order to use these actions, you need to install the following plugins and you may need to change your Quicksilver preference settings:

  • Text Manipulation Plugin

After you’ve installed the plugin, you’ll want to enable the actions you want to use. In our screenshot below, only the append actions are enabled. If you plan to use all the actions, you’ll want to check the others as well.

1111_18_qs_pref_actions

Wow/Meh. What else ya got?

This is part of a series of some of the ways I love and use Quicksilver. If you’re new to Quicksilver, check out the Quicksilver Setup Mini Guide for tips on configuration.

11. November 2014 by sojourner hardeman
Categories: geekery, how do i love thee quicksilver | Leave a comment

Leave a Reply

Required fields are marked *