Skip to content

Instantly share code, notes, and snippets.

@Emille1723
Forked from s1n7ax/init.lua
Created March 19, 2024 06:27
Show Gist options
  • Save Emille1723/0bf2d58142095432d6f3b490b8e7c46b to your computer and use it in GitHub Desktop.
Save Emille1723/0bf2d58142095432d6f3b490b8e7c46b to your computer and use it in GitHub Desktop.
Show file path in the winbar
vim.o.winbar = "%{%v:lua.require'nvim.utils.nvim.winbar'.eval()%}"
local M = {}
vim.api.nvim_set_hl(0, 'WinBarPath', { bg = '#dedede', fg = '#363636' })
vim.api.nvim_set_hl(0, 'WinBarModified', { bg = '#dedede', fg = '#ff3838' })
function M.eval()
local file_path = vim.api.nvim_eval_statusline('%f', {}).str
local modified = vim.api.nvim_eval_statusline('%M', {}).str == '+' and '⊚' or ''
file_path = file_path:gsub('/', ' ➤ ')
return '%#WinBarPath#'
.. file_path
.. '%*'
.. '%#WinBarModified#'
.. modified
.. '%*'
end
return M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment