*hugs.vim* Compiler file and auxiliary functions for Hugs98 Helpfile for hugs.vim (c.reinke@ukc.ac.uk, 15/03/2002) ===================================- Intro/Overview If you edit Haskell files, and have Hugs98 installed, put hugs.vim in a compiler directory in Vim's |runtimepath| and make sure to execute :compiler hugs whenever you open a Haskell module - as an |autocommand| in your .vimrc, or as part of your |filetype| plugin for haskell and lhaskell (these filetypes are used by the Haskell syntax highlighting for .hs and .lhs files, respectively). hugs.vim sets |makeprg| and |errorformat| so that you can use Vim's |quickfix| mode with Hugs98, although I tend to find this less helpful than running two separate windows for Vim and Hugs98 (it also seems difficult to keep Hugs quiet or at least to filter out all non-error messages - the current definitions eliminate many, but not all non-error messages). More interesting are the Vim script functions provided by hugs.vim, most of which internally utilize Hugs98, making some of its helpful functionality and semantics-awareness available to your Vim editing session. These VimL functions are bound to keyboard mappings for easy access, so you'll not usually call the functions directly. For this to work, you'll either have to have hugs in your $PATH (Unix) or %PATH% (Windows), or you'll have to change the variable g:hugs_path in hugs.vim to point to the directory with your hugs executable (also check the paths in the |makeprg| setting in this case). Note also that hugs doesn't give us any help if the current file is not a valid Haskell module. ===================================- Key Mappings {Visual}_t *haskell-type* asks Hugs98 for the type of the visual selection, and inserts the corresponding type declaration above the current line, i.e., if you have a function definition my_map f = foldr ((:).f) [] you can visually select the function name, type _t, and get my_map :: (a -> b) -> [a] -> [b] my_map f = foldr ((:).f) [] _T *haskell-type-first* same as 0vf h_t, i.e., it selects the first non-space string in the current line and proceeds as _t. {Visual}_f *haskell-find* ask Hugs98 to start an editor on the definition of the visual selection (you have to set your editor correctly in Hugs98 for this to work, see Hugs98 Manual for :set -E). So, if you have a piece of Haskell code foldl (+) 0 l you can visually select the +, type _f, and you should get a copy of Vim started up on the line in the Hugs Prelude.hs that declares the + member of class Num. _B *haskell-browse-exports-split* ask Hugs98 to browse the current module, and display the resulting type-declarations in a new window. _b *haskell-browse-exports-comment* as _B, but insert the resulting type-declarations as a comment at the top of the current module. _e *haskell-create-export-list* ask Hugs98 to browse the current module, and create a default module header with all exported items, adding their types as comments. The current file name (capitalised, without extension) is used as the module name. _I *haskell-browse-imports* on an import line. Ask Hugs98 to browse the imported module, show all items exported by the imported module, and their types in a new window. _i *haskell-create-import-list* on an import line. Ask Hugs98 to browse the imported module, and create a default import list with all items exported by the imported module, adding their types as comments.