[Haskell-cafe] UPDATE: haskellmode for Vim now at projects.haskell.org (+screencast; -)

Claus Reinke claus.reinke at talk21.com
Tue Apr 21 09:51:47 EDT 2009

|I've finally found the time to take another look at your haskell mode
|for vim.  Two questions so far:

|1. I think earlier my indentation mode would match indentation of the
|previous line by default, after installing your scripts I always end
|up in column 1 after pressing return.  Is there some variable I can
|set to get back the old behaviour?

Matching indentation of previous line is still the behaviour I see here.
A quick look through my vimrc file (nothing to do with the plugins)
shows ':set autoindent' as the only indentation-related setting, and
':help autoindent' confirms that this option has the intended behaviour
(':set noautoindent' gives the alternate behaviour you describe).

I tend not to use the various more clever indentation options Vim
provides, so my plugins do not offer clever indentation either, and
should not interfere with whatever other indentation plugins you use.

':help autoindent' points to other indentation-related settings (c-style,
or language-dependent, or based on an evaluating an expression to
calculate likely indents, or ..). You could also try :scriptnames, and
see whether you are loading any Haskell indent scripts (if you enable
filetype detection to get my plugins loaded for Haskell source, and
you happen to have a Haskell indent file, you might pick that up - you 
can disable filetype indent separately, see :help filetype-indent).

|2. My browser doesn't urldecode its command line arguments, so
|locations like "file:///usr/share/doc/ghc6-doc/libraries/base/Prelude.html%23v%253AfromIntegral"
|don't work.  I have to manually fix it up in the location bar.  Do you
|have any tip for dealing with that?

That is the first I hear about such an issue. As it seems to work with
most browsers (I tend to use Opera most, but -long ago- tested with
IE and FireFox as well), I would need to know about the browser in 
question to see what is going on and think about workarounds.

Btw, the URL I see generated looks like this (right from Opera's
location bar):

so it seems that there is an additional level of encoding in your
setting (the '#'/'%' from the encoding are encoded themselves). 

The haskellmode plugins just get the URLs from Haddock's index files,
and <C:/ghc/ghc-6.11.20090320/doc/libraries/doc-index.html> 
also says:

    ><TR CLASS="indexrow"
    ><TD CLASS="indexentry"
    ><TD CLASS="indexlinks"
    ><A HREF="base/Prelude.html#v%3AfromIntegral"

which is copied literally to g:haddock_index['fromIntegral'], and
passed almost literally to the browser call (with backslash escapes
for '#'/'%'). Somewhere along that line, or later, something different 
happens on your system, and it seems to happen outside the plugins 
(you could confirm this by using 'echo' as your browser, or by adding
a Vim breakpoint for function DocBrowser, and look at a:url).

It could be different Vim behaviour, but extra url-encoding is
rather specific to browsing, not editing. 

Thanks for reporting the problems (it is the only way I get to know
about other platforms/configurations than the one I'm using!). The 
plugins have a trac instance as well (I've just made the link more 
prominent on their home page).


On Tue, Apr 7, 2009 at 10:23 AM, Claus Reinke <claus.reinke at talk21.com> wrote:
> I have become aware that many Haskellers are not aware of the
> Haskell mode plugins for Vim, in spite of the >100 downloads
> per month I saw when I last checked. Since the plugins have just
> completed their move to their new home at
> http://projects.haskell.org/haskellmode-vim/
> this seems to be a good opportunity to mention them again (now
> with 100% more screencasts!-). They do much (though certainly
> not all) of the stuff people often wish for here, such as showing or adding
> types, looking up source where available locally or looking up documentation
> where source isn't available. Mostly, they collect
> my attempts to automate tasks when I have to do them often enough.
> Here is a section of the quick reference (:help haskellmode-quickref):
> |:make| load into GHCi, show errors (|quickfix| |:copen|)
> |_ct| create |tags| file |_si| show info
> for id under cursor
> |_t| show type for id under cursor
> |_T| insert type declaration for id under cursor
> |balloon| show type for id under mouse pointer
> |_?| browse Haddock entry for id under cursor
> |:IDoc| {identifier} browse Haddock entry for unqualified {identifier}
> |:MDoc| {module} browse Haddock entry for {module}
> |:FlagReference| {s} browse Users Guide Flag Reference for section {s}
> |_.| qualify unqualified id under cursor
> |_i| add 'import <module>(<identifier>)' for id under
> cursor
> |_im| add 'import <module>' for id under cursor
> |_iq| add 'import qualified <module>(<identifier>)' for id
> under cursor
> |_iqm| add 'import qualified <module>' for id under cursor
> |_ie| make imports explit for import statement under
> cursor
> |_opt| add OPTIONS_GHC pragma
> |_lang| add LANGUAGE pragma
> |i_CTRL-X_CTRL-O| insert-mode completion based on imported ids
> (|haskellmode-XO|)
> |i_CTRL-X_CTRL-U| insert-mode completion based on documented ids
> (|haskellmode-XU|)
> |i_CTRL-N| insert-mode completion based on imported sources
> |:GHCi|{command/expr} run GHCi command/expr in current module
> For those who have never used these plugins, or haven't used Vim
> at all, it has often been difficult to imagine what editing in Vim can
> be like. The old quick tour of features available has now been updated
> from screenshots to screencasts (my first venture into this area - please
> let me know whether that is useful or a waste of time!-), so you can watch
> them on Youtube before deciding to invest time into learning Vim.
> For those who are using Vim, the only reason not to use my haskellmode
> plugins would be if you had your own (not uncommon
> among Vim users;-), in which case I hope you make yours available as well
> (feel free to adopt features from my plugins, and let me know
> if you have some useful features to contribute), here:
> http://www.haskell.org/haskellwiki/Libraries_and_tools/Program_development#Vim
> For those who have happily been using these plugins: in the process
> of moving the site, I noticed that I hadn't updated the published
> version for a quite some time - apparently, noone had missed the fixes, but
> in case you want to check, the relevant section of my update
> log is appended below.
> Happy Vimming!-)
> Claus

More information about the Haskell-Cafe mailing list