dsawardekar / wordpress.vim

Vim Plugin for WordPress Development
MIT License
166 stars 17 forks source link

[Feature Request] Auto set filetype to "php.wordpress" for files from a certain directory #24

Open sudar opened 9 years ago

sudar commented 9 years ago

Let me explain my usecase.

Earlier I just used to place all my plugin code inside wp-content directory. So when I set g:wordpress_vim_wordpress_pathto the WordPress root, the filetype of all files inside that were automatically set to php.wordpress.

These days I am mostly using VVV or vip-quickstart and I keep all my plugin code inside a specific directory like ~/work/ and share it inside the vm. So when I open these files in vim the filetype is set to php and not to php.wordpress. I can manually set the filetype to php.wordpress, but it would be nice if WordPress.vim can provide an option to do it automatically.

dsawardekar commented 9 years ago

@sudar I'm using a similar setup with VVV, but my project encapsulates all its plugins under wp-content. Can you clarify the project layout that you have under ~/work?

sudar commented 9 years ago

This is how my setup looks like

~/dev
├── vip-quickstart
├── vvv

I have a copy of WordPress at ~/wp/. This is only for generating tags and for doing a look up.

My work directory looks like this.

~/work
├── plugin1
├── plugin2
├── theme1

I have mapped my ~/work/plugin1 and other folders into VVV and vip-quickstart depending on whether I am working on a VIP project or not.

Basically I want all PHP files inside ~/work/ to be of filetype php.wordpress even though they are not inside WordPress directory.

sudar commented 9 years ago

Well, on second thought I don't think it is of very high priority. I added the following line in my vimrc to get it

autocmd BufRead,BufNewFile ~/work/**/*.php set filetype=php.wordpress

Anyways I am curios to know how is your directory structure looks like so please share it. Thanks.