Faster Jump To Core for WordPress Hooks

The WordPress Hooks Integration of WordPress.vim from 0.1.7 was mostly focused on the new ex-commands :Waction and :Wfilter and the CtrlP variants.

These commands are quite smart. If your cursor is already on the action name they will take you to the invocation or listener position correctly. They fall back to using the word under the cursor when an argument is not specified.

This is great but sometimes you just want to use a quick shortcut instead.

Since Jump To Core already overrides the mapping for Ctrl-], it makes sense to give it some extra smarts!

Beginning with 0.1.8 the Ctrl-] shortcut will jump to either the source of the hook or it’s listener. The tag stack also gets populated correctly if multiple matches are present.

For instance, With the cursor on template_redirect in add_action('template_redirect', ..) it will take you to the invocation for the template_redirect, ie:- it’s do_action. And vice versa when the cursor is on template_redirect in do_action.

It also works similarly for WordPress Filters and their listeners.

The demo below shows the improved Jump To Core in action. There is lesser use of the :Waction or :Wfilter ex commands here. Instead it’s jumping directly with the Ctrl-] shortcut.

Improved Jump to Core for WordPress Hooks

The 0.1.8 release also fixes a small typo that was causing the :Wcodexsearch to fail.