oberblastmeister / neuron.nvim

Make neovim the best note taking application
MIT License
398 stars 34 forks source link

Automatically detect neuron directory #30

Open trmckay opened 3 years ago

trmckay commented 3 years ago

I hacked together a quick method to automatically detect Neuron directories (relative to the cwd), using plenary.scandir.

local nf = require'plenary.scandir'.scan_dir('.',
    { search_pattern = "neuron.dhall", hidden = false, depth = 2 })

if not(nf[1] == nil) then
    local nd = (nf[1]):gsub("/neuron.dhall", "")
    require'neuron'.setup {
        virtual_titles = true,
        mappings = true,
        run = nil,
        neuron_dir = nd,
        leader = "gz",
    }
end

Perhaps something like this could be adapted to be a more fleshed out method for automatically detecting Neuron directories?

trmckay commented 3 years ago

My bad, I accidentally pressed enter 🤦🏽