• Tech Tips

    Autocomplete in iTerm2

    This is a really quick tip that could save you tons of time in iTerm2. If you use any auto-completion you know how important it is to your workflow. Personally, I rely heavily on omni and generic completion in Vim.

    In Vim CTRL-N is the key combination I use after I start typing a word that I know exists somewhere else in the buffer. It pops open a menu where I can choose the match I want. For example, if I have a function called “agileadam_foo”, I can quickly retype that string by typing part of the string (e.g., agi) followed by CTRL-N. If it’s the only match it’ll complete the string, otherwise I can choose which string I want, or type another letter or two and try again. It all happens very quickly, and is almost always faster than typing the string in its entirety.

    You can achieve the same functionality in iTerm2 without any special configuration. The built-in key combination is CMD-; (command + semicolon). Here’s the description of the feature from iTerm’s Highlights for New Users guide:

    Any text that exists in a tab or its scrollback buffer can be autocompleted in that tab. To use autocomplete, type the beginning of a word and then press cmd-;. An autocomplete window opens showing the top 20 choices for words beginning what what you have entered. The list can be filtered by typing a subsequence. The filter can be reset by pressing backspace. If you make a selection and press return, it will be entered for you. If you make a selection and press tab, your autocomplete will be extended with the selection.

    I had a [not-so-] brilliant idea of mapping, in the Keys preference pane for the app,  CTRL-N to Select Menu Item… » Open Autocomplete… so that it mimics Vim. Unfortunately, as you might have guessed, it overrode the CTRL-N mapping in Vim. I guess I’ll stick to the default CMD-; for now.

  • Development

    Pull Quotes in Drupal 7 – Using hook_filter_info()

    I recently wrote a post called Pull Quotes Shortcodes via Custom Filters in Drupal 7 . This was a good solution, but I decided I wanted a little more flexibility in my filter (like being able to specify attributes in any order) and I wanted to get rid of the required [/pullquote] closing tag. Custom Filter has its limitations (and working through the gui would’ve been a PITA), so I fired up Vim and made a custom filter using hook_filter_info().

    Here is part of my original description of what I needed:

    I’ve been working on a Drupal 7 site that requires some nicely-formatted pull quotes. The site editors need the ability to add them to their content easily through the “filtered” text fields throughout the site (e.g., body).

  • Development

    Pull Quotes via Custom Filters in Drupal 7

    UPDATE: This was a good solution, but I decided I wanted a little more flexibility in my filter (like being able to specify attributes in any order) and I wanted to get rid of the required [/pullquote] closing tag. Custom Filter has its limitations (and working through the gui would’ve been a PITA), so I fired up Vim and made a custom filter using hook_filter_info(). I encourage you to look at this new post: Pull Quotes in Drupal 7 – Using hook_filter_info()

    I’ve been working on a Drupal 7 site that requires some nicely-formatted pull quotes. The site editors need the ability to add them to their content easily through the “filtered” text fields throughout the site (e.g., body). After trying a few shortcode-type modules I decided I’d get the most flexibility and power out of a simple custom filter. If you haven’t checked out Custom Filter, you’ll want to familiarize yourself with this module before proceeding.