nvim-pack/nvim-spectre

Add current_file option.

Weissle opened this issue · 1 comments

-- around lua/spectre/init.lua line 80
-- add current_file option.
opts = vim.tbl_extend('force', {
        cwd = nil,
        is_insert_mode = state.user_config.is_insert_mode,
        search_text = '',
        replace_text = '',
        path = '',
        current_file = false,     
        is_close = false, -- close an exists instance of spectre then open new
        is_file = false
    }, opts or {}) or {}
-- copy from open_file_search.
if path == '' and current_file == true then
    local path = vim.fn.fnameescape(vim.fn.expand('%:p:.'))
    if vim.loop.os_uname().sysname == 'Windows_NT' then
        path = vim.fn.substitute(path, '\\', '/', 'g')
    end
    opts.path = path
end

Do you think this change provides better scalability?

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.