Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antonk52/markdowny.nvim
Markdown like keymaps for toggling text formatting
https://github.com/antonk52/markdowny.nvim
Last synced: about 2 months ago
JSON representation
Markdown like keymaps for toggling text formatting
- Host: GitHub
- URL: https://github.com/antonk52/markdowny.nvim
- Owner: antonk52
- Created: 2023-01-11T20:17:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-19T00:31:59.000Z (2 months ago)
- Last Synced: 2024-07-19T08:43:30.716Z (about 2 months ago)
- Language: Lua
- Size: 16.6 KB
- Stars: 69
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# markdowny.nvim
Neovim plugin for markdown like keybindings. Similar to notion, discord, slack etc
![plugin demo](https://user-images.githubusercontent.com/5817809/211911652-fe0c1d26-1dd0-4832-b948-e685067bb78b.gif)
## Install
```lua
-- packer
use {
'antonk52/markdowny.nvim',
config = function()
require('markdowny').setup()
end
}
``````lua
-- lazy.nvim
{
'antonk52/markdowny.nvim'
config = function()
require('markdowny').setup()
end
}
```## Setup Options
- `filetypes` a table of filetypes to add markdowny keymaps. Default `{'markdown', 'gitcommit', 'hgcommit'}`
```lua
require('markdowny').setup({filetypes = {'markdown', 'txt'}})
```## Default keymaps
All in visual mode
- ``: Adds a link to visually selected text.
- ``: Toggles visually selected text to bold.
- ``: Toggles visually selected text to italic.
- ``: Toggles visually selected text to inline code, and **V-LINE** selected text to a multiline code block.## Custom setup
Alternatively to default keymaps you can use custom keymaps without calling `setup` function, make sure to map to a string rather than a Lua function. Here are the defaults:
```lua
vim.keymap.set('v', '', ":lua require('markdowny').bold()", { buffer = 0 })
vim.keymap.set('v', '', ":lua require('markdowny').italic()", { buffer = 0 })
vim.keymap.set('v', '', ":lua require('markdowny').link()", { buffer = 0 })
vim.keymap.set('v', '', ":lua require('markdowny').code()", { buffer = 0 })
```To apply the keymaps to specific filetypes, use `autocmd`:
```lua
vim.api.nvim_create_autocmd('FileType', {
desc = 'markdowny.nvim keymaps',
pattern = { 'markdown' },
callback = function()
-- add custom keymaps here
end,
})
```## Acknowledgments
This plugin uses `vim.ui.input` to prompt for link's href, to have it in a floating window, like in the demo above, you can use [dressing.nvim](https://github.com/stevearc/dressing.nvim).