From 822614e7e811f8892a2fbb92367c0ed3ed11a9b9 Mon Sep 17 00:00:00 2001 From: Iron-E Date: Sun, 24 Apr 2022 11:34:00 -0400 Subject: [PATCH] docs(README): make less wordy --- README.md | 60 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 833e475..969c02d 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,64 @@ -# About +# nvim-libmodal -This is a rewrite of [vim-libmodal][libmodal] using Neovim's Lua API. +This is a rewrite of [vim-libmodal](https://github.com/Iron-E/vim-libmodal) using Neovim's Lua API. This project aims to be cross-compatable with `vim-libmodal`— with a few notable exceptions (see the [FAQ](#FAQ)). -Unfortunately, during `vim-libmodal`'s development several problems with Vimscript became apparent. Because of this, I have decided to rewrite it using Lua. This project aims to be cross-compatable with `vim-libmodal` version 2.`X`.`Y`, with the only alterations being _additions_ to the source code that have been made under the 2.x.y revision number. +## Requirements -> `funcref()` cannot be used in `libmodal#Enter` or `libmodal#Prompt`, so `nvim-libmodal` is _mostly_ compatable, but not completely. -> -> * See |libmodal-usage| for more details. +* Neovim 0.7+. +* `vim-libmodal` is _not_ installed. -Note that cross-compatability does not mean that `vim-libmodal` and `nvim-libmodal` can be installed at the same time— as a matter of fact, they are developed specifically to replace each other for specific platforms. If you use Vim, use `vim-libmodal`. If you use Neovim, use `nvim-libmodal`. If you are a plugin creator, all code that works for `vim-libmodal` will work with `nvim-libmodal`, but the reverse is not true. +## Installation -# Requirements +You can use [packer.nvim](https://github.com/wbthomason/packer.nvim) (or any package manager) to install this plugin. The below example is for `packer.nvim`: -* Neovim 0.7+. -* `vim-libmodal` is _not_ installed. +```lua +local install_path = vim.fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim' + +if not vim.loop.fs_stat(vim.fn.glob(install_path)) then + os.execute('git clone https://github.com/wbthomason/packer.nvim '..install_path) +end + +vim.api.nvim_command 'packadd packer.nvim' -[libmodal]: https://github.com/Iron-E/vim-libmodal +return require('packer').startup {function(use) + use {'wbthomason/packer.nvim', opt=true} + use 'Iron-E/nvim-libmodal' + -- use {'Username/mode-plugin', wants='nvim-libmodal'} +end} +``` -# Usage +## Usage The following plugins have been constructed using `nvim-libmodal`: +* [`nvim-bufmode`](https://github.com/Iron-E/nvim-bufmode) +* [`nvim-marktext`](https://github.com/Iron-E/nvim-marktext) * [`nvim-tabmode`](https://github.com/Iron-E/nvim-tabmode) -* [`nvim-typora`](https://github.com/Iron-E/nvim-typora) The following samples have been constructed using `nvim-libmodal`: * [`mode-codedoc`](https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/mode-codedoc.lua) -* [`mode-fugidiff`](https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/mode-fugidiff.lua) * [The Official Lua Examples](https://github.com/Iron-E/nvim-libmodal/tree/master/examples/lua) * [The Official Vimscript Examples](https://github.com/Iron-E/nvim-libmodal/tree/master/examples) -See [vim-libmodal][libmodal] and the [docs](./doc) for more information. +See [docs](./doc) for more information. + +### Statusline + +You can add `libmodal` modes to your status line by using [`feline.nvim`](https://github.com/famiu/feline.nvim) or [`galaxyline.nvim`](https://github.com/glepnir/galaxyline.nvim) or . You can find my configuration for `feline.nvim` [here](https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/plugin/feline.lua#L148-L164) and `galaxyline.nvim` [here](https://gitlab.com/Iron_E/dotfiles/-/blob/edf3e1c9779bbc81002832bb03ec875dc86cc16b/.config/nvim/lua/plugin/galaxyline.lua#L140-163)— both of which leverage `nvim-libmodal`'s in the statusbar. + +## FAQ + +### nvim-libmodal vs. vim-libmodal + +The following is a list of expressions that work in `nvim-libmodal` but not `vim-libmodal`: + +* `require 'libmodal'` in Lua. + * `vim-libmodal` does not support interacting with it through Lua, you must use the Vimscript interface. -## Statusline +The following is a list of expressions that work in `vim-libmodal` but not `nvim-libmodal`: -You can add `libmodal` modes to your status line by using [`feline.nvim`](https://github.com/famiu/feline.nvim) or [`galaxyline.nvim`](https://github.com/glepnir/galaxyline.nvim) or . You can find my configuration for `feline.nvim` [here](https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/plugin/feline.lua#L127-154) and `galaxyline.nvim` [here](https://gitlab.com/Iron_E/dotfiles/-/blob/edf3e1c9779bbc81002832bb03ec875dc86cc16b/.config/nvim/lua/plugin/galaxyline.lua#L140-163)— both of which leverage `nvim-libmodal`'s in the statusbar. +* `call libmodal#Enter('FOO', funcref('bar'), baz)` in Vimscript. + * Lua does not support passing `funcref`s from Vimscript. Try using the Lua interface instead. +* `call libmodal#Prompt('FOO', funcref('bar'), baz)` in Vimscript. + * Lua does not support passing `funcref`s from Vimscript. Try using the Lua interface instead.