Skip to content

Commit

Permalink
fixup: escape results of vim_var components
Browse files Browse the repository at this point in the history
  • Loading branch information
shadmansaleh committed Jul 28, 2022
1 parent c6d7485 commit 7888057
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/lualine/components/special/vim_var_component.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local require = require('lualine_require').require
local M = require('lualine.component'):extend()
local utils = require('lualine.utils.utils')

function M:update_status()
local component = self.options[1]
Expand Down Expand Up @@ -29,7 +31,7 @@ function M:update_status()
end
local ok
ok, return_val = pcall(tostring, return_val)
return ok and return_val or ''
return ok and utils.stl_escape(return_val) or ''
end

return M

3 comments on commit 7888057

@figsoda
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shadmansaleh
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use a function component instead with something like this

lualine_b = {function() return vim.b.gitsigns_status end}

Or use the diff component with gitsigns as source
https://github.com/nvim-lualine/lualine.nvim/wiki/Component-snippets#using-external-source-for-diff

@figsoda
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! it worked

Please sign in to comment.