tpope / vim-apathy

apathy.vim: Set the 'path' option for miscellaneous file types
180 stars 9 forks source link

set up `&define` #9

Closed Konfekt closed 5 years ago

Konfekt commented 5 years ago

Inspired by https://vimways.org/2018/death-by-a-thousand-files/ , might this be an appropriate place to contribute sensible settings of &define, on top of &include and &path, as well?

tpope commented 5 years ago

Absolutely!

Konfekt commented 5 years ago

After playing with this, the restriction of 'define' is that it expects the label after the regex pattern. For example in Javascript, if we wanted to declare methods as macros, then among all the possible regular expressions indicating methods as listed on https://github.com/romainl/ctags-patterns-for-javascript#methods what is left are

setlocal define=^\\s*this\\.\\\|^\\s*static\\s\\+

Perhaps better would be scan for the regexes of classes as listed in https://github.com/romainl/ctags-patterns-for-javascript#patterns-6

Perhaps you have an opinion on what kind of objects &l:define should look for in languages other than C and C++ where macros do not exist?

tpope commented 5 years ago

For a language like JavaScript I'm inclined to write it off as a lost cause and use ctags.