Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tamton-aquib/essentials.nvim
Some tiny functions which i use regularly in neovim. Not a plugin per se.
https://github.com/tamton-aquib/essentials.nvim
lua neovim nvim
Last synced: 3 months ago
JSON representation
Some tiny functions which i use regularly in neovim. Not a plugin per se.
- Host: GitHub
- URL: https://github.com/tamton-aquib/essentials.nvim
- Owner: tamton-aquib
- License: mit
- Created: 2021-10-05T17:19:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-11T07:29:50.000Z (11 months ago)
- Last Synced: 2024-05-02T03:45:42.925Z (10 months ago)
- Topics: lua, neovim, nvim
- Language: Lua
- Homepage:
- Size: 59.6 KB
- Stars: 44
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# essentials.nvim
Some tiny utility functions which i use locally.
Not actually meant for external use because there are no config options.
Instead you could fork the repo or copy paste the functions to your config.> Requires nvim version: 0.7.
The functions included are:
### Go to url under the cursor
Will also work for stuff like `folke/tokyonight.nvim` or \[link](https://github.com)
> uses `xdg-open` in linux.
> use go_to_url("start") for windows. #untested
```vim
nnoremap gx :lua require("essentials").go_to_url()
```
---### Search results from cht.sh
Search programming doubts inside neovim with cheat.sh
> Gets current filetype and searches accordingly.
```vim
nnoremap cs :lua require("essentials").cheat_sh()
```---
### null_pointer
Share file or part of a file over https://0x0.st
```vim
nnoremap pp :lua require("essentials").null_pointer()
" or as a command
command! -range=% PP lua require("essentials").null_pointer()
```---
### Go to the last place when opening a buffer
```vim
autocmd BufReadPost * lua require("essentials").last_place()
```---
### Run different files
Run files according to filetypes and commands.
```vim
nnoremap r :lua require("essentials").run_file()
```---
### VSCode like floating rename window.
> Uses vim.lsp.buf.rename()
```vim
nnoremap :lua require("essentials").rename()
```
---### Open terminal
Open a terminal with minimal options.
Args:
- cmd: the command to run in the terminal
- direction: 'h': horizontal, 'v': vertical, 't': tab
- close_on_exit: boolean
TODO: add a pic```vim
nnoremap lg :lua require("essentials").open_term('lazygit', 't', true)
```
---### Simple Commenting function
A 20LOC function for commenting. (No multi-line comments).
```vim
nnoremap :lua require("essentials").toggle_comment()
vnoremap :lua require("essentials").toggle_comment(true)
```
---### A smol fold function.
Simple fold function. Example:
```lua
vim.opt.foldtext = 'v:lua.require("essentials").simple_fold()'
```---
### Swap Booleans
A function to swap bools.
> (true->false and false->true)
```vim
nnoremap s :lua require("essentials").swap_bool()
```### Util Functions
- > `ui_input` - emulation for vim.ui.input in a floating window
```lua
vim.ui.input = require("essentials").ui_input
```- > `ui_select` - emulation for vim.ui.select in a float
```lua
vim.ui.select = require("essentials").ui_select
```- > `ui_picker` - wrapper util telescope function. Example:
```lua
ui_picker({'1', '2', '3'}, {}, function(item) print("Selected: "..item) end)
```- > `ui_notify` - A floating window for vim.notify
```lua
vim.notify = require("essentials").ui_notify
```