diff --git a/lua/grug-far/opts.lua b/lua/grug-far/opts.lua index b61dffc0..43e0d73a 100644 --- a/lua/grug-far/opts.lua +++ b/lua/grug-far/opts.lua @@ -24,6 +24,21 @@ local defaultOptions = { -- zero disables showing it maxSearchCharsInTitles = 30, + keymaps = { + replace = '', + qflist = '', + gotoLocation = '', + close = '' + }, + + -- separator between inputs and results, default depends on nerdfont + resultsSeparatorLineChar = '', + + -- spinner states, default depends on nerdfont, set to nil to disable + spinnerStates = { + '󱑋 ', '󱑌 ', '󱑍 ', '󱑎 ', '󱑏 ', '󱑐 ', '󱑑 ', '󱑒 ', '󱑓 ', '󱑔 ', '󱑕 ', '󱑖 ' + }, + -- icons for UI, default ones depend on nerdfont icons = { -- whether to show icons @@ -40,19 +55,15 @@ local defaultOptions = { resultsActionMessage = '  ' }, - -- separator between inputs and results, default depends on nerdfont - resultsSeparatorLineChar = '', - - -- spinner states, default depends on nerdfont, set to nil to disable - spinnerStates = { - '󱑋 ', '󱑌 ', '󱑍 ', '󱑎 ', '󱑏 ', '󱑐 ', '󱑑 ', '󱑒 ', '󱑓 ', '󱑔 ', '󱑕 ', '󱑖 ' - }, + -- placeholders to show in inpuut areas when they are empty, set + placeholders = { + -- whether to show placeholders + enabled = true, - keymaps = { - replace = '', - qflist = '', - gotoLocation = '', - close = '' + search = "ex: foo foo([a-z0-9]*) fun\\(", + replacement = "ex: bar ${1}_foo $$MY_ENV_VAR ", + filesGlob = "ex: *.lua *.{css,js} **/docs/*.md", + flags = "ex: --hidden (-.) --ignore-case (-i) --multiline (-U) --fixed-strings (-F)", } } diff --git a/lua/grug-far/render.lua b/lua/grug-far/render.lua index 7d6dd456..7126cf38 100644 --- a/lua/grug-far/render.lua +++ b/lua/grug-far/render.lua @@ -28,6 +28,7 @@ local BEFORE_RESULTS_LINES = 2 local function render(params, context) local buf = params.buf local inputs = context.state.inputs + local placeholders = context.options.placeholders local lineNr = 0 ensureTopEmptyLines(buf, TOP_EMPTY_LINES) @@ -40,7 +41,7 @@ local function render(params, context) extmarkName = "search", icon = 'searchInput', label = "Search:", - placeholder = "ex: foo foo([a-z0-9]*) fun\\(", + placeholder = placeholders.enabled and placeholders.search }, context) vim.api.nvim_buf_set_name(buf, @@ -53,7 +54,7 @@ local function render(params, context) extmarkName = "replace", icon = 'replaceInput', label = "Replace:", - placeholder = "ex: bar ${1}_foo $$MY_ENV_VAR ", + placeholder = placeholders.enabled and placeholders.replacement }, context) lineNr = lineNr + 1 @@ -63,7 +64,7 @@ local function render(params, context) extmarkName = "files_glob", icon = 'filesFilterInput', label = "Files Filter:", - placeholder = "ex: *.lua *.{css,js} **/docs/*.md", + placeholder = placeholders.enabled and placeholders.filesGlob }, context)) lineNr = lineNr + 1 @@ -73,8 +74,7 @@ local function render(params, context) extmarkName = "flags", icon = 'flagsInput', label = "Flags:", - -- TODO (sbadragan): make those configurable - placeholder = "ex: --hidden (-.) --ignore-case (-i) --multiline (-U) --fixed-strings (-F)", + placeholder = placeholders.enabled and placeholders.flags }, context)) lineNr = lineNr + BEFORE_RESULTS_LINES