fix(gitbrowse): fix the regex in url_patterns (#133)

## Description

The `remote` is used as a regex pattern, so the dot in the
`"github.com"` means any character. This PR correct the regexes in
default `url_patterns`.


aa38175c00/lua/snacks/gitbrowse.lua (L40-L49)


aa38175c00/lua/snacks/gitbrowse.lua (L68-L72)


Test code:

```lua
print(require("snacks").gitbrowse.get_url("https://githubacom.com/folke/snacks.nvim"))
```

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

**Before**

![image](https://github.com/user-attachments/assets/899e8312-2e9d-44ed-92c1-e3b28cedc06c)

**After**

![image](https://github.com/user-attachments/assets/fc5610a9-8977-4369-aff2-861730083308)
This commit is contained in:
Zhou Fang 2024-11-22 03:11:39 +09:00 committed by GitHub
parent aebffe535b
commit cfa7dea08a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,11 +38,11 @@ local defaults = {
{ "%.git$" , "" },
},
url_patterns = {
["github.com"] = {
["github%.com"] = {
branch = "/tree/{branch}",
file = "/blob/{branch}/{file}#L{line}",
},
["gitlab.com"] = {
["gitlab%.com"] = {
branch = "/-/tree/{branch}",
file = "/-/blob/{branch}/{file}#L{line}",
},