diff --git a/nvim/lua/opdavies/snippets/ft/bash.lua b/nvim/lua/opdavies/snippets/ft/bash.lua deleted file mode 100644 index 4859a80..0000000 --- a/nvim/lua/opdavies/snippets/ft/bash.lua +++ /dev/null @@ -1,31 +0,0 @@ -local ls = require "luasnip" - -local fmta = require("luasnip.extras.fmt").fmta - -return { - run = fmta( - [=[ - #!/usr/bin/env bash - - set -o errexit - set -o nounset - set -o pipefail - - function help { - printf "%s <> [args]\n\nTasks:\n" "${0}" - - compgen -A function | grep -v "^_" | cat -n - - printf "\nExtended help:\n Each task has comments for general usage\n" - } - - # Include any local tasks. - # https://stackoverflow.com/a/6659698 - [[ -e "${BASH_SOURCE%/*}/run.local" ]] && source "${BASH_SOURCE%/*}/run.local" - - TIMEFORMAT="Task completed in %3lR" - time "${@:-help}" - ]=], - {} - ), -} diff --git a/nvim/lua/opdavies/snippets/ft/lua.lua b/nvim/lua/opdavies/snippets/ft/lua.lua index c2abfba..18c28e5 100644 --- a/nvim/lua/opdavies/snippets/ft/lua.lua +++ b/nvim/lua/opdavies/snippets/ft/lua.lua @@ -1,21 +1,10 @@ local ls = require "luasnip" local fmt = require("luasnip.extras.fmt").fmt -local rep = require("luasnip.extras").rep local f, i = ls.function_node, ls.insert_node return { - pcall = fmt( - [[ - local status_ok, {} = pcall(require, "{}") - if not status_ok then - return - end - ]], - { i(1), rep(1) } - ), - req = fmt([[local {} = require "{}"]], { f(function(import_name) local parts = vim.split(import_name[1][1], ".", true) diff --git a/nvim/lua/opdavies/snippets/ft/markdown.lua b/nvim/lua/opdavies/snippets/ft/markdown.lua deleted file mode 100644 index b2a76e4..0000000 --- a/nvim/lua/opdavies/snippets/ft/markdown.lua +++ /dev/null @@ -1,20 +0,0 @@ -local fmt = require("luasnip.extras.fmt").fmt -local ls = require "luasnip" - -local i = ls.insert_node - -local M = { - frontmatter = fmt( - [[ - --- - title: {} - --- - {} - ]], - { i(1), i(0) } - ), - - link = fmt([[[{}]({}){} ]], { i(1), i(2), i(0) }), -} - -return M diff --git a/nvim/lua/opdavies/snippets/ft/nix.lua b/nvim/lua/opdavies/snippets/ft/nix.lua deleted file mode 100644 index 1ef44d5..0000000 --- a/nvim/lua/opdavies/snippets/ft/nix.lua +++ /dev/null @@ -1,23 +0,0 @@ -local fmta = require("luasnip.extras.fmt").fmta -local ls = require "luasnip" - -local c = ls.choice_node -local i = ls.insert_node -local t = ls.text_node - -local M = { - vimplugin = fmta( - [[ - { - plugin = <>.<>; - type = "lua"; - config = '' - <> - ''; - }<> - ]], - { c(1, { t "vimPlugins", t "customVim" }), i(2), i(3), i(0) } - ), -} - -return M diff --git a/nvim/lua/opdavies/snippets/ft/twig.lua b/nvim/lua/opdavies/snippets/ft/twig.lua deleted file mode 100644 index 41842e3..0000000 --- a/nvim/lua/opdavies/snippets/ft/twig.lua +++ /dev/null @@ -1,31 +0,0 @@ -local fmta = require("luasnip.extras.fmt").fmta -local ls = require "luasnip" - -local i = ls.insert_node - -local M = { - stories = fmta( - [[ - {% stories with { title: '' } %} - - <finish> - - {% endstories %} - ]], - { name = i(1), title = i(2), finish = i(0) } - ), - - story = fmta( - [[ - {% story <name> with { - name: '<label>', - args: {}, - } %} - <finish> - {% endstory %} - ]], - { name = i(1, "default"), label = i(2), finish = i(0) } - ), -} - -return M