A Neovim plugin that provides random famous quotes from a bundled CSV file. Quotes are shuffled using the Fisher-Yates algorithm and cached for performance.
- No dependencies: everything is self-contained so no unnecessary internet API calls
- Supports fetching one quote, multiple quotes, or all the quotes
- Caches quotes to avoid repeated file I/O
- Neovim 0.5.0 or later
Install using your preferred Neovim package manager.
Using packer.nvim
use 'mahyarmirrashed/famous-quotes'
Using vim-plug
Plug 'mahyarmirrashed/famous-quotes'
Using lazy.nvim
{
"mahyarmirrashed/famous-quotes.nvim",
config = function()
require("famous-quotes").setup()
end,
}
The plugin provides a single function, get_quote(count)
, to retrieve random quotes.
-- Get one random quote (default)
local quote = require('famous-quotes').get_quote()
print(quote[1].author .. ': ' .. quote[1].quote)
-- Get three random quotes
local quotes = require('famous-quotes').get_quote(3)
for _, q in ipairs(quotes) do
print(q.author .. ': ' .. q.quote)
end
-- Get all quotes
local all_quotes = require('famous-quotes').get_quote(-1)
- count (optional, number): Number of quotes to retrieve. Defaults to 1. Use
-1
to get all quotes - Returns: A table of quote objects, each with
author
andquote
fields
- No-op function provided for compatibility. No configuration needed
Thanks to @JakubPetriska for the CSV of quotes used in this plugin.