Please note: I have been through this link Jump to CSS definition when editing HTML in VIM, but it couldn’t help me.
I am looking to jump to the CSS definition or for that matter a javascript function from the html file. I would love to hit a key combo below the word to jump to its definition, not just the file in which the definition resides.
I currently need to search the word in opened buffers and then reach to all the search results in the required buffer. It is very time consuming.
Please help me with this very regular requirement.
This quick and dirty function seems to do the trick for *.html -> *.css:
test.html
foo/foo.css
bar/bar.css
With the cursor on any
fooorbarattribute value intest.html, hitting<F9>jumps to the right definition in the right file. The function could be modified to open the target file in a split, search only the linked stylesheets… or be completely ridiculed and destroyed by ZyX ;-).edit
A few additional pointers:
:help iskeywordfor this function to work with dash-joined names:help expand():help searchpos()and:help search()for the meanings of the arguments:help starstarfor the use of the**wildcard