Skip to content

notelgnis/fetchfact.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple fact fetcher with caching support

A simple fact fetcher that fetches facts from the Ninjas Facts API

Installation

Lazy

{
    'notelgnis/fetchfact.nvim',
    opts = {
        cache_file_path = '~/.cache/facts_cache.json',
        config_file_path = '~/.config/.facts_api_key',
        min_facts = 2,
        max_facts = 10,
    },
}
  • cache_file_path: Path to the cache file where the facts are stored
  • config_file_path: Path to the file where the API key is stored
  • min_facts: Minimum number of facts to keep in the cache before fetching new ones
  • max_facts: Maximum number of facts to keep in the cache

NOTE: Do not forget to get the API key from Ninjas Facts API and add it in the config file

Usage Example in Dashboard

{
    'nvimdev/dashboard-nvim',
    event = 'VimEnter',
    config = function()
        require('dashboard').setup {
            config = {
                footer = function()
                    local fact = require('fetchfact').get_split_fact(85)
                    return { '', unpack(fact) }
                end,
            },
        }
    end,
},

About

A simple fact fetcher for NeoVim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages