Skip to content

Configuration

Λlisue edited this page Nov 17, 2024 · 11 revisions

In Fall, configurations that leverage Vim’s built-in functionality are categorized as “Configuration.” This includes settings such as key mappings, highlights, and buffer option modifications.

Mappings

See Mappings page for entire mapping list and way to configure.

Highlight

Highlight Group Description
FallNormal Highlight for normal text in the picker window.
FallBorder Highlight for the border text in the picker window.
FallInputHeader Highlight for the header text in the input component. Defaults to FallBorder.
FallInputCounter Highlight for the counter text in the input component. Defaults to FallBorder.
FallInputCursor Highlight for the cursor in the input component. Defaults to Cursor.
FallListMatch Highlight for matched text in the list component. Defaults to Match.
FallListSelected Highlight for the selected item in the list component. Defaults to CurSearch.
FallHelpHeader Highlight for the header text in the help component. Defaults to Conceal.
FallHelpMappingLhs Highlight for the left-hand side of mappings in the help component. Defaults to Special.
FallHelpMappingRhs Highlight for the right-hand side of mappings in the help component. Defaults to Title.
FallHelpMappingOperator Highlight for operators in the help component. Defaults to Operator.

For example:

Vim
function! s:my_fall_style() abort
  highlight FallNormal ctermfg=Blue ctermbg=Black guifg=#0000FF guibg=#000000
  highlight FallBorder ctermfg=Green guifg=#00FF00
  highlight FallInputHeader cterm=bold ctermfg=Yellow guifg=#FFFF00 gui=bold
  highlight FallInputCounter ctermfg=Gray guifg=#808080
  highlight FallInputCursor ctermfg=Red guifg=#FF0000 gui=underline
  highlight FallListMatch ctermbg=Yellow guibg=#FFA500
  highlight FallListSelected cterm=reverse gui=reverse
  highlight FallHelpHeader cterm=italic ctermfg=Cyan guifg=#00FFFF gui=italic
  highlight FallHelpMappingLhs ctermfg=Magenta guifg=#FF00FF
  highlight FallHelpMappingRhs cterm=bold ctermfg=Green guifg=#00FF00 gui=bold
  highlight FallHelpMappingOperator ctermfg=DarkGray guifg=#A9A9A9
endfunction

augroup fall_plugin_style
  autocmd!
  autocmd ColorScheme * call s:my_fall_style()
augroup END

call s:my_fall_style()
Lua (by ChatGPT)
local function my_fall_style()
  vim.api.nvim_set_hl(0, "FallNormal", { ctermfg = "Blue", ctermbg = "Black", fg = "#0000FF", bg = "#000000" })
  vim.api.nvim_set_hl(0, "FallBorder", { ctermfg = "Green", fg = "#00FF00" })
  vim.api.nvim_set_hl(0, "FallInputHeader", { cterm = { "bold" }, ctermfg = "Yellow", fg = "#FFFF00", bold = true })
  vim.api.nvim_set_hl(0, "FallInputCounter", { ctermfg = "Gray", fg = "#808080" })
  vim.api.nvim_set_hl(0, "FallInputCursor", { ctermfg = "Red", fg = "#FF0000", underline = true })
  vim.api.nvim_set_hl(0, "FallListMatch", { ctermbg = "Yellow", bg = "#FFA500" })
  vim.api.nvim_set_hl(0, "FallListSelected", { cterm = { "reverse" }, reverse = true })
  vim.api.nvim_set_hl(0, "FallHelpHeader", { cterm = { "italic" }, ctermfg = "Cyan", fg = "#00FFFF", italic = true })
  vim.api.nvim_set_hl(0, "FallHelpMappingLhs", { ctermfg = "Magenta", fg = "#FF00FF" })
  vim.api.nvim_set_hl(0, "FallHelpMappingRhs", { cterm = { "bold" }, ctermfg = "Green", fg = "#00FF00", bold = true })
  vim.api.nvim_set_hl(0, "FallHelpMappingOperator", { ctermfg = "DarkGray", fg = "#A9A9A9" })
end

vim.api.nvim_create_augroup("FallPluginStyle", { clear = true })
vim.api.nvim_create_autocmd("ColorScheme", {
  group = "FallPluginStyle",
  callback = my_fall_style,
})

my_fall_style()

Sign

Sign Name Description
FallListSelected Indicator sign for the selected item in the list component. Defaults to '»'.

For example:

Vim
function! s:my_fall_style() abort
  sign define FallListSelected text=*
endfunction

augroup fall_plugin_style
  autocmd!
  autocmd ColorScheme * call s:my_fall_style()
augroup END

call s:my_fall_style()
Lua (by ChatGPT)
local function my_fall_style()
  vim.fn.sign_define("FallListSelected", { text = "*" })
end

vim.api.nvim_create_augroup("FallPluginStyle", { clear = true })
vim.api.nvim_create_autocmd("ColorScheme", {
  group = "FallPluginStyle",
  callback = my_fall_style,
})

my_fall_style()

User autocmd

Event Name Description
FallPickerEnter:{name} Triggered when a picker is opened. {name} represents the name of the picker.
FallPickerLeave:{name} Triggered when a picker is closed. {name} represents the name of the picker.
FallCustomLoaded Triggered when the user customization file is loaded.
FallCustomRecached Triggered after the user customization file has been re-cached.
FallPreviewRendered:{filename} Triggered when the preview is rendered. {filename} represents the name of the previewed file.

FallPickerEnter:{name} is used to configure Mappings. User may want to use FallPreviewRenderered:{filename} autocmd to apply buffer or window options like

Vim
function! s:my_fall_preview() abort
  " Disable number/relativenumber on the preview component
  setlocal nonumber norelativenumber
endfunction

augroup my_fall_preview
  autocmd!
  autocmd User FallPreviewRendered:* call s:my_fall_preview()
augroup END
Lua (by ChatGPT)
local function my_fall_preview()
  -- Disable line numbers and relative line numbers in the preview component
  vim.opt_local.number = false
  vim.opt_local.relativenumber = false
end

vim.api.nvim_create_augroup("MyFallPreview", { clear = true })

vim.api.nvim_create_autocmd("User", {
  group = "MyFallPreview",
  pattern = "FallPreviewRendered:*",
  callback = my_fall_preview,
})

FileType

FileType Description
fall-input FileType for the input component.
fall-list FileType for the list component.
fall-help FileType for the help component.

All components, except the preview, have unique FileTypes listed above. This allows users to use FileType autocmd to apply specific configurations, such as:

#####Vim

function! s:my_fall_config() abort
  " Enable the 'list' option for Fall's components
  setlocal list
endfunction

augroup my_fall_config
  autocmd!
  autocmd FileType fall-input call s:my_fall_config()
  autocmd FileType fall-list call s:my_fall_config()
  autocmd FileType fall-help call s:my_fall_config()
augroup END
Lua (by ChatGPT)
local function my_fall_config()
  -- Enable the 'list' option for Fall's components
  vim.opt_local.list = true
end

vim.api.nvim_create_augroup("my_fall_config", { clear = true })

vim.api.nvim_create_autocmd("FileType", {
  group = "my_fall_config",
  pattern = { "fall-input", "fall-list", "fall-help" },
  callback = my_fall_config,
})

Use FallPreviewRendered:{filename} autocmd instead to configure the preview component.

Clone this wiki locally