@@ 106,6 106,133 @@ RepoURL comes with the following defaults:
}
```
+### Functions
+
+Here are the available functions. Note that for all functions, special handling
+is in place to support files that are in `$GOMODCACHE`. This is useful when
+using LSP's Go To Definition where you might end up in a dependency stored in
+GOMODCACHE. RepoURL will still be able to generate a permalink.
+
+**`require('repo-url').get_blob_url()`**
+
+Generates a permalink to the blob view of the current line under the cursor or
+selected lines.
+
+**`require('repo-url').copy_blob_url()`**
+
+Generates a permalink using `get_blob_url()` and set it to the `+` register.
+
+**`require('repo-url').open_blob_url()`**
+
+Generates a permalink using `get_blob_url()` and opens it in your browser.
+
+
+**`require('repo-url').get_blame_url()`**
+
+Generates a permalink to the blame view of the current line under the cursor or
+selected lines.
+
+**`require('repo-url').copy_blame_url()`**
+
+Generates a permalink using `get_blame_url()` and set it to the `+` register.
+
+**`require('repo-url').open_blame_url()`**
+
+Generates a permalink using `get_blame_url()` and opens it in your browser.
+
+
+**`require('repo-url').get_history_url()`**
+
+Generates a permalink to the history view of the current line under the cursor
+or selected lines.
+
+**`require('repo-url').copy_history_url()`**
+
+Generates a permalink using `get_history_url()` and set it to the `+` register.
+
+**`require('repo-url').open_history_url()`**
+
+Generates a permalink using `get_history_url()` and opens it in your browser.
+
+
+**`require('repo-url').get_raw_url()`**
+
+Generates a permalink to the raw view of the current line under the cursor or
+selected lines.
+
+**`require('repo-url').copy_raw_url()`**
+
+Generates a permalink using `get_raw_url()` and set it to the `+` register.
+
+**`require('repo-url').open_raw_url()`**
+
+Generates a permalink using `get_raw_url()` and opens it in your browser.
+
+
+**`require('repo-url').get_tree_url()`**
+
+Generates a permalink to the tree view of the repository that the current file
+belongs to.
+
+**`require('repo-url').copy_tree_url()`**
+
+Generates a permalink using `get_tree_url()` and set it to the `+` register.
+
+**`require('repo-url').open_tree_url()`**
+
+Generates a permalink using `get_tree_url()` and opens it in your browser.
+
+
+**`require('repo-url').get_gomod_tree_url()`**
+
+Generates a permalink to the tree view of the repository of the Go dependency
+under the cursor in a go.mod. Parses the version to point to the specified
+commit.
+
+For example, if the cursor is under the following line:
+
+```gomod
+require k8s.io/client-go v0.30.0
+```
+
+then `get_gomod_tree_url` will generate the following link:
+https://github.com/kubernetes/client-go/tree/v0.30.0.
+
+**`require('repo-url').copy_gomod_tree_url()`**
+
+Generates a permalink using `get_gomod_tree_url()` and set it to the `+`
+register.
+
+**`require('repo-url').open_gomod_tree_url()`**
+
+Generates a permalink using `get_gomod_tree_url()` and opens it in your browser.
+
+
+**`require('repo-url').get_gosum_tree_url()`**
+
+Generates a permalink to the tree view of the repository of the Go dependency
+under the cursor in a go.sum. Parses the version to point to the specified
+commit.
+
+For example, if the cursor is under the following line:
+
+```gosum
+k8s.io/client-go v0.30.0/go.mod h1:g7li5O5256qe6TYdAMyX/otJqMhIiGgTapdLchhmOaY=
+```
+
+then `get_gosum_tree_url` will generate the following link:
+https://github.com/kubernetes/client-go/tree/v0.30.0.
+
+**`require('repo-url').copy_gosum_tree_url()`**
+
+Generates a permalink using `get_gosum_tree_url()` and set it to the `+`
+register.
+
+**`require('repo-url').open_gosum_tree_url()`**
+
+Generates a permalink using `get_gosum_tree_url()` and opens it in your browser.
+
+
### URL builder
You can teach RepoURL how to generate URLs for forges that it does not support
@@ 158,3 285,12 @@ These functions will be given the following object (`opts`):
line2 = 0,
}
```
+
+## Contributing
+
+Configure git with the following commands to send patches to my mailing list.
+
+```
+git config sendemail.to "~tomleb/public-inbox@lists.sr.ht"
+git config format.subjectprefix "PATCH repo-url.nvim"
+```