This fork adds multiple URLs support, fixes and status messages.
The vim-scaladoc plug-in is for use with Vim or Neovim - who would have thought? It allows you to open scaladoc documentation in your favorite browser based on keyword selection. By default the plugin will search the following locations for documentation:
- Official Scala Documentation
- Local Project (target/scala-x.x.x/api)
- User Specified Paths
The local project search is based on the current open file in VIM. If the file
contains a src
directory in its path, then target/scala-x.x.x/api
is
appended to the parent of this directory and added to the search path.
This plugin requires VIM be compiled with +python. Python 3 should be installed. The plugin has been tested on Mac and Linux. If you are using Windows, go sit in the corner and think about what you have done :)
If you are using vim-plug:
Plug 'git@github.com:alopatindev/vim-scaladoc.git'
Once help tags have been generated, you can view the manual with
:help scaladoc
.
Documentation is available via VIM :help
, but it's fairly simple:
:ScalaDoc list
http://www.scala-lang.org/api/current/scala/collection/immutable/List.html
:ScalaDoc mu queue
http://www.scala-lang.org/api/current/scala/collection/mutable/Queue.html
:ScalaDoc im queue
http://www.scala-lang.org/api/current/scala/collection/immutable/Queue.html
If multiple matches are found (e.g. :ScalaDoc queue
), then a read-only
window will be opened to select a URL from.
Note: The first time :ScalaDoc
is run it may be a bit slow as it downloads
and indexes the docs, but subsequent runs should be fast.
A few variables are available to customize settings:
g:scaladoc : Enable (1) / Disable (0) plugin
(Default: 1)
g:scaladoc_cache_dir : Directory to store index caches in
(Default: `tmp` dir of install directory)
g:scaladoc_cache_ttl_days : TTL for cached indexes
(Default: 15)
g:scaladoc_paths : Local directory paths (comma sep) to search for
scaladocs (Default: '',
Example: '/helloworld/target/scala-2.11/api/')
g:scaladoc_urls : URLs (comma sep) to search for scaladocs
(Default: 'https://www.scala-lang.org/api/current')
URLs Example:
let g:scaladoc_urls = 'https://www.scala-lang.org/api/current,https://spark.apache.org/docs/latest/api/scala,https://datastax.github.io/spark-cassandra-connector/ApiDocs/2.0.3/spark-cassandra-connector,https://www.playframework.com/documentation/latest/api/scala,http://doc.akka.io/api/akka/current'
Note: The TTL applies to network resources and to general cache cleanup.
Local API files are checked for modifications each time :ScalaDoc
is
run in order to pickup changes from a local build.
There are no built-in mappings added for scaladoc, but it is simple enough to add your own. For example:
nnoremap <F1> :call scaladoc#Search(expand("<cword>"))<CR>
Copyright 2012 Mike Dreves
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at:
http://opensource.org/licenses/eclipse-1.0.php
By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.