2022-10-19 02:19:50 +00:00
|
|
|
--[[
|
|
|
|
lualine extension for fzf filetypes:
|
|
|
|
works with both https://github.com/junegunn/fzf.vim and https://github.com/ibhagwan/fzf-lua
|
|
|
|
|
|
|
|
-- fzf-lua must be set-up in split mode
|
|
|
|
]]
|
|
|
|
|
|
|
|
local fzf_lua, _ = pcall(require, 'fzf-lua')
|
|
|
|
|
|
|
|
local function fzf_picker()
|
|
|
|
if not fzf_lua then
|
|
|
|
return ''
|
|
|
|
end
|
|
|
|
|
|
|
|
local info_string = vim.inspect(require('fzf-lua').get_info()['fnc'])
|
|
|
|
return info_string:gsub('"', '')
|
|
|
|
end
|
|
|
|
|
|
|
|
local function fzf_element()
|
|
|
|
if not fzf_lua then
|
|
|
|
return ''
|
|
|
|
end
|
|
|
|
|
|
|
|
local info_string = vim.inspect(require('fzf-lua').get_info()['selected'])
|
|
|
|
local lines = {}
|
|
|
|
for w in info_string:gsub('"', ''):gmatch('%S+') do
|
|
|
|
table.insert(lines, w)
|
|
|
|
end
|
|
|
|
return lines[1]
|
|
|
|
end
|
|
|
|
|
2021-09-03 18:28:20 +00:00
|
|
|
local function fzf_statusline()
|
|
|
|
return 'FZF'
|
|
|
|
end
|
2020-12-30 14:48:51 +00:00
|
|
|
|
2021-03-12 23:52:28 +00:00
|
|
|
local M = {}
|
|
|
|
|
2021-08-26 19:01:42 +00:00
|
|
|
M.sections = {
|
2021-09-03 18:28:20 +00:00
|
|
|
lualine_a = { fzf_statusline },
|
2022-10-19 02:19:50 +00:00
|
|
|
lualine_y = { fzf_element },
|
|
|
|
lualine_z = { fzf_picker },
|
2021-08-26 19:01:42 +00:00
|
|
|
}
|
2020-12-30 14:48:51 +00:00
|
|
|
|
2021-09-03 18:28:20 +00:00
|
|
|
M.filetypes = { 'fzf' }
|
2021-03-12 23:52:28 +00:00
|
|
|
|
|
|
|
return M
|