search

Home  >  Q&A  >  body text

vimrc - How to compare % with string in vim?

I want to determine whether the suffix name of the current file is equal to a certain suffix in the if conditional statement, but %:t:e=="cpp" does not seem to be correct Grammar, what is the correct grammar?

伊谢尔伦伊谢尔伦2777 days ago512

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-05-16 16:38:30

    You need to use expand

    if expand('<afile>:t:e') == "cpp"

    reply
    0
  • Cancelreply