Dave Hill
Dave Hill

Reputation: 81

How to put % into variable in vimscript

I'm looking to capture the current class name (in java) using the % char - but in vimscript I want to push this string value into a variable

let objName = % throws an error currently so I'm looking for some help (vimscript newbie)

Upvotes: 0

Views: 300

Answers (1)

Luc Hermitte
Luc Hermitte

Reputation: 32966

You are looking for expand().

   let objName = expand('%:t:r')

Upvotes: 3

Related Questions