Giter Site home page Giter Site logo

vim-hs-module-name's Introduction

hs-module-name Vim plugin

This vim plugin can automatically figure out and insert the name of a Haskell 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-hs-module-name/* ~/.vim/

Usage

Automatic insertion

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 file name.

Set the g:hs_module_no_auto variable to disable this.

Manual insertion

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 g:hs_module_mapping variable to the desired key sequence.

Set the g:hs_module_no_mappings variable to disable this.

Command

If you want to set up other bindings or hooks, use the :InsertHaskellModuleName 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.hs

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

vim-hs-module-name's People

Contributors

pcapriotti avatar unkindpartition avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

anpryl srghma

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.