summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/functions.lua
blob: daee59725a54498d978ffb71c694d3732c64fd02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- ┌──────────────────────────┐
-- │▗▀▖         ▐  ▗          │
-- │▐  ▌ ▌▛▀▖▞▀▖▜▀ ▄ ▞▀▖▛▀▖▞▀▘│
-- │▜▀ ▌ ▌▌ ▌▌ ▖▐ ▖▐ ▌ ▌▌ ▌▝▀▖│
-- │▐  ▝▀▘▘ ▘▝▀  ▀ ▀▘▝▀ ▘ ▘▀▀ │
-- └──────────────────────────┘
-- 2021-10-10 21:50 WIP, I don't know how to integrate these functions to init.lua and honestly, everything is a nvim_command or something anyway

local random = math.random

local function random_filename()
    uuid = ''
    for i=0,6 do
        uuid = uuid .. (string.format('%x', random(0, 0xf)))
    end
    return uuid
end

function create_note()
    nvim_command("e! " .. nvim_call_function('fnameescape', '~/nextcloud/personal_wiki/text/box/' .. random_filename() .. ".wiki"))
    local text = "= up =\n\n= down =\n\n= keywords =\n\n"
    nvim_command("put! " .. text)
    nvim_command("normal gg")
end