Skip to content

Create sub-filetypes for EDN, boot and Leiningen files #9

@axvr

Description

@axvr

This is a proposal/request for comments for a possible future change. No change will be made/merged without feedback or demand.


It is possible to make Clojure.vim automatically mark specific Clojure files as Clojure sub-types by using a lesser known Vim feature detailed under :h 'filetype'. This may improve configurabilty and allow other plugins to run specific code for each sub-filetype.

This can be done by changing the filetype detection code to something like this:

" ftdetect/clojure.vim
autocmd BufNewFile,BufRead *.clj,*.cljc,*.cljs setlocal filetype=clojure  " Maybe even separate out cljs?
autocmd BufNewFile,BufRead *.edn setlocal filetype=clojure.edn
autocmd BufNewFile,BufRead {build,profile}.boot setlocal filetype=clojure.boot
autocmd BufNewFile,BufRead project.clj setlocal filetype=clojure.lein

This would also make it possible to add additional syntax keywords per sub-filetype, such as highlighting defproject only in project.clj files.

There may be better ways of achieving the same goals without having to add lots of new filetypes (which may conflict with other filetypes included in Vim). If you can think of any or have any thoughts on this, please leave a comment below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions