hs-module-name Vim plugin
This vim plugin can automatically figure out and insert the name of a Haskell module based on the filename.
This plugin is pathogen-compatible. If you use pathogen, just clone
or copy this repo under
Otherwise, use something like
cp -r vim-hs-module-name/* ~/.vim/
When you create a new
.hs file, the header
module Foo.Bar where
is automatically inserted, where
Foo.Bar is the module name inferred from the
g:hs_module_no_auto variable to disable this.
When you are in a buffer with the
haskell filetype, press
M to insert the
module header as described above.
To use a different key sequence instead of
M, set the
variable to the desired key sequence.
g:hs_module_no_mappings variable to disable this.
If you want to set up other bindings or hooks, use the
How the inference works
The components of the module name are assumed to be the largest prefix of the file path components where all the components start with capital letters.
E.g. for the file
the module name is inferred to be
Foo.Bar. This works pretty well in