Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d192708
feat: implement prompt_position layout configuration
sQVe Aug 5, 2025
94966bd
feat: restructure configuration with layout object
sQVe Aug 5, 2025
636c138
feat: implement flexible configuration deprecation system
sQVe Aug 5, 2025
f270e16
refactor: extract config resolution utilities to improve maintainability
sQVe Aug 6, 2025
37f42b9
feat: add flexible configuration deprecation system
sQVe Aug 6, 2025
875987a
docs: update documentation for comprehensive layout positioning
sQVe Aug 6, 2025
659176a
docs: add comprehensive documentation for all configuration options
sQVe Aug 6, 2025
38666c2
style: align comments in documentation for improved readability
sQVe Aug 6, 2025
67a14d2
style: comprehensively align all comments in documentation
sQVe Aug 6, 2025
6536829
style: align comment formatting in documentation
sQVe Aug 6, 2025
b014ee7
chore: run stylua
sQVe Aug 6, 2025
6b22967
fix(ui): standardize layout coordinate calculations across preview po…
sQVe Aug 6, 2025
903805c
Merge branch 'main' into feat/allow-layout-customization
sQVe Aug 11, 2025
099aa20
feat: move prompt position handling to Rust layer
sQVe Aug 11, 2025
0f9a419
chore: run cargo fmt
sQVe Aug 11, 2025
3c3e99f
fix: correct item selection when prompt position is bottom
sQVe Aug 13, 2025
47287a3
Merge branch 'main' into feat/allow-layout-customization
sQVe Aug 13, 2025
ee9890a
WIP: fix sorting
dmtrKovalenko Aug 14, 2025
5f6dbe3
feat: Fix ordering logic
dmtrKovalenko Aug 17, 2025
c209e37
fix configuration
dmtrKovalenko Aug 17, 2025
6af2264
Merge branch 'main' into feat/allow-layout-customization
dmtrKovalenko Aug 17, 2025
1c63f7e
stylua
dmtrKovalenko Aug 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 62 additions & 103 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,110 +72,69 @@ FFF.nvim comes with sensible defaults. Here's the complete configuration with al

```lua
require('fff').setup({
-- Core settings
base_path = vim.fn.getcwd(), -- Base directory for file indexing
max_results = 100, -- Maximum search results to display
max_threads = 4, -- Maximum threads for fuzzy search
prompt = '🪿 ', -- Input prompt symbol
title = 'FFF Files', -- Window title
ui_enabled = true, -- Enable UI (default: true)

-- Window dimensions
width = 0.8, -- Window width as fraction of screen
height = 0.8, -- Window height as fraction of screen

-- Preview configuration
preview = {
enabled = true, -- Enable preview pane
width = 0.5, -- Preview width as fraction of window
max_lines = 5000, -- Maximum lines to load
max_size = 10 * 1024 * 1024, -- Maximum file size (10MB)
imagemagick_info_format_str = '%m: %wx%h, %[colorspace], %q-bit', -- ImageMagick info format
line_numbers = false, -- Show line numbers in preview
wrap_lines = false, -- Wrap long lines
show_file_info = true, -- Show file info header
binary_file_threshold = 1024, -- Bytes to check for binary detection
filetypes = { -- Per-filetype settings
svg = { wrap_lines = true },
markdown = { wrap_lines = true },
text = { wrap_lines = true },
log = { tail_lines = 100 },
base_path = vim.fn.getcwd(),
prompt = '🪿 ',
title = 'FFFiles',
max_results = 100,
max_threads = 4,
layout = {
height = 0.8,
width = 0.8,
prompt_position = 'bottom', -- or 'top'
preview_position = 'right', -- or 'left', 'right', 'top', 'bottom'
preview_size = 0.5,
},
},

-- Layout configuration (alternative to width/height)
layout = {
prompt_position = 'top', -- Position of prompt ('top' or 'bottom')
preview_position = 'right', -- Position of preview ('right' or 'left')
preview_width = 0.4, -- Width of preview pane
height = 0.8, -- Window height
width = 0.8, -- Window width
},

-- Keymaps
keymaps = {
close = '<Esc>',
select = '<CR>',
select_split = '<C-s>',
select_vsplit = '<C-v>',
select_tab = '<C-t>',
move_up = { '<Up>', '<C-p>' }, -- Multiple bindings supported
move_down = { '<Down>', '<C-n>' },
preview_scroll_up = '<C-u>',
preview_scroll_down = '<C-d>',
toggle_debug = '<F2>', -- Toggle debug scores display
},

-- Highlight groups
hl = {
border = 'FloatBorder',
normal = 'Normal',
cursor = 'CursorLine',
matched = 'IncSearch',
title = 'Title',
prompt = 'Question',
active_file = 'Visual',
frecency = 'Number',
debug = 'Comment',
},

-- Frecency tracking (track file access patterns)
frecency = {
enabled = true, -- Enable frecency tracking
db_path = vim.fn.stdpath('cache') .. '/fff_nvim', -- Database location
},

-- Logging configuration
logging = {
enabled = true, -- Enable logging
log_file = vim.fn.stdpath('log') .. '/fff.log', -- Log file location
log_level = 'info', -- Log level (debug, info, warn, error)
},

-- UI appearance
ui = {
wrap_paths = true, -- Wrap long file paths in list
wrap_indent = 2, -- Indentation for wrapped paths
max_path_width = 80, -- Maximum path width before wrapping
},

-- Image preview (requires terminal with image support)
image_preview = {
enabled = true, -- Enable image previews
max_width = 80, -- Maximum image width in columns
max_height = 24, -- Maximum image height in lines
},

-- Icons
icons = {
enabled = true, -- Enable file icons
},

-- Debug options
debug = {
enabled = false, -- Enable debug mode
show_scores = false, -- Show scoring information (toggle with F2)
},
preview = {
enabled = true,
max_size = 10 * 1024 * 1024, -- Do not try to read files larger than 10MB
chunk_size = 8192, -- Bytes per chunk for dynamic loading (8kb - fits ~100-200 lines)
binary_file_threshold = 1024, -- amount of bytes to scan for binary content (set 0 to disable)
imagemagick_info_format_str = '%m: %wx%h, %[colorspace], %q-bit',
line_numbers = false,
wrap_lines = false,
show_file_info = true,
filetypes = {
svg = { wrap_lines = true },
markdown = { wrap_lines = true },
text = { wrap_lines = true },
},
},
keymaps = {
close = '<Esc>',
select = '<CR>',
select_split = '<C-s>',
select_vsplit = '<C-v>',
select_tab = '<C-t>',
move_up = { '<Up>', '<C-p>' },
move_down = { '<Down>', '<C-n>' },
preview_scroll_up = '<C-u>',
preview_scroll_down = '<C-d>',
toggle_debug = '<F2>',
},
hl = {
border = 'FloatBorder',
normal = 'Normal',
cursor = 'CursorLine',
matched = 'IncSearch',
title = 'Title',
prompt = 'Question',
active_file = 'Visual',
frecency = 'Number',
debug = 'Comment',
},
frecency = {
enabled = true,
db_path = vim.fn.stdpath('cache') .. '/fff_nvim',
},
debug = {
enabled = false, -- Set to true to show scores in the UI
show_scores = false,
},
logging = {
enabled = true,
log_file = vim.fn.stdpath('log') .. '/fff.log',
log_level = 'info',
}
})
```

Expand Down
2 changes: 1 addition & 1 deletion doc/fff.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ all available options:
layout = {
prompt_position = 'top', -- Position of prompt ('top' or 'bottom')
preview_position = 'right', -- Position of preview ('right' or 'left')
preview_width = 0.4, -- Width of preview pane
preview_width = 0.5, -- Width of preview pane
height = 0.8, -- Window height
width = 0.8, -- Window width
},
Expand Down
11 changes: 7 additions & 4 deletions lua/fff/file_picker/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ function M.setup(config)
preview_down = '<C-d>',
},
layout = {
prompt_position = 'top',
prompt_position = 'bottom',
preview_position = 'right',
preview_width = 0.4,
preview_size = 0.4,
height = 0.8,
width = 0.8,
},
Expand Down Expand Up @@ -84,15 +84,18 @@ end
--- Search files with fuzzy matching using blink.cmp's advanced algorithm
--- @param query string Search query
--- @param max_results number Maximum number of results (optional)
--- @param max_threads number Maximum number of threads (optional)
--- @param current_file string|nil Path to current file to deprioritize (optional)
--- @param reverse_order boolean Reverse order of results
--- @return table List of matching files
function M.search_files(query, max_results, max_threads, current_file)
function M.search_files(query, max_results, max_threads, current_file, reverse_order)
if not M.state.initialized then return {} end

max_results = max_results or M.config.max_results
max_threads = max_threads or M.config.max_threads

local ok, search_result = pcall(fuzzy.fuzzy_search_files, query, max_results, max_threads, current_file)
local ok, search_result =
pcall(fuzzy.fuzzy_search_files, query, max_results, max_threads, current_file, reverse_order)
if not ok then
vim.notify('Failed to search files: ' .. tostring(search_result), vim.log.levels.ERROR)
return {}
Expand Down
6 changes: 5 additions & 1 deletion lua/fff/file_picker/preview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ function M.is_binary_file_async(file_path, callback)
end
end

-- Check file content asynchronously
if M.config.binary_file_threshold <= 0 then
callback(false)
return
end

vim.uv.fs_open(file_path, 'r', 438, function(err, fd)
if err or not fd then
callback(false)
Expand Down
Loading
Loading