UPDATE: haskellmode for Vim now at projects.haskell.org (+screencast; -)
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#V... 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 ------------- updates since last published version on old site 04/04/2009 haskell_doc.vim: when narrowing choices by qualifier for _?, take lookup index from un-narrowed list (else we could end up in the docs for the wrong module) 02/04/2009 ghc.vim: actually, we can try to make a reasonable guess at the parent type for constructors in _ie, from their type signature 01/04/2009 ghc.vim: try a bit harder to escape " and ' in :GHCi eliminate duplicates in _ie and mark data constructor imports as ???(Cons) - we can't reliably figure out the parent type for the constructor:-( handle Prelude as special case in _ie (can't just comment out import, need to import [qualified] Prelude [as X]() ) haskell_doc.vim: fix keys (no namespace tags) and urls (modules) for :MDoc 31/03/2009 all files: new home page at projects.haskell.org 28/03/2009 haskell_doc.vim: in ProcessHaddockIndexes2, fix a case where making new entries could lose old ones (eg, zipWith's base package locations got lost when adding its vector package locations) 07/12/2008 haskell_doc.vim: since we're now reading from multiple haddock indices in DocIndex, we need to extend, not overwrite entries.. 03/12/2008 ghc.vim: do not reset b:ghc_static_options on every reload
Hi Claus,
http://projects.haskell.org/haskellmode-vim/ The download link on this page seems to use \ instead of /, making it not work.
For anyone eager to download it, just replace \ (or %5C) in your address bar with \ and it should work. Gr. Matthijs
http://projects.haskell.org/haskellmode-vim/ The download link on this page seems to use \ instead of /, making it not work.
For anyone eager to download it, just replace \ (or %5C) in your address bar with \ and it should work.
argh, thanks, now fixed (filename completion in Vim, :help i_CTRL-X_CTRL-F, is useful for making sure one links to the correct file names, but gives platform- specific paths, which I usually correct before publishing; this one I missed). Claus
Hi Claus, I've installed the vimball, and it spit a few errors at me. In particular, it couldn't find the haddock documentation directory. A quick look at haskell_doc.vim shows that it should autodetect the directory. However, for some reason my ghc-pkg command returns the doc directory twice: $ ghc-pkg field base haddock-html haddock-html: /usr/local/ghc-6.10.1/share/doc/ghc/libraries/base haddock-html: /usr/local/ghc-6.10.1/share/doc/ghc/libraries/base The haskell_doc.vim contains the following line, which seems to deal with multiple lines: let field = substitute(system(g:ghc_pkg . ' field base haddock-html'),'\n','','') However, this simply concats the lines, which obviously makes a mess of the output and makes the detection fail. I've made things work by throwing away everything except for the first line, by replacing the above line with: let field = substitute(system(g:ghc_pkg . ' field base haddock-html'),'\n.*','','') This solution works for me, though it might be better to iterate all lines and try each of them in turn, for the case that ghc-pkg returns different paths? I can't really think of a case why this would be needed, though. Gr. Matthijs
Hi Claus, I've found two more little bugs. The first is that version comparison is incorrect. It now requires that all components are greater, so comparing 6.10.1 >= 6.8.2 returns false (since 1 < 2). Also, there is a "ghc-pkg field * haddock-html" call, but here the * will be expanded by the shell into the files in the current directory. To prevent this, the * should be escaped. Both of these are fixed in the attached patch. I'm also looking at the Qualify() function, which allows you to select a qualification using tab completion. However, when there is only a single choice, its a bit silly to have to use tabcompletion. At the very least, the value should be prefilled, but ideally the qualification should just happen. Also, I think that a dropdown menu is also available in text mode vim (at least with vim7), which would be nice for multiple choices (since you can see all choices in one glance). I'll have a look at these things as well, expect another patch :-) Gr. Matthijs
Matthijs, thanks for the reports, and analyses and suggested patches are even better! We should probably take this offlist at some point, though.
I've found two more little bugs. The first is that version comparison is incorrect. It now requires that all components are greater, so comparing 6.10.1 >= 6.8.2 returns false (since 1 < 2).
quite right! will fix.
Also, there is a "ghc-pkg field * haddock-html" call, but here the * will be expanded by the shell into the files in the current directory. To prevent this, the * should be escaped.
there is a comment in there suggesting that escaping was the wrong thing to do on some configurations/platforms (obviously, the current code works on my platform, so I depend on reports from users on other platforms), but I can't recall what the issue was at the moment. Will have to check, and implement a platform-specific solution, if necessary.
I'm also looking at the Qualify() function, which allows you to select a qualification using tab completion. However, when there is only a single choice, its a bit silly to have to use tabcompletion. At the very least, the value should be prefilled, but ideally the qualification should just happen.
Yes, that has been requested before, at least as an option (see the file haskellmode-files.txt for other open issues and change log). But it should be done consistently for all menus (all functions, and both GUI and terminal mode).
Also, I think that a dropdown menu is also available in text mode vim (at least with vim7), which would be nice for multiple choices (since you can see all choices in one glance).
There is a note on using :emenu instead of the old home-brewn haskellmode-files.txt menu code. I would generally want to clean up the script code (some of which is very old), and factor out the handling of menus into a single place before making these changes.
I'll have a look at these things as well, expect another patch :-)
Looking forward to it!-) Claus
Hi Matthijs,
I've installed the vimball, and it spit a few errors at me. In particular, it couldn't find the haddock documentation directory. A quick look at haskell_doc.vim shows that it should autodetect the directory. However, for some reason my ghc-pkg command returns the doc directory twice:
$ ghc-pkg field base haddock-html haddock-html: /usr/local/ghc-6.10.1/share/doc/ghc/libraries/base haddock-html: /usr/local/ghc-6.10.1/share/doc/ghc/libraries/base
Interesting. The reason for the double listing is that recent GHCs come with two base packages (since the packages differ in content, having both point to the same documentation location looks wrong to me, btw).
The haskell_doc.vim contains the following line, which seems to deal with multiple lines:
let field = substitute(system(g:ghc_pkg . ' field base haddock-html'),'\n','','')
This just used to remove the final '\n', in the days when multiple versions of base were still unthinkable. What I'm really after in that part of the script is the location of the GHC docs, and the library index (the actual package docs are processed later). Unfortunately, past GHC versions haven't been too helpful (#1226, #1878, #1572), hence all that guesswork in my scripts (for a while, there was a ghc --print-docdir, but that didn't quite work and disappeared quickly, nowadays, there is the nice ghc-paths package, but that doesn't give a concrete path for docdir, so I still need to find the http top dir for GHC). I hadn't noticed this change, because (a) the scripts look in "likely suspects" for the docs location as well, and (b) the docs location can be configured (bypassing all that guesswork) by setting 'g:haddock_docdir' before loading the scripts (:help g:haddock_docdir, :help haskellmode-settings-fine). Using g:haddock_docdir to configure the right path for your installation is probably the least wrong thing to do for now, and requires no changes to the scripts, but I'll have a look at how to improve the guesswork code for convenience, looking at the first match only or looking for the relevant directories in all matches.. Thanks for the report! Claus
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? 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? /M On Tue, Apr 7, 2009 at 10:23 AM, Claus Reinke <claus.reinke@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#V...
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
------------- updates since last published version on old site 04/04/2009 haskell_doc.vim: when narrowing choices by qualifier for _?, take lookup index from un-narrowed list (else we could end up in the docs for the wrong module)
02/04/2009 ghc.vim: actually, we can try to make a reasonable guess at the parent type for constructors in _ie, from their type signature
01/04/2009 ghc.vim: try a bit harder to escape " and ' in :GHCi eliminate duplicates in _ie and mark data constructor imports as ???(Cons) - we can't reliably figure out the parent type for the constructor:-( handle Prelude as special case in _ie (can't just comment out import, need to import [qualified] Prelude [as X]() )
haskell_doc.vim: fix keys (no namespace tags) and urls (modules) for :MDoc
31/03/2009 all files: new home page at projects.haskell.org
28/03/2009 haskell_doc.vim: in ProcessHaddockIndexes2, fix a case where making new entries could lose old ones (eg, zipWith's base package locations got lost when adding its vector package locations) 07/12/2008 haskell_doc.vim: since we're now reading from multiple haddock indices in DocIndex, we need to extend, not overwrite entries..
03/12/2008 ghc.vim: do not reset b:ghc_static_options on every reload
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
|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): 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 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). Claus On Tue, Apr 7, 2009 at 10:23 AM, Claus Reinke <claus.reinke@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#V...
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
On Tue, Apr 21, 2009 at 2:51 PM, Claus Reinke <claus.reinke@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
|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. Yes, one cannot have two "major" haskell modes claiming the same file, as the file identifies the mode. Fortunately, Vim provides separate files for separate aspects of filetype-specific functionality (syntax, indent, plugins), allows to split filetype plugins over several files as well (haskellmode currently only sets 'include' and 'includeexpr' in 'ftplugin/haskell.vim'; everything else is in separate files), and provides several versions of its configuration directory trees, to allow for standard plugins, system-wide overrides, user-overrides, .. For user-specific modifications, the main 'ftplugin/' is probably not the right place (see ':help runtimepath' for directory layout and paths searched), although adding a unique postfix to the file name works, as you've noticed (if we get too many generally available haskell plugins, we could move them to their own directory..). If you don't want to use your 'vimrc' file, then perhaps one of the 'after' directories (also in system-wide and user-specific varieties)? See ':help ftplugin-overrule'. You might also want to look at ':help vimball' - by default, it installs files in the first directory tree found on 'runtimepath', but you can give a different path explicitly (eg, if your ~/.vim is first in the list, but you don't want the plugins to be installed there, so that ~/.vim/ftplugin/ isn't touched). There doesn't seem to be a documented way of asking for confirmation before overwriting exising files of the same names, though - perhaps you could suggest this to the vimball maintainer?
|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. One thing I learn from trying to support haskellmode for Vim is how different platforms are, sometime being different is their whole purpose!-) So, x-www-browser is a dispatcher for calling the default browser, and epiphany and iceweasel are browsers?-) And you're sure that the dispatcher doesn't do an extra encoding. And calling the dispatcher directly with the url file:///usr/share/doc/ghc6-doc/libraries/base/Prelude.html#v%3AfromIntegral works without extra encodings appearing?
file://localhost/c:/ghc/ghc-6.11.20090320/doc/libraries/base/Prelude.html#v%3AfromIntegral
<A HREF="base/Prelude.html#v%3AfromIntegral"
|That is what I have in mine as well (though it's located in |/usr/share/doc/ghc6-doc/libraries/). Good, so it isn't a Haddock difference. | 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? Sure, ':help debug';-) In this particular case, using 'echo' as your browser to echo the url Vim tries to pass would give you the information more directly. But you could also try to look at it from within Vim (lines starting with " are comments, not to be typed in): " this should match the doc-index url :echo g:haddock_index['fromIntegral'] " set breakpoint :breakadd func DocBrowser " now, if you use _? on fromIntegral, you'll end up in the debugger, " in function DocBrowser, where you can inspect the local environment, " then quit or continue: echo a:url echo printf(g:haddock_browser_callformat,g:haddock_browser,escape(a:url,'#%')) q " delete all breakpoints :breakdel * Does the second echo show the extra encoding? If not, it is beyond haskellmode, I'm afraid - that command is passed directly to the shell (well, as directly as a configurable editor will allow - see ':help :!'). Claus
participants (3)
-
Claus Reinke -
Magnus Therning -
Matthijs Kooijman