nvim-lualine / lualine.nvim Goto Github PK
View Code? Open in Web Editor NEWA blazing fast and easy to configure neovim statusline plugin written in pure lua.
License: MIT License
A blazing fast and easy to configure neovim statusline plugin written in pure lua.
License: MIT License
I use NVIM v0.5.0-dev+916-gee5ece084
Installed lualine with Plug.
I have the following lines in my init.vim
lua << EOF
local lualine = require('lualine')
lualine.status()
EOF
I don't get any errors on startup but I don't see the bar either.
If I move lualine directory away from ~/.vim/plugged/
then I get an error that lualine is not found.
snippet from my lualine config file:
local M = {}
local function diagnostics()
...
end
function M.config()
lualine.sections['lualine_diagnostics'] = { diagnostics }
lualine.status()
end
return M
but nothing changes in my status line. If I set a different sections to my diagnostics function, it works as expected. But nothing shows when I set the lualine_diagnostics
section.
I would change this to look cleaner.
if options.colored == nil then options.colored = true end
and work with options variables. Similar to all other option variables.
This has two benefits
if options.colored
refers to an option. if colored
can be a local variableOriginally posted by @hoob3rt in #61 (comment)
This needs to be done on the whole codebase
Hello. Have couple of questions about lualine
Can i put file_name to first a
sections instead of mode section? When i try to do it it brokes sections separation.
How can i enable full path to file?
Can lualine display progress section as currcnt_line/all_lines_number current_position_in_line
(e.g. 22/290 5
for cursor position in 22 line and 5 column)
the cursor blinks very quickly in insert mode
return function()
local lualine = require('lualine')
lualine.theme = 'gruvbox'
lualine.separator = '/'
lualine.sections = {
lualine_a = { 'mode' },
lualine_b = { 'filename' },
lualine_c = { },
lualine_x = { },
lualine_y = { 'branch' },
lualine_z = { 'filetype' },
lualine_diagnostics = { }
}
lualine.inactiveSections = {
lualine_a = { 'mode' },
lualine_b = { 'filename' },
lualine_c = { },
lualine_x = { },
lualine_y = { 'branch' },
lualine_z = { },
lualine_diagnostics = { }
}
lualine.extensions = { 'fzf' }
lualine.status()
end
Create diagnostic api to handle & view diagnostics in lualine from multiple sources. For example while using Ale for linting with eslint and tsserver with lsp, diagnostics from both of these should be displayed in one component in lualine.
As The title says. If you're on detached head state branch component is empty . I think it should show the commit id.
User should be able to configure lualine with vimscript through global vim variables eg
let g:lualine_theme = 'nord'
similarly this should be supported in lua
vim.g.lualine_theme = 'nord'
Currently not all modes are supported which produces lualine crashes.
*mode()*
mode([expr]) Return a string that indicates the current mode.
If [expr] is supplied and it evaluates to a non-zero Number or
a non-empty String (|non-zero-arg|), then the full mode is
returned, otherwise only the first letter is returned.
n Normal
no Operator-pending
nov Operator-pending (forced charwise |o_v|)
noV Operator-pending (forced linewise |o_V|)
noCTRL-V Operator-pending (forced blockwise |o_CTRL-V|)
CTRL-V is one character
niI Normal using |i_CTRL-O| in |Insert-mode|
niR Normal using |i_CTRL-O| in |Replace-mode|
niV Normal using |i_CTRL-O| in |Virtual-Replace-mode|
v Visual by character
V Visual by line
CTRL-V Visual blockwise
s Select by character
S Select by line
CTRL-S Select blockwise
i Insert
ic Insert mode completion |compl-generic|
ix Insert mode |i_CTRL-X| completion
R Replace |R|
Rc Replace mode completion |compl-generic|
Rv Virtual Replace |gR|
Rx Replace mode |i_CTRL-X| completion
c Command-line editing
cv Vim Ex mode |gQ|
ce Normal Ex mode |Q|
r Hit-enter prompt
rm The -- more -- prompt
r? |:confirm| query of some sort
! Shell or external command is executing
t Terminal mode: keys go to the job
This is useful in the 'statusline' option or when used
with |remote_expr()| In most other places it always returns
"c" or "n".
Note that in the future more modes and more specific modes may
be added. It's better not to compare the whole string but only
the leading character(s).
Also see |visualmode()|.
What do you think about using tabline?
Tabline and statusline use same formats right now you can do
vim.o.showtabline = 2
vim.o.tabline = vim.o.satusline
vim.o.statusline = ' '
And send statusline to top on vim . We could divide tabline into sections like statusline and allow users to put components to top of vim too. Say I could show stuff like mode and branch on top of vim insted of bottom ? We could probably also add a option to show traditional tabline too .
Oh I think the entire tabline should be optional . So users can use a different tabline plugin if they prefare it and not have two plugins fight over tabline😄
What do you think of the idea?
I personaly agree with
The lightline.vim plugin does not provide any plugin integration by default. This plugin considers orthogonality to be one of the important ideas, which means that the plugin does not rely on implementation of other plugins. Once a plugin starts to integrate with some famous plugins, it should be kept updated to follow the changes of the plugins, and should accept integration requests with new plugins and it will suffer from performance regression due to plugin availability checks.
from lightline.
Currently our only external dependecy is signify.
That's why I think it's a good time to disscuss it . Should we intrigrate directly with external plugins or should we give users flexible tools to use any plugin with lightline themselves?
nvim --version
:NVIM v0.5.0-dev+972-g84faeb07d
Build type: RelWithDebInfo
LuaJIT 2.0.5
kitty 0.19.3
(also occurs in xterm)Scrolling using vim-smoothie while lualine.nvim is enabled produces lag, especially towards the end of the scrolling motion. This does not occur while using vim-airline (though lualine.nvim is the first statusline plugin I've ever used, but I had to test with another one).
Current config
use {
'hoob3rt/lualine.nvim',
requires = {'kyazdani42/nvim-web-devicons', opt = true},
event = 'VimEnter *',
config = function()
require('lualine').setup{
options = {
theme = require('helpers').getLualineTheme(),
icons_enabled = true,
-- section_separators = nil, component_separators = nil
component_separators = {'', ''},
section_separators = {'', ''}
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch' },
lualine_c = { 'filename', 'diff', 'g:coc_status' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = { },
lualine_b = { 'branch' },
lualine_c = { 'filename' },
lualine_x = { },
lualine_y = { },
lualine_z = { 'location' }
},
extensions = { 'fzf' }
}
end
}
To disable separators, I tried using section_separators = nil, component_separators = nil
which doesn't work. So I am currently setting empty values for them which works.
As mentioned here, having the ability to use lightline
's colorschemes would be a nice feature to have.
A quick way to get diagnostics would be to check whether lsp-status is plugged, and then use a plain vanilla lsp_status.status()
. This should just be minimal work, and will make lualine quite more functional.
the OS icon doesn't work, I think file format isn't the best option to get the OS. I don't know the best, I only know using has vim function. I've tried and it looks good.
I'd like to know what do you think @hoob3rt
PS. Mac/OSX needs to be first because it also return 1 to has('unix')
PS. I have a change here I didn't create the PR because first I'd like to know about you
Changing the colorscheme at runtime using :colorscheme <scheme>
also alters lualine's own colors, even though it's set to gruvbox
in the config.
This does not occur, for example, with vim-airline
when g:airline_theme
is set in the config.
Filetype component is stuck with the icon of the first file opened during the session.
As far as I can understand it is due to "caching" of the result of icon query:
if ok and not options.icon then
local f_name,f_extension = vim.fn.expand('%:t'),vim.fn.expand('%:e')
options.icon = devicons.get_icon(f_name,f_extension)
else
ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol")
if ok ~= 0 and not options.icon then
options.icon = vim.fn.WebDevIconsGetFileTypeSymbol()
end
end
I guess that such a caching was introduced to improve the performance. I think that correct implementation should save the filetype and the icon and update the icon when new filetype is different from the saved one. I can make a pull request if needed.
I have this config:
local lualine = require('lualine')
lualine.sections = {
lualine_a = { 'mode' },
lualine_b = { 'filename' },
lualine_x = { 'filetype' }
}
lualine.inactive_sections = {
lualine_a = { },
lualine_b = { 'filename' },
lualine_x = { 'filetype' }
}
lualine.status()
I want lualine to show in the inactive buffer filetype and not progress.
With the above config shows filetype from active buffer.
If active buffer it's lua filetype and inactive buffer it's vim,
lualine in inactive buffer(which is vim filetype) shows lua filetype from active buffer.
vim-lightline shows this correctly.
Thank's for this beautiful plugin.
lualine
's highlight should fall back to lualine_normal
but it is currently not supported.
Originally posted by @hoob3rt in #8 (comment)
introduced in 3fecc95
The 'DiffAdd' group is for background highlighting it doesn't have a proper foreground property.
doing hi DiffAdd
shpw only ctermbg and guibg properties . The default 'Diffchanged' & 'Diffdelete' are also background highlighter.
Funfact my colorscheme overrites them and makes the bg gray with foreground highlights . Colorchemes can make those colors look realy weird that's why I didn't want to extract colors from highlights :/
Statusline in chadtree window should display chadtree's directory.
Since component separators were added we should update the screenshots in README.md as that's the landing page . THEMES.md can be updated too though that will be good amount of work . @hoob3rt didn't you say you had a script for screenshots?
May be update the screenshot when diagnostics is added :) . What do you think?
The genarated cterm values are pretty good . Most of the themes donn't have cterm values in them. Those cterm values create unnecessary complexicity in themes . Also since rest of the codebase relies on genarated cterm colors (like section separators) They can look weird if themes provide cterm values thata re different . So I think we should remove cterm values from themes and relay solely on genarted cterm values .
setting signify compoent as the first component in section causes the padding to be in previous section's color. For some reason it only happens on on the left padding, not on the right.
@shadmansaleh maybe you have an idea on why this happens
This also affects the diagnostics component which is not yet merged.
Should be checked if applying any color to any component also replicates this.
Minimal config
lualine.sections.lualine_b = {'signify'}
Wanted to port over the onedark color scheme used in airline. Attached is PR with change with reference to onedark's airline code (note I could not find the colors for 'command' mode). Let me know if there are any questions or issues!
PR: #8
Statusline in fugitive window should display working git branch?
check nvim-lua/wishlist#3
Suppose I open a buffer and the file is at a git folder. The branch is displayed, which is good.
Now, I switch to another buffer with a file at another folder that is not (and neither its parents are) git-controlled. The git branch from the previous buffer will persist on the status line for the new buffer. Even if I close the previous buffer, the git branch persists.
Not sure what the issue is; maybe something about async?
I have this as my lualine sections
lualine.sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch' },
lualine_c = { 'filename', 'diff', 'g:coc_status' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
}
coc_status gets color of the diff.
There should be a better way of making lualine use different function calls for each window. This hack is ugly and will probably prove to be hard to maintain.
Minimal init.lua:
lualine = require('lualine')
vim.cmd [[packadd packer.nvim]]
local plugins = require('packer').startup(function()
use {'wbthomason/packer.nvim', opt = true}
use {
'hoob3rt/lualine.nvim',
requires = 'kyazdani42/nvim-web-devicons',
}
end)
lualine.status()
Steps to reproduce:
nvim -u minimal-init.lua
(from home directory):pwd
:tabnew
:tcd ~/.config/nvim
:pwd
gt
:pwd
Expected result:
Prints "/home/user" first time :pwd
is called, "/home/user/.config/nvim" the second time, and "/home/user" the third time.
Actual result:
Prints "/home/user" first time, "/home/user/.config/nvim" second and third times.
The :tcd
neovim command changes the cwd for only the current tab. But with this plugin installed, it changes it for all tabs.
Statusline in nvim-tree window should display nvim-tree's directory.
In other status bars such as airline or lightline, there are options to implement powerline-like aesthetics like this using < and > keys. I would love to see this added, shouldn't be too difficult
Everything connected with lualine's customization should be available by :h lualine
in neovim
Instead of the boring unix
, dos
and mac
for fileformat, one may use devicons (since they are also used for file types). More precisely, from https://www.nerdfonts.com/cheat-sheet
, check out nf-dev-linux
, nf-dev-windows
and nf-dev-apple
. Just eye-candy, but, hey, why not? (I do not think both icon and text should be provided. Icons if the possibility is there, text for fallback.)
Nice catch, this is also an issue with the signify
component but I think these are two different bugs, I will try to fix this tomorrow.
Originally posted by @hoob3rt in #37 (comment)
Would be nice to have a separator for left and right like lightline has.
Example:
lualine.separator = { left = '', right = '' }
I think mirroring theme on left(A,B,C) and right(X,Y,Z) is limiting.
I kind of like the left and right structure in lightline.
can we have something like that in lualine ?
I personally can't see how lualine's theme structure is limiting compared to lightline
. Could you elaborate on what exactly are you missing?
Originally posted by @shadmansaleh in #23 (comment)
:lua require('lualine').theme = 'nord'
used to work, this is not the case anymore
Right now, if lualine does not detect devicons it offers only text. As a fallback, one could check whether powerline font "icons" are available (cascadia code, IBM plex, ...). Then, for example, a git branch icon can be \ue0a0
. Not everyone want to have patched fonts installed.
as mentioned in #16 (comment) there should be additional settings for lualine's components. Something like
Let me know if you wish to have anything else supported.
Statusline in nerdtree window should display nerdtree's directory.
It is the beginnings of the project, but somehow there is no movement for 10 days in terms of any updates. The PRs are more than the issue tickets. Is everything OK? I am not pressuring, I just want to make sure this did not become abandoned, as I really like this status line.
With nvim-web-devicons the icon appear without no.
I think it's from here: https://github.com/hoob3rt/lualine.nvim/blob/a2a9193296414aea13efa3a02fafb115f0226276/lua/lualine/components/branch.lua#L74
I'm don't know lua but if I switch ~= with == it works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.