diff options
Diffstat (limited to '.config/nvim/lua/functions.lua')
| -rw-r--r-- | .config/nvim/lua/functions.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/.config/nvim/lua/functions.lua b/.config/nvim/lua/functions.lua new file mode 100644 index 0000000..daee597 --- /dev/null +++ b/.config/nvim/lua/functions.lua | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | -- ┌──────────────────────────┐ | ||
| 2 | -- │▗▀▖ ▐ ▗ │ | ||
| 3 | -- │▐ ▌ ▌▛▀▖▞▀▖▜▀ ▄ ▞▀▖▛▀▖▞▀▘│ | ||
| 4 | -- │▜▀ ▌ ▌▌ ▌▌ ▖▐ ▖▐ ▌ ▌▌ ▌▝▀▖│ | ||
| 5 | -- │▐ ▝▀▘▘ ▘▝▀ ▀ ▀▘▝▀ ▘ ▘▀▀ │ | ||
| 6 | -- └──────────────────────────┘ | ||
| 7 | -- 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 | ||
| 8 | |||
| 9 | local random = math.random | ||
| 10 | |||
| 11 | local function random_filename() | ||
| 12 | uuid = '' | ||
| 13 | for i=0,6 do | ||
| 14 | uuid = uuid .. (string.format('%x', random(0, 0xf))) | ||
| 15 | end | ||
| 16 | return uuid | ||
| 17 | end | ||
| 18 | |||
| 19 | function create_note() | ||
| 20 | nvim_command("e! " .. nvim_call_function('fnameescape', '~/nextcloud/personal_wiki/text/box/' .. random_filename() .. ".wiki")) | ||
| 21 | local text = "= up =\n\n= down =\n\n= keywords =\n\n" | ||
| 22 | nvim_command("put! " .. text) | ||
| 23 | nvim_command("normal gg") | ||
| 24 | end | ||
