Skip to content

srghma/vim-purs-module-name

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

purs-module-name Vim plugin

This vim plugin can automatically figure out and insert the name of a Purescript module based on the filename.

Installation

This plugin is pathogen-compatible. If you use pathogen, just clone or copy this repo under ~/.vim/bundle.

Otherwise, use something like

cp -r vim-purs-module-name/* ~/.vim/

Usage

Automatic insertion

When you create a new .purs file, the header

module Foo.Bar where

is automatically inserted, where Foo.Bar is the module name inferred from the file name.

Set the g:purs_module_no_auto variable to disable this.

Manual insertion

When you are in a buffer with the purescript filetype, press M to insert the module header as described above.

To use a different key sequence instead of M, set the g:purs_module_mapping variable to the desired key sequence.

Set the g:purs_module_no_mappings variable to disable this.

Command

If you want to set up other bindings or hooks, use the :InsertPurescriptModuleName command.

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

/home/User/project/src/Foo/Bar.purs

the module name is inferred to be Foo.Bar. This works pretty well in practice.

About

Vim plugin to infer and insert Purescript module name

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%