Giter Site home page Giter Site logo

nvim-lualine / lualine.nvim Goto Github PK

View Code? Open in Web Editor NEW
5.7K 19.0 454.0 1.35 MB

A blazing fast and easy to configure neovim statusline plugin written in pure lua.

License: MIT License

Lua 98.38% Makefile 0.25% Shell 1.37%
neovim statusline neovim-statusline nvim lua neovim-plugin neovim-lua lualine

lualine.nvim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lualine.nvim's Issues

Doesn't work and no errors

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.

lualine_diagnostics section?

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.

refactor all components with options

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

  • while looking at the code you instantly know that if options.colored refers to an option. if colored can be a local variable
  • no additional memory usage

Originally posted by @hoob3rt in #61 (comment)

This needs to be done on the whole codebase

Usage questions

Hello. Have couple of questions about lualine

  1. Can i put file_name to first a sections instead of mode section? When i try to do it it brokes sections separation.
    image

  2. How can i enable full path to file?

  3. 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)

cursor blinks very quickly

the cursor blinks very quickly in insert mode

Screen.Recording.2021-01-02.at.07.39.28.mov
my config
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

diagnostic api

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.

expose configuration through vimscript

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'

Add support for all vim modes

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()|.

Tabline

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?

What's our approach on external plugin intigration?

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?

Scrolling using vim-smoothie lags when lualine.nvim is enabled

  • nvim --version:
NVIM v0.5.0-dev+972-g84faeb07d
Build type: RelWithDebInfo
LuaJIT 2.0.5
  • latest versions of both plugins
  • terminal: 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).

Disabling section/component separator does not work.

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.

OS icon show linux even OSX

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
Screenshot 2021-02-26 at 23 32 08

Bug: filetype component doesn't update the icon

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.

In inactive buffer lualine show filetype from active buffer

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.

Bug: Signify added displayed in black

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 :/

Update screenshots in README.md

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?

Discuss: Remove cterm colors from themes

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 .

signify causes bad section highlights

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'}

pic-window-210221-1739-14

Porting onedark colorscheme

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

Git branch persists even after buffer change

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?

Diff Colors do not reset

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' },
      }

This is how it renders
image

coc_status gets color of the diff.

Breaks neovim's :tcd command (tab-local cwds)

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:

  1. nvim -u minimal-init.lua (from home directory)
  2. :pwd
  3. :tabnew
  4. :tcd ~/.config/nvim
  5. :pwd
  6. gt
  7. :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.

create doc file

Everything connected with lualine's customization should be available by :h lualine in neovim

`<CTRL_C>` breaks lualine

This is not happening every time I hit CTRL_C but sometimes.

CTRL-C breaks lualine

The error is

E5108: Error executing lua Keyboard interrupt

[suggestion] use icons for fileformat

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.)

Change theme structure

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)

fall back to powerline font icons?

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.

additional setting for components

as mentioned in #16 (comment) there should be additional settings for lualine's components. Something like

  • icon
  • padding
  • uppercase/lowercase

Let me know if you wish to have anything else supported.

Development paused/stopped?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.