Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ofirgall/open.nvim
Open the current word with custom openers, GitHub shorthands for example.
https://github.com/ofirgall/open.nvim
Last synced: about 2 months ago
JSON representation
Open the current word with custom openers, GitHub shorthands for example.
- Host: GitHub
- URL: https://github.com/ofirgall/open.nvim
- Owner: ofirgall
- License: gpl-3.0
- Created: 2022-10-16T09:45:43.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-06T08:36:08.000Z (11 months ago)
- Last Synced: 2024-01-24T09:31:35.128Z (4 months ago)
- Language: Lua
- Homepage:
- Size: 49.8 KB
- Stars: 57
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-neovim - ofirgall/open.nvim - Open the current word with custom openers, GitHub shorthand for example. (Marks / PHP)
- awesome-stars - ofirgall/open.nvim - Open the current word with custom openers, GitHub shorthands for example. (Lua)
- awesome-stars - ofirgall/open.nvim - Open the current word with custom openers, GitHub shorthands for example. (Lua)
- awesome-neovim - ofirgall/open.nvim - Open the current word with custom openers, GitHub shorthand for example. (Marks / Markdown and LaTeX)
- awesome-neovim - ofirgall/open.nvim - Open the current word with custom openers, GitHub shorthand for example. (Marks / Markdown and LaTeX)
README
# open.nvim
Open the current word (or other text) with custom openers, extensible.E.g: Open GitHub shorthand `"ofirgall/open.nvim"` at your default browser.
## Installation
```lua
use { 'ofirgall/open.nvim', requires = 'nvim-lua/plenary.nvim' }
```You can install `vim.ui.select` wrapper to change the ui for selecting multiple results:
* [stevearc/dressing.nvim](https://github.com/stevearc/dressing.nvim)
* [nvim-telescope/telescope-ui-select.nvim](https://github.com/nvim-telescope/telescope-ui-select.nvim)### Troubleshoot
- [Timeout/write error on Termux](https://github.com/ofirgall/open.nvim/issues/7#issuecomment-1614663519)## Usage
```lua
-- Leave empty for default values
require('open').setup {
}require('open').setup {
config = {
-- Override system opener, the defaults should work out of the box
system_open = {
cmd = "",
args = {},
},
-- Options to pass to plenary.curl
curl_opts = {
-- compressed = false -- Uncomment this line to disable curl compression
},
},
-- List of disabled openers, 'github' for example see `:help open.default_openers`
disabled_openers = {
},
-- fallback function if no opener succeeds
fallback = function(text)
system_open.open(text)
end,
-- Override `config` per opener
openers_config = {
-- Override `jira` browser for example
['jira'] = {
system_open = {
cmd = 'chromium-browser',
},
},
},
}
```By default, no keymaps are set, you have to set your own keymap:
```lua
vim.keymap.set('n', 'gx', require('open').open_cword)
```### Register a custom opener
Please share awesome custom openers with PR.
```lua
require('open').register_opener({
name = 'Example Opener',
open_fn = function(text)
return { 'www.example.org' }
end
})
```## List of Custom Openers
* [ofirgall/open-jira.nvim](https://github.com/ofirgall/open-jira.nvim) - Open Jira tickets shorthand.Feel free to add your opener to the list.
# Credits
* [nvim-tree](https://github.com/nvim-tree/nvim-tree.lua) for the system opener module.