Skip to content

Commit

Permalink
perf(plugin): update flash and lualine config
Browse files Browse the repository at this point in the history
  • Loading branch information
liubang committed Jun 21, 2024
1 parent 8b6de88 commit 027e4ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 49 deletions.
45 changes: 4 additions & 41 deletions lua/plugins/flash-nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,13 @@
return {
"folke/flash.nvim",
event = "VeryLazy",
opts = {
labels = "asdfghjklqwertyuiopzxcvbnm",
label = {
-- allow uppercase labels
uppercase = true,
-- add a label for the first match in the current window.
-- you can always jump to the first match with `<CR>`
current = true,
-- for the current window, label targets closer to the cursor first
distance = true,
},
modes = {
char = { enabled = false },
},
search = {
trigger = ";",
},
},
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
{
"<Leader>kk",
mode = { "n", "x", "o" },
function()
require("flash").jump({
search = { mode = "search", max_length = 0 },
label = { after = { 0, 0 } },
pattern = "^",
})
end,
},
{
"<Leader>jj",
mode = { "n", "x", "o" },
function()
require("flash").jump({
search = { mode = "search", max_length = 0 },
label = { after = { 0, 0 } },
pattern = "^",
})
end,
},
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
},
}
13 changes: 5 additions & 8 deletions lua/plugins/lualine-nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ return {
{
require("lb.utils.util").file_size_format,
cond = function()
local ft = vim.api.nvim_buf_get_option(0, "filetype")
local ft
vim.api.nvim_get_option_value("filetype", { scope = "local" })
if ft == "alpha" or ft == "NvimTree" or ft == "aerial" then
return false
end
Expand All @@ -74,20 +75,16 @@ return {
{
require("lb.utils.util").lsp_clients_format,
cond = function()
local ft = vim.api.nvim_buf_get_option(0, "filetype")
local ft = vim.api.nvim_get_option_value("filetype", { scope = "local" })
if ft == "alpha" or ft == "NvimTree" or ft == "aerial" then
return false
end
local get_clients = (
vim.lsp.get_clients ~= nil and vim.lsp.get_clients -- nvim 0.10+
or vim.lsp.get_active_clients
)
return next(get_clients({ bufnr = 0 })) ~= nil
return next(vim.lsp.get_clients({ bufnr = 0 })) ~= nil
end,
},
},
lualine_y = {
{ "filetype", icon_only = true, colored = true },
-- { "filetype", icon_only = true, colored = true },
{ "encoding" },
},
lualine_z = {
Expand Down

0 comments on commit 027e4ad

Please sign in to comment.