Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
martinparadiso authored Dec 29, 2023
2 parents bef8dcc + 566b703 commit 804094b
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ use {
}
```

### [lazy.nvim](https://github.com/folke/lazy.nvim)

```lua
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' }
}
```

You'll also need to have a patched font if you want icons.

## Usage and customization
Expand Down Expand Up @@ -912,6 +921,7 @@ extensions = {'quickfix'}
- nerdtree
- nvim-dap-ui
- nvim-tree
- oil
- overseer
- quickfix
- symbols-outline
Expand Down
11 changes: 11 additions & 0 deletions doc/lualine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ PACKER.NVIM <HTTPS://GITHUB.COM/WBTHOMASON/PACKER.NVIM> ~
<


LAZY.NVIM <HTTPS://GITHUB.COM/FOLKE/LAZY.NVIM> ~

>
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' }
}
<


You’ll also need to have a patched font if you want icons.

USAGE AND CUSTOMIZATION *lualine-usage-and-customization*
Expand Down Expand Up @@ -966,6 +976,7 @@ extensions with:
- nerdtree
- nvim-dap-ui
- nvim-tree
- oil
- overseer
- quickfix
- symbols-outline
Expand Down
4 changes: 2 additions & 2 deletions lua/lualine/components/filename.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ M.update_status = function(self)
data = vim.fn.expand('%:t')
end

data = modules.utils.stl_escape(data)

if data == '' then
data = self.options.symbols.unnamed
end
Expand All @@ -99,6 +97,8 @@ M.update_status = function(self)
data = shorten_path(data, path_separator, estimated_space_available)
end

data = modules.utils.stl_escape(data)

local symbols = {}
if self.options.file_status then
if vim.bo.modified then
Expand Down
20 changes: 20 additions & 0 deletions lua/lualine/extensions/oil.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- Extension for oil.nvim

local M = {}

M.sections = {
lualine_a = {
function()
local ok, oil = pcall(require, 'oil')
if ok then
return vim.fn.fnamemodify(oil.get_current_dir(), ':~')
else
return ''
end
end,
},
}

M.filetypes = { 'oil' }

return M
6 changes: 3 additions & 3 deletions lua/lualine/themes/iceberg_dark.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
local colors = {
color2 = '#161821',
color3 = '#b4be82',
color4 = '#6b7089',
color4 = '#c6c8d1',
color5 = '#2e313f',
color8 = '#e2a478',
color9 = '#3e445e',
Expand All @@ -26,14 +26,14 @@ return {
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = { fg = colors.color9, bg = colors.color10 },
a = { fg = colors.color9, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color9, bg = colors.color10 },
c = { fg = colors.color9, bg = colors.color10 },
},
normal = {
c = { fg = colors.color9, bg = colors.color10 },
a = { fg = colors.color11, bg = colors.color12, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
c = { fg = colors.color4, bg = colors.color10 },
},
insert = {
a = { fg = colors.color2, bg = colors.color15, gui = 'bold' },
Expand Down
21 changes: 21 additions & 0 deletions tests/spec/component_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,27 @@ describe('Filename component', function()
vim.fn.winwidth:revert()
vim.fn.expand:revert()
end)

it('shortens path with %', function()
stub(vim.fn, 'expand')
vim.fn.expand.on_call_with('%:p').returns('%dir1/%dir2/%actual_%file')
stub(vim.fn, 'winwidth')
vim.fn.winwidth.on_call_with(0).returns(100)

local opts = build_component_opts {
component_separators = { left = '', right = '' },
padding = 0,
file_status = false,
path = 2,
shorting_target = 90,
}
vim.cmd(':e test-file.txt')
assert_component('filename', opts, '%%/%%/%%actual_%%file')

vim.cmd(':bdelete!')
vim.fn.winwidth:revert()
vim.fn.expand:revert()
end)
end)

describe('vim option & variable component', function()
Expand Down

0 comments on commit 804094b

Please sign in to comment.