Warning
This plugin is still under active development. Some features aren't fully implemented yet. If you experienced unexpected errors, please open an issue.
A lightweight Neovim plugin that makes working with markdown footnote easier
- Create sequential footnotes
- Organize footnotes based on occurrence
- cleanup orphan footnotes
- Goto next/prev footnote
- Move between footnote references and its content
- Pick from existing footnotes for insertion
(WIP)
(WIP)
Install using lazy.nvim:
return {
'chenxin-yan/footnote.nvim',
config = function()
require('footnote').setup {
-- add any configuration here
}
end,
}
Default Configuration:
local default = {
keys = {
new_footnote = '<C-f>',
organize_footnotes = '<leader>of',
next_footnote = ']f',
prev_footnote = '[f',
},
organize_on_save = true,
organize_on_new = true,
}
Example Configuration
return {
'chenxin-yan/footnote.nvim',
ft = 'markdown',
config = function()
require('footnote').setup {
keys = {
new_footnote = '<C-f>',
organize_footnotes = '',
next_footnote = ']f',
prev_footnote = '[f',
},
organize_on_new = false,
}
end,
}
You can disable any keymaps by setting it to ''
, and you can also manually set these keymaps.
Set Keymaps Manually
require('footnote').setup {
keys = {
new_footnote = '',
organize_footnotes = '',
next_footnote = '',
prev_footnote = '',
},
}
vim.keymap.set(
{ 'i', 'n' },
opts.keys.new_footnote,
"<cmd>lua require('footnote').new_footnote()<cr>",
{ buffer = 0, silent = true, desc = 'Create markdown footnote' }
)
vim.keymap.set(
{ 'n' },
opts.keys.organize_footnotes,
"<cmd>lua require('footnote').organize_footnotes()<cr>",
{ buffer = 0, silent = true, desc = 'Organize footnote' }
)
vim.keymap.set(
{ 'n' },
opts.keys.next_footnote,
"<cmd>lua require('footnote').next_footnote()<cr>",
{ buffer = 0, silent = true, desc = 'Next footnote' }
)
vim.keymap.set(
{ 'n' },
opts.keys.prev_footnote,
"<cmd>lua require('footnote').prev_footnote()<cr>",
{ buffer = 0, silent = true, desc = 'Previous footnote' }
)
Create new footnote: require('footnote').new_footnote()
(default: <C-f>
)
- if a footnote reference already exists at the end of the word under cursor, it would jump to that footnote
Organize footnote: require('footnote').organize_footnotes()
(default: <leader>of
)
- organize all references based on order of occurrence in the document
- footnotes are sorted based on numerical value in their references
Organize on new footnote: opts = {organize_on_new = true}
(default: true
)
Next/Prev footnote: require('footnote').next_footnote()
, require('footnote').prev_footnote()
(default: ]f
/[f]
)
- README.md inspired by Folke
- markdowny.nvim
- vim-markdownfootnote