Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Sanix-Darker/snips.nvim
Create snippet codes from your nvim editor, code wrapper around snips.sh
https://github.com/Sanix-Darker/snips.nvim
code snippets ssh
Last synced: 6 days ago
JSON representation
Create snippet codes from your nvim editor, code wrapper around snips.sh
- Host: GitHub
- URL: https://github.com/Sanix-Darker/snips.nvim
- Owner: Sanix-Darker
- Created: 2023-06-15T23:05:24.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-13T10:45:23.000Z (over 1 year ago)
- Last Synced: 2024-10-15T23:12:33.611Z (21 days ago)
- Topics: code, snippets, ssh
- Language: Lua
- Homepage:
- Size: 64.5 KB
- Stars: 19
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# snips.nvim
https://github.com/Sanix-Darker/snips.nvim/assets/22576758/673501a4-6a7d-4f9a-bdbb-eb2c78ed3455
---
![Peek 2023-06-20 11-14](https://github.com/Sanix-Darker/snips.nvim/assets/22576758/d8efd731-902e-45e5-8f5b-685a1b30230a)
As a fan of sharing snippet blocks of code, I came across an interesting project [snips](https://snips.sh) from [robherley](https://github.com/robherley), none authentication is required to generate a small snippet of code, whenever you want and without limit.So I thought... why not make a small/dumb plugin for that on my neovim !
In the past I used [Gist.vim](https://github.com/mattn/vim-gist) but the fact that it required authentication and I had to generate a token that was going to be saved on "clear" on my computer... I didn't really like that.## REQUIREMENTS
- VIM (>=8 recommended)
- NVIM (>=0.5 recommended)## FEATURES
- Save/upload code snipets from your code editor.
- List/Edit your saved blocks of code.## HOW DOES IT WORK
The simple idea behind this plugin is to:
- get selected rows from current buffer
- save it in a temporary file
- run this command `cat /your-generated-tmp.file | ssh snips.sh` and return output in a new splitted buffer.## HOW TO INSTALL
- Using Packer :
```lua
use 'Sanix-Darker/snips.nvim'
```- Using Vim-plug :
```
Plug 'Sanix-Darker/snips.nvim'
```Then in your `init.lua` file you can just run :
```lua
require('snips.nvim').setup()
-- this will just make sure the plugin is available
-- maybe planing on adding more customisations ? idk...
```- Using Lazy.nvim :
```lua
require('snips').setup()
```
or```lua
return {
{
"Sanix-Darker/snips.nvim",
config = true,
cmd = { "SnipsCreate" }, -- optional, make the plugin loads at cmd executed
},
}
```## HOW TO USE
- *IMPORTANT NOTE*: You need to etablish a first connection with snips.sh server
by running this example command on the terminal : `echo "Hello world" | ssh snips.sh`
Then you can open your nvim.
- Select a bunch of lines from your current buffer and use a snips.nvim command.## COMMANDS
- `SnipsList` To open the list of all uploaded/saved snips you have created so far.
- `SnipsCreate` and you have generated/saved a snippet of your code, you're left with the link to share.
- `SnipsCreatePrivate` to create private snips
Note: on private mode, with a generated link like : https://snips.sh/f/the-id
You can access your private snips code with:
$ ssh f:[email protected]
- `SnipsCreateFromRegister` to create a snippet from register.
- `SnipsCreatePrivateFromRegister` to create a snippet from register and save/upload on private.## SETUP OPTIONS
Those are default values, you can change as your will !
```lua
local opts = {
snips_host = "snips.sh", -- in case you deployed your own custom instance
post_behavior = "echo", -- enum: ["echo", "yank", "echo_and_yank"]
to_register = "+", -- yank to
from_register = "+", -- copy from
cat_cmd = "cat", -- can be `bat` or `less`
ssh_cmd = "ssh", -- choose your custom ssh client
}
require("snips.nvim").setup(opts)
```## NOTE
If you have some ideas on how to upgrade this plugin i would be happy to read your issues, suggestions, Pull Requests.
But for now i will keep it simple since it does what i want it to do for now.## AUTHOR
[sanix-darker](https://github.com/sanix-darker)
## CONTRIBUTORS
[Pagliacii](https://github.com/Pagliacii)