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

Magnus Therning magnus at therning.org
Tue Apr 21 11:07:22 EDT 2009


On Tue, Apr 21, 2009 at 2:51 PM, Claus Reinke <claus.reinke at talk21.com> wrote:
> |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).

Yes, I found that one myself.  My old ftplugin/haskell.vim used to
have autoindent set, but importing your haskell mode overwrote that
(slightly irritating behaviour if you ask me ;-).  Putting my old
config into ftplugin/haskell_mine.vim restored the behaviour.

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

These are my g:haddock_ setting:

let g:haddock_browser="/usr/bin/x-www-browser"
let g:haddock_browser_callformat = "%s %s &"

It's on a Debian system, hence the use of x-www-browser.  I've tried
using both epiphany and iceweasel directly as well, with exactly the
same behaviour.

> Btw, the URL I see generated looks like this (right from Opera's
> location bar):
> file://localhost/c:/ghc/ghc-6.11.20090320/doc/libraries/base/Prelude.html#v%3AfromIntegral
>
> 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"
>   >fromIntegral</TD
>   ><TD CLASS="indexlinks"
>   ><A HREF="base/Prelude.html#v%3AfromIntegral"
>   >Prelude</A
>   ></TD
>   ></TR

That is what I have in mine as well (though it's located in
/usr/share/doc/ghc6-doc/libraries/).  I'm not really sure where the
extra level of encoding comes from.

> 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).

My Vim-scripting fu is minimal.  Do you have any pointers on how to
set breakpoints, step, and inspect variables?

> 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).

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Haskell-Cafe mailing list