Git Product home page Git Product logo

statusline.lua's Introduction

GitHub stars Requires GitHub contributors GitHub issues GitHub issues-closed PRs Welcome

Statusline.lua

screenshot

Statusline

screencast

Tabline [BONUS]

screenshot

Light Theme Compatible

screenshot

A tidy statusline for neovim written in lua featuring

๐Ÿ”‹ Batteries Included. No configuration needed.

๐Ÿ•ด Minimalist Mode Indicators

๐Ÿ”ฅ 0.4ms Startup Time

๐Ÿ‘ Git Status [Signify]

๐ŸŒด Git Branch

โ—๏ธ Diagnostics Status [Ale & Native Nvim LSP] --> Native LSP set as default

๐Ÿ”ฆ LSP Current Function [builtinlsp.current_function] --> Requires require('lsp-status').on_attach(client)

๐Ÿ’ก LSP Code Action Indicator [textDocument/codeAction] --> Requires kosayoda/nvim-lightbulb/

๐Ÿ’ฏ LSP Progress Messages โ ผ [vim.lsp.util.get_progress_messages]

โ“ File Modified Status

๐Ÿ‘Œ Clean Ruler

โš™๏ธ File Icon Support [Nerd Font]

๐Ÿ™Œ Snipped File Paths

๐Ÿ˜ป Tabline Support

๐ŸŽจ Smooth colours inspired by gruvbox

๐Ÿš€ More to come!

Installation

Plug 'beauwilliams/statusline.lua'
use 'beauwilliams/statusline.lua'

Configuration

Disable Tabline

local statusline = require('statusline')
statusline.tabline = false

Enable ALE Diagnostics Display

-- NOTE: Nvim Native LSP is displayed default
-- I personally prefer ALE, with nathunsmitty/nvim-ale-diagnostic piping LSP diags
-- With ALE you can get errors displayed without explicitly needing an LSP server
local statusline = require('statusline')
statusline.lsp_diagnostics = false
statusline.ale_diagnostics = true

Enable Global Statusline (version 0.7+)

-- This setting will mean that you have one single statusline drawn accross the entire display
lua vim.o.laststatus=3

Optional Dependencies

- Signify [Git Status]
- Ale [Diagnostics] --> I recommend ALE with nathunsmitty/nvim-ale-diagnostic
- Native LSP [Current Function] --> require('lsp-status').on_attach(client)
- Native LSP [Diagnostics] --> Must have a relevant language server to provide diagnostics
- Native LSP [Progress %] --> Must have a relevant language server to provide progress messages
- Native LSP [Code Actions] --> Requires kosayoda/nvim-lightbulb/

Planned Improvements ๐Ÿ˜ผ

  • Completely move codebase to lua
  • Async everything
  • Shed Fugitive
  • Shed Nvim-Webdev-Icons
  • Support Native LSP
  • Theme Support

Developers Only

Contributing

Please before submitting a PR install stylua here

And run stylua . from your shell in the root folder of focus.nvim

This will format the code according to the guidlines set in stylua.toml

Credits

lualine galaxyline neoline

statusline.lua's People

Contributors

beauwilliams avatar

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

statusline.lua's Issues

Tabs are not activated by mouse click

When opening multiple tabs you cannot select active tab with mouse click. Somehow the plugin disables the default neovim behavior. Instead of mouse navigation you have to navigate by e.g. gt.

Support for LSP diagnostics

When using LSP, beeing notified in the status-line that there are errors and/or warnings is very useful, compared to skimming the whole document manually. A red/organge indicator with the number of errors/warnings to the right hand side of the statusline would be great!

https://github.com/nvim-lua/lsp-status.nvim has support for this, but I like this plugin better as lsp-status is more like a status-line API, and I don't need, or want to configure, that level of flexibility.

Tabline help

Screen.Recording.2021-04-23.at.10.17.39.PM.mov

New tabs do now show on the tab line properly. Do I need additional config for this?

vim.lsp.diagnostic.get_count is deprecated. See :h deprecated

Hi, I'm currenty using this plugin in Nvim 0.6.1. I can use the plugin with normallity, but I get a warning everytime I use Nvim that says
vim.lsp.diagnostic.get_count is deprecated. See :h deprecated, which is annoying and also, as it says, this function is going to be eliminated in future updates.

Screenshot_2022-01-11_22:23:12

I've found that this is used in the file {PLUGIN_DIRECTORY}/statusline.lua/lua/sections/_lsp.lua at line 16. I'd tried to fix it myself but I didn't have enough knowledge to do it lol.

I'm reporting this issue anyways.

Statusline breaks vim.lsp.buf.hover

for some reason when we use this plugin vim.lsp.buf.hover stops working correctly, we have to press twice our key associated with the function to see the floating window, i think this is related to neovim/neovim#16625
here is the minimal reproducible example:

-- minimal.lua
local on_windows = vim.loop.os_uname().version:match 'Windows'

local function join_paths(...)
  local path_sep = on_windows and '\\' or '/'
  local result = table.concat({ ... }, path_sep)
  return result
end

vim.cmd [[set runtimepath=$VIMRUNTIME]]

local temp_dir = vim.loop.os_getenv 'TEMP' or '/tmp'

vim.cmd('set packpath=' .. join_paths(temp_dir, 'nvim', 'site'))

local package_root = join_paths(temp_dir, 'nvim', 'site', 'pack')
local lspconfig_path = join_paths(package_root, 'test', 'start', 'nvim-lspconfig')
local statusline_path = join_paths(package_root, 'test', 'start', 'statusline')

if vim.fn.isdirectory(lspconfig_path) ~= 1 then
  vim.fn.system { 'git', 'clone', 'https://github.com/neovim/nvim-lspconfig', lspconfig_path }
  vim.fn.system { 'git', 'clone', 'https://github.com/beauwilliams/statusline.lua', statusline_path }
end

require('statusline')

vim.lsp.set_log_level 'trace'
require('vim.lsp.log').set_format_func(vim.inspect)
local nvim_lsp = require 'lspconfig'
local on_attach = function(_, bufnr)
  local function buf_set_option(...)
    vim.api.nvim_buf_set_option(bufnr, ...)
  end

  buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')

  -- Mappings.
  local opts = { buffer = bufnr, noremap = true, silent = true }
  vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
  vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
  vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
  vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
  vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
  vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
  vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
  vim.keymap.set('n', '<space>wl', function()
    print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
  end, opts)
  vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
  vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
  vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
  vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
  vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
  vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
  vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
end

-- Add the server that troubles you here
local name = 'pyright'
local cmd = { 'pyright-langserver', '--stdio' } -- needed for elixirls, omnisharp, sumneko_lua
if not name then
  print 'You have not defined a server name, please edit minimal_init.lua'
end
if not nvim_lsp[name].document_config.default_config.cmd and not cmd then
  print [[You have not defined a server default cmd for a server
    that requires it please edit minimal_init.lua]]
end

nvim_lsp[name].setup {
  cmd = cmd,
  on_attach = on_attach,
}

print [[You can find your log at $HOME/.cache/nvim/lsp.log. Please paste in a github issue under a details tag as described in the issue template.]]

if it throws an error started statusline you just have to delete /tmp/nvim
how to reproduce:
touch main.py
echo "import os\nos.listdir()" > main.py
nvim -u minimal.lua main.py

Error executing lua ...site/pack/packer/start/statusline.lua/lua/statusline.lua:4 cter <C>

Sometimes I get an error when I use <C-o> to go back to the previous buffer

Error detected while processing BufLeave Autocommands for "*":
E5108: Error executing lua ...site/pack/packer/start/statusline.lua/lua/statusline.lua:4
cter <C>
stack traceback:
        [C]: in function '__newindex'
        ...site/pack/packer/start/statusline.lua/lua/statusline.lua:49: in function 'inA
        [string ":lua"]:1: in main chunk

expected lua number error

Getting this error on neovim nightly:

E5108: Error executing lua ...e/pack/deps/opt/statusline.lua/lua/sections/_buficon.lua:6: Expected Lua number
stack traceback:
[C]: in function 'nvim_buf_get_name'
...e/pack/deps/opt/statusline.lua/lua/sections/_buficon.lua:6: in function 'get_file_icon'
.../pack/deps/opt/statusline.lua/lua/modules/statusline.lua:115: in function <.../pack/deps/opt/statusline.lua/lua/modules/statusline.lua:99>

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.