diff --git a/modules/tui/neovim/runtime/lua/templates/c.lua b/modules/tui/neovim/runtime/lua/templates/c.lua index c372590..467917c 100644 --- a/modules/tui/neovim/runtime/lua/templates/c.lua +++ b/modules/tui/neovim/runtime/lua/templates/c.lua @@ -32,8 +32,8 @@ end --- - `filename` (string): The filename of the new file, e.g., "init.lua". return function(opts) local template = { - { pattern = ".*h", content = h_template }, - { pattern = ".*c", content = c_template }, + { pattern = ".*\.h", content = h_template }, + { pattern = ".*\.c", content = c_template }, } return utils.find_entry(template, opts) diff --git a/modules/tui/neovim/runtime/lua/templates/sh.lua b/modules/tui/neovim/runtime/lua/templates/sh.lua new file mode 100644 index 0000000..961610c --- /dev/null +++ b/modules/tui/neovim/runtime/lua/templates/sh.lua @@ -0,0 +1,27 @@ +local utils = require("new-file-template.utils") + +local function bash_template(relative_path, filename) + return [[ +#!/usr/bin/env bash + ]] +end + +local function sh_template(relative_path, filename) + return [[ +#!/usr/bin/env sh + ]] +end + +--- @param opts table +--- A table containing the following fields: +--- - `full_path` (string): The full path of the new file, e.g., "lua/new-file-template/templates/init.lua". +--- - `relative_path` (string): The relative path of the new file, e.g., "lua/new-file-template/templates/init.lua". +--- - `filename` (string): The filename of the new file, e.g., "init.lua". +return function(opts) + local template = { + { pattern = ".*bash", content = bash_template }, + { pattern = ".*sh", content = sh_template }, + } + + return utils.find_entry(template, opts) +end