Skip to content

Commit

Permalink
reorganise opt
Browse files Browse the repository at this point in the history
  • Loading branch information
Futarimiti committed Oct 3, 2023
1 parent ae80f6a commit 4e7bea6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Default configuration:
require('spooky').setup { directory = vim.fn.stdpath('config') .. '/skeletons'
, case_sensitive = false
, auto_use_only = true
, show_no_template = true
, ui = { select = 'builtin'
, select_full_path = false
, show_no_template = true
, prompt = 'Select template'
, previewer_prompt = 'Preview'
, preview_normalised = true
Expand All @@ -59,9 +59,9 @@ Full description of the options:
| `directory` | string | Path to skeletons directory |
| `case_sensitive` | boolean | Whether to match skeletons case sensitively (WIP) |
| `auto_use_only` | boolean | Whether to only use auto-inserted skeletons when only 1 available |
| `show_no_template` | boolean | Whether to show "no template" as a possible choice |
| `ui.select` | string | UI to use for selecting templates, one of `'builtin'` and `'telescope'` |
| `ui.select_full_path` | boolean | Whether to show full templates paths or basenames in selection UI |
| `ui.show_no_template` | boolean | Whether to show "no template" as a possible choice |
| `ui.prompt` | string | Prompt for selecting templates |
| `ui.previewer_prompt` | string | Prompt for previewing templates (Telescope only) |
| `ui.preview_normalised` | boolean | Whether to show normalised template in preview (Telescope only) |
Expand Down
4 changes: 2 additions & 2 deletions lua/spooky/config/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ local const = require 'spooky.consts'
M.defaults = { directory = vim.fn.stdpath('config') .. '/skeletons'
, case_sensitive = false
, auto_use_only = true
, show_no_template = true
, ui = { select = 'builtin'
, select_full_path = false
, show_no_template = true
, prompt = 'Select template'
, previewer_prompt = 'Preview'
, preview_normalised = true
Expand All @@ -21,10 +21,10 @@ M.typecheck = function (config)
vim.validate { directory = { config.directory, 'string' }
, case_sensitive = { config.case_sensitive, 'boolean' }
, auto_use_only = { config.auto_use_only, 'boolean' }
, show_no_template = { config.show_no_template, 'boolean' }
, ui = { config.ui, 'table' }
, ['ui.select'] = { config.ui.select, function (ui) return vim.tbl_contains(const.ui_list, ui) end }
, ['ui.select_full_path'] = { config.ui.select_full_path, 'boolean' }
, ['ui.show_no_template'] = { config.ui.show_no_template, 'boolean' }
, ['ui.prompt'] = { config.ui.prompt, 'string' }
, ['ui.previewer_prompt'] = { config.ui.previewer_prompt, 'string' }
, ['ui.preview_normalised'] = { config.ui.preview_normalised, 'boolean' }
Expand Down
2 changes: 1 addition & 1 deletion lua/spooky/templates/choose/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local M = {}
M.choose_one = function (fullpaths, user, do_with_choice)
local no_template = user.ui.no_template
local show_full = user.ui.select_full_path
local show_no_template = user.show_no_template
local show_no_template = user.ui.show_no_template
local representation, mappings = (function ()
local ret, map = {}, {}
for _, fullpath in ipairs(fullpaths) do
Expand Down
2 changes: 1 addition & 1 deletion lua/spooky/templates/choose/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ M.choose_one = function (buf, fullpaths, user, do_with_choice)
local previewer_prompt = user.ui.previewer_prompt
local no_template = user.ui.no_template
local show_full = user.ui.select_full_path
local show_no_template = user.show_no_template
local show_no_template = user.ui.show_no_template

local pickers = require 'telescope.pickers'
local finders = require 'telescope.finders'
Expand Down

0 comments on commit 4e7bea6

Please sign in to comment.