Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nguyenvukhang/nvim-toggler
invert text in vim, purely with lua.
https://github.com/nguyenvukhang/nvim-toggler
lua neovim nvim nvim-lua
Last synced: 8 days ago
JSON representation
invert text in vim, purely with lua.
- Host: GitHub
- URL: https://github.com/nguyenvukhang/nvim-toggler
- Owner: nguyenvukhang
- License: mit
- Created: 2022-08-16T09:33:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-15T14:39:19.000Z (7 months ago)
- Last Synced: 2024-12-26T21:07:29.324Z (16 days ago)
- Topics: lua, neovim, nvim, nvim-lua
- Language: Lua
- Homepage:
- Size: 36.1 KB
- Stars: 158
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - nguyenvukhang/nvim-toggler - Invert text, such as toggling between `true` and `false`. (Utility / Cursorline)
README
# nvim-toggler
Invert text in vim, purely with lua.
![demo](https://user-images.githubusercontent.com/10664455/185724246-f7165f38-6058-46f3-809b-d55cf09255e3.gif)
[Install](#install)
·
[Run](#run)
·
[Custom inverses](#custom-inverses)
·
[Custom keymaps](#custom-keymaps)## Install
Using [packer.nvim][packer]
```lua
use { 'nguyenvukhang/nvim-toggler' }
```Using [vim-plug][vim-plug]
```vim
Plug 'nguyenvukhang/nvim-toggler'
```## Run
```lua
-- init.lua
require('nvim-toggler').setup()
``````vim
" init.vim or .vimrc
lua << EOF
require('nvim-toggler').setup()
EOF
```Once that is set, the default binding is `i` to invert the
word under your cursor.## Custom inverses
You can configure `nvim-toggler` with the `setup()` function:
```lua
-- init.lua
require('nvim-toggler').setup({
-- your own inverses
inverses = {
['vim'] = 'emacs'
},
-- removes the default i keymap
remove_default_keybinds = true,
-- removes the default set of inverses
remove_default_inverses = true,
-- auto-selects the longest match when there are multiple matches
autoselect_longest_match = false
})
```## Custom keymaps
To map toggling to something else like `cl`, simply do
```lua
-- init.lua
vim.keymap.set({ 'n', 'v' }, 'cl', require('nvim-toggler').toggle)
```[packer]: https://github.com/wbthomason/packer.nvim
[vim-plug]: https://github.com/junegunn/vim-plug