Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phenax/neorg-hop-extras
Neorg plugin to extend the functionality of links
https://github.com/phenax/neorg-hop-extras
Last synced: 3 months ago
JSON representation
Neorg plugin to extend the functionality of links
- Host: GitHub
- URL: https://github.com/phenax/neorg-hop-extras
- Owner: phenax
- License: gpl-3.0
- Created: 2023-07-18T10:40:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-13T09:31:36.000Z (10 months ago)
- Last Synced: 2024-05-02T05:53:42.823Z (7 months ago)
- Language: Lua
- Size: 38.1 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neorg - Neorg Hop Extras - A neorg module that adds a few new types of links like commands, aliases, etc. (Neorg Modules)
README
# neorg-hop-extras
Neorg plugin to extend the functionality of links## Install
#### For [packer](https://github.com/wbthomason/packer.nvim) users -
```lua
use {
'nvim-neorg/neorg',
-- ...
requires = {
-- ...
{'phenax/neorg-hop-extras'},
}
}
```#### Basic config
```lua
require('neorg').setup {
load = {
['external.hop-extras'] = {},
},
}
```#### Custom keybinding
```lua
require('neorg').setup {
load = {
-- ...
['external.hop-extras'] = {
config = {
bind_enter_key = false,
}
},
['core.keybinds'] = {
config = {
hook = function(keybinds)
-- Use `external.hop-extras.hop-link` instead of `core.esupports.hop.hop-link`
keybinds.remap_event('norg', 'n', 'gl', 'external.hop-extras.hop-link')
end,
}
},
},
}
```## Usage
#### Commands as links
Run an arbitrary vim command when a link is activated```neorg
- View yesterday's journal {+Neorg journal yesterday}[Yesterday] - Opens yesterday's journal
- Log the time using timelog module {+Neorg timelog insert routine}[Log routine] (requires https://github.com/phenax/neorg-timelog)
- Run shell commands {+!ls}* Counter example
- count: 28
- Increment: {+/-\s*count:/ | call feedkeys("\\")}
- Decrement: {+/-\s*count:/ | call feedkeys("\\")}
```#### Aliases for links
Use aliases for links```neorg
- Github url - {&gh phenax/neorg-timelog}
- Npm package link - {&npm react}
- Rust package link - {&crates serde}
- Dart package link - {&pub serde}
- Twitter user @Neovim - {&tw Neovim} (Custom alias defined below)
```To define the custom alias, use -
```lua
require('neorg').setup {
load = {
-- ...
['external.hop-extras'] = {
config = {
aliases = {
tw = 'https://twitter.com/{}'
},
},
},
},
}
```#### Ask for confirmation before opening link
Ask for confirmation (uses `vim.fn.confirm`) before activating a link```neorg
- Asks for confirmation before opening external link - {! https://example.com}
- Confirm before opening alias - {! &npm react}
- Confirm before running command {! +echo "Dangerous commands need confirmation"}
```