DEV Community

Discussion on: When developing Laravel app with Vim, you can still jump to Magic Methods

Collapse
 
michaelvickersuk profile image
Michael • Edited

Lovely stuff, although my editor (Atom) still wouldn't jump to the scope or accessor as the first character of the tag will be uppercase, and this doesn't match with the search term the cursor will be positioned at.

My solution was to prefix these tags with a placeholder.

--regex-php=/get([a-z|A-Z|0-9]+)Attribute/_FIRST_CHAR_TO_LOWER_\1/
--regex-php=/scope([a-z|A-Z|0-9]+)/_FIRST_CHAR_TO_LOWER_\1/
Enter fullscreen mode Exit fullscreen mode

Then post-process the tags using sed and convert the uppercase first character to lowercase.

#!/usr/bin/env bash

ctags

sed --in-place \
--regexp-extended \
--expression='s/_FIRST_CHAR_TO_LOWER_(.)([a-z|A-Z|0-9]+)\t/\l\1\2\t/g' \
tags

sort tags --output=tags
Enter fullscreen mode Exit fullscreen mode