initial commit
This commit is contained in:
commit
23d4795228
99 changed files with 6691 additions and 0 deletions
32
config/nvim/lua/config/fzf_reload.lua
Normal file
32
config/nvim/lua/config/fzf_reload.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
local M = {}
|
||||
M.opts = nil
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.deepcopy(opts)
|
||||
-- allow connections from `theme` script
|
||||
local socket_path = ('/tmp/nvim-%d.sock'):format(vim.fn.getpid())
|
||||
vim.fn.serverstart(socket_path)
|
||||
end
|
||||
|
||||
---@disable_fzf_lua_reload boolean?
|
||||
function M.reload(disable_fzf_lua_reload)
|
||||
local lines = vim.fn.readfile(vim.fn.expand('~/.config/fzf/themes/theme'))
|
||||
if not lines or #lines == 0 then
|
||||
return
|
||||
end
|
||||
local colors = {}
|
||||
for color_spec in table.concat(lines, '\n'):gmatch('--color=([^%s]+)') do
|
||||
for k, v in color_spec:gmatch('([^:,]+):([^,]+)') do
|
||||
colors[k] = v
|
||||
end
|
||||
end
|
||||
if not M.opts then
|
||||
return
|
||||
end
|
||||
M.opts.fzf_colors = colors
|
||||
if not disable_fzf_lua_reload then
|
||||
require('fzf-lua').setup(M.opts)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue