Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
shadmansaleh authored Nov 1, 2024
2 parents ab2d5fd + b431d22 commit 82540f9
Show file tree
Hide file tree
Showing 32 changed files with 504 additions and 246 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: nvim-0.5
runner: ubuntu-20.04
os: linux
nvim_version: v0.5.0
- flavor: nvim-0.6
runner: ubuntu-20.04
os: linux
nvim_version: v0.6.0
- flavor: nvim-0.7
runner: ubuntu-20.04
os: linux
Expand All @@ -35,6 +27,10 @@ jobs:
runner: ubuntu-20.04
os: linux
nvim_version: v0.8.0
- flavor: nvim-0.9
runner: ubuntu-20.04
os: linux
nvim_version: v0.9.0
- flavor: nvim-nightly
runner: ubuntu-20.04
os: linux
Expand All @@ -47,7 +43,7 @@ jobs:
run: |
mkdir -p ./tmp_home/nvim/pack/vendor/start
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ./tmp_home/nvim/pack/vendor/start/plenary.nvim
git clone --depth 1 https://github.com/kyazdani42/nvim-web-devicons ./tmp_home/nvim/pack/vendor/start/nvim-web-devicons
git clone --depth 1 https://github.com/nvim-tree/nvim-web-devicons ./tmp_home/nvim/pack/vendor/start/nvim-web-devicons
ln -s $(pwd) ./tmp_home/nvim/pack/vendor/start
- name: Setup neovim ${{matrix.nvim_version}}
uses: rhysd/action-setup-vim@v1
Expand Down
48 changes: 44 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

A blazing fast and easy to configure Neovim statusline written in Lua.

`lualine.nvim` requires Neovim >= 0.5.
`lualine.nvim` requires Neovim >= 0.7.

For previous versions of neovim please use compatability tags for example
compat-nvim-0.5

## Contributing

Expand Down Expand Up @@ -85,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 @@ -587,9 +599,9 @@ sections = {
colored = true, -- Displays a colored diff status if set to true
diff_color = {
-- Same color values as the general color option can be used here.
added = 'DiffAdd', -- Changes the diff's added color
modified = 'DiffChange', -- Changes the diff's modified color
removed = 'DiffDelete', -- Changes the diff's removed color you
added = 'LuaLineDiffAdd', -- Changes the diff's added color
modified = 'LuaLineDiffChange', -- Changes the diff's modified color
removed = 'LuaLineDiffDelete', -- Changes the diff's removed color you
},
symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the symbols used by the diff.
source = nil, -- A function that works as a data source for diff.
Expand Down Expand Up @@ -663,6 +675,20 @@ sections = {
}
```

#### encoding component options

```lua
sections = {
lualine_a = {
{
'encoding',
-- Show '[BOM]' when the file has a byte-order mark
show_bomb = false,
}
}
}
```

#### searchcount component options

```lua
Expand All @@ -684,6 +710,7 @@ sections = {
lualine_a = {
{
'tabs',
tab_max_length = 40, -- Maximum width of each tab. The content will be shorten dynamically (example: apple/orange -> a/orange)
max_length = vim.o.columns / 3, -- Maximum width of tabs component.
-- Note:
-- It can also be a function that returns
Expand All @@ -692,6 +719,11 @@ sections = {
-- 1: Shows tab_name
-- 2: Shows tab_nr + tab_name

path = 0, -- 0: just shows the filename
-- 1: shows the relative path and shorten $HOME to ~
-- 2: shows the full path
-- 3: shows the full path and shorten $HOME to ~

-- Automatically updates active tab color to match color of other components (will be overidden if buffers_color is set)
use_mode_colors = false,

Expand All @@ -701,6 +733,11 @@ sections = {
inactive = 'lualine_{section}_inactive', -- Color for inactive tab.
},

show_modified_status = true, -- Shows a symbol next to the tab name if the file has been modified.
symbols = {
modified = '[+]', -- Text to show when the file is modified.
},

fmt = function(name, context)
-- Show + if buffer is modified in tab
local buflist = vim.fn.tabpagebuflist(context.tabnr)
Expand Down Expand Up @@ -891,16 +928,19 @@ extensions = {'quickfix'}

- aerial
- chadtree
- ctrlspace
- fern
- fugitive
- fzf
- lazy
- man
- mason
- mundo
- neo-tree
- nerdtree
- nvim-dap-ui
- nvim-tree
- oil
- overseer
- quickfix
- symbols-outline
Expand Down
2 changes: 1 addition & 1 deletion THEMES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ But if `g:ayuprefermirage` exists, it will load ayu_mirage instead when

### base16

This theme will automatically use colors defined by your colorscheme using [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin.
This theme will automatically use colors defined by your colorscheme using [tinted-theming/base16-vim](https://github.com/tinted-theming/base16-vim) or [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin.
The following example is using the `tomorrow-night` colorscheme:

<p>
Expand Down
50 changes: 46 additions & 4 deletions doc/lualine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Table of Contents *lualine-table-of-contents*

A blazing fast and easy to configure Neovim statusline written in Lua.

`lualine.nvim` requires Neovim >= 0.5.
`lualine.nvim` requires Neovim >= 0.7.

For previous versions of neovim please use compatability tags for example
compat-nvim-0.5

CONTRIBUTING *lualine-contributing*

Expand Down Expand Up @@ -67,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 @@ -606,9 +619,9 @@ Component specific options These are options that are available on
colored = true, -- Displays a colored diff status if set to true
diff_color = {
-- Same color values as the general color option can be used here.
added = 'DiffAdd', -- Changes the diff's added color
modified = 'DiffChange', -- Changes the diff's modified color
removed = 'DiffDelete', -- Changes the diff's removed color you
added = 'LuaLineDiffAdd', -- Changes the diff's added color
modified = 'LuaLineDiffChange', -- Changes the diff's modified color
removed = 'LuaLineDiffDelete', -- Changes the diff's removed color you
},
symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the symbols used by the diff.
source = nil, -- A function that works as a data source for diff.
Expand Down Expand Up @@ -686,6 +699,21 @@ Component specific options These are options that are available on
<


*lualine-encoding-component-options*

>
sections = {
lualine_a = {
{
'encoding',
-- Show '[BOM]' when the file has a byte-order mark
show_bomb = false,
}
}
}
<


*lualine-searchcount-component-options*

>
Expand All @@ -708,6 +736,7 @@ Component specific options These are options that are available on
lualine_a = {
{
'tabs',
tab_max_length = 40, -- Maximum width of each tab. The content will be shorten dynamically (example: apple/orange -> a/orange)
max_length = vim.o.columns / 3, -- Maximum width of tabs component.
-- Note:
-- It can also be a function that returns
Expand All @@ -716,6 +745,11 @@ Component specific options These are options that are available on
-- 1: Shows tab_name
-- 2: Shows tab_nr + tab_name
path = 0, -- 0: just shows the filename
-- 1: shows the relative path and shorten $HOME to ~
-- 2: shows the full path
-- 3: shows the full path and shorten $HOME to ~
-- Automatically updates active tab color to match color of other components (will be overidden if buffers_color is set)
use_mode_colors = false,
Expand All @@ -725,6 +759,11 @@ Component specific options These are options that are available on
inactive = 'lualine_{section}_inactive', -- Color for inactive tab.
},
show_modified_status = true, -- Shows a symbol next to the tab name if the file has been modified.
symbols = {
modified = '[+]', -- Text to show when the file is modified.
},
fmt = function(name, context)
-- Show + if buffer is modified in tab
local buflist = vim.fn.tabpagebuflist(context.tabnr)
Expand Down Expand Up @@ -940,16 +979,19 @@ extensions with:

- aerial
- chadtree
- ctrlspace
- fern
- fugitive
- fzf
- lazy
- man
- mason
- mundo
- neo-tree
- nerdtree
- nvim-dap-ui
- nvim-tree
- oil
- overseer
- quickfix
- symbols-outline
Expand Down
14 changes: 7 additions & 7 deletions examples/bubbles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local bubbles_theme = {
normal = {
a = { fg = colors.black, bg = colors.violet },
b = { fg = colors.white, bg = colors.grey },
c = { fg = colors.black, bg = colors.black },
c = { fg = colors.white },
},

insert = { a = { fg = colors.black, bg = colors.blue } },
Expand All @@ -27,22 +27,22 @@ local bubbles_theme = {
inactive = {
a = { fg = colors.white, bg = colors.black },
b = { fg = colors.white, bg = colors.black },
c = { fg = colors.black, bg = colors.black },
c = { fg = colors.white },
},
}

require('lualine').setup {
options = {
theme = bubbles_theme,
component_separators = '|',
component_separators = '',
section_separators = { left = '', right = '' },
},
sections = {
lualine_a = {
{ 'mode', separator = { left = '' }, right_padding = 2 },
},
lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } },
lualine_b = { 'filename', 'branch' },
lualine_c = { 'fileformat' },
lualine_c = {
'%=', --[[ add your center compoentnts here in place of this comment ]]
},
lualine_x = {},
lualine_y = { 'filetype', 'progress' },
lualine_z = {
Expand Down
8 changes: 4 additions & 4 deletions examples/evil_lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ ins_left {
sources = { 'nvim_diagnostic' },
symbols = { error = '', warn = '', info = '' },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
error = { fg = colors.red },
warn = { fg = colors.yellow },
info = { fg = colors.cyan },
},
}

Expand Down Expand Up @@ -200,7 +200,7 @@ ins_right {
ins_right {
'diff',
-- Is it me or the symbol for modified us really weird
symbols = { added = '', modified = ' ', removed = '' },
symbols = { added = '', modified = '󰝤 ', removed = '' },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
Expand Down
38 changes: 26 additions & 12 deletions lua/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ local refresh_real_curwin

-- The events on which lualine redraws itself
local default_refresh_events =
'WinEnter,BufEnter,SessionLoadPost,FileChangedShellPost,VimResized,Filetype,CursorMoved,CursorMovedI'
if vim.fn.has('nvim-0.7') == 1 then -- utilize ModeChanged event introduced in 0.7
default_refresh_events = default_refresh_events .. ',ModeChanged'
end
'WinEnter,BufEnter,BufWritePost,SessionLoadPost,FileChangedShellPost,VimResized,Filetype,CursorMoved,CursorMovedI,ModeChanged'
-- Helper for apply_transitional_separators()
--- finds first applied highlight group after str_checked in status
---@param status string : unprocessed statusline string
Expand Down Expand Up @@ -602,6 +599,21 @@ local function hide(opts)
end
end

--- Check neovim compatibilitu
local function verify_nvim_version()
if vim.fn.has('nvim-0.7') == 1 then
return true
end
modules.utils_notices.add_notice([[
### Incompatible Neovim version
Lualine supports neovim 0.7 and up. It seems you're using a older version.
Please update to newer version. Or if you have atleast neovim 0.5 you
can use older compatible versions of lualine using compat tags like
`compat-nvim-0.5`, `compat-nvim-0.6`.
]])
return false
end

-- lualine.setup function
--- sets new user config
--- This function doesn't load components/theme etc... They are done before
Expand All @@ -616,14 +628,16 @@ local function setup(user_config)
-- When notices module is not loaded there are no notices to clear.
modules.utils_notices.clear_notices()
end
config = modules.config_module.apply_configuration(user_config)
vim.cmd([[augroup lualine | exe "autocmd!" | augroup END]])
setup_theme()
-- load components & extensions
modules.loader.load_all(config)
set_statusline()
set_tabline()
set_winbar()
if verify_nvim_version() then
config = modules.config_module.apply_configuration(user_config)
vim.cmd([[augroup lualine | exe "autocmd!" | augroup END]])
setup_theme()
-- load components & extensions
modules.loader.load_all(config)
set_statusline()
set_tabline()
set_winbar()
end
if package.loaded['lualine.utils.notices'] then
modules.utils_notices.notice_message_startup()
end
Expand Down
Loading

0 comments on commit 82540f9

Please sign in to comment.