Giter Club home page Giter Club logo

yasl.nvim's Introduction

yasl.nvim

Yet another minimal and lightweight statusline plugin designed for neovim. It prioritizes simplicity and performance without sacrificing functionality.

Features

In addition to easy integration with vim's default statusline items, YASL provides the following features:

  • LSP Diagnostics: Keep track of lsp diagnostic informations
  • Git Informations:
    • Display the current branch name
    • Show git diff stats to stay informed about changes
  • Active Mode: Easily identify the currently active mode with dynamic colors
  • Custom Components: Create your own custom providers with simple recipe.

These features are available without relying on any extra dependencies. It also tries to be more efficient by evaluating each statusline component only when needed, preventing unnecessary and expensive function calls.

Examples

screenshot of statusline in normal mode screenshot of statusline in insert mode screenshot of statusline in visual mode screenshot of statusline in command mode screenshot of statusline in replace mode

Installation

lazy.nvim
{
    "brianaung/yasl.nvim",
    dependencies = {
        "nvim-tree/nvim-web-devicons", -- (optional) if you want icons
    },
    opts = {}
}
packer.nvim
require("packer").startup(function()
  use({
    "brianaung/yasl.nvim",
    config = function()
      require("yasl").setup()
    end,
  })
end)

Configurations

Available components

Default options

require("yasl").setup({
    -- See :h laststatus
    laststatus = 3,

    -- true if nvim-web-devicons is installed, otherwise false
    enable_icons = true, 

    --[[
    Accepts provided component name (or)
    any string vim can use for statusline value. See :h statusline

    Default layout:
    +----------------------------------------------------------------------------+
    | mode | name branch diff |             | diagnostics | ft location progress |
    +----------------------------------------------------------------------------+
    ]]--
    components = {
        "mode",
        " ",
        "%<%t%h%m%r%w", -- filename
        " ",
        "branch",
        " ",
        "gitdiff",
        "%=",
        "diagnostics",
        " ",
        "filetype",
        " ",
        "[%-8.(%l, %c%V%) %P]", -- location, and progress
        " ",
    }
})

Recipe for creating your own component

To provide your own custom components, simply pass in a table to components array with events and update values set.

require("yasl").setup({
    ...
    components = {
        ...
        {
            -- Events that will trigger update function calls and redraws the statusline.
            events = { "BufEnter" },
            -- Any function that returns a string value.
            update = function()
                return "Hello!"
            end
        },
        ...
    },
    ...
})

yasl.nvim's People

Contributors

brianaung avatar

Stargazers

 avatar  avatar Vera Rei avatar kohane27 avatar Kyle King avatar TheGuide avatar Ethan Warrick avatar Jia Jia avatar Luis Enrique avatar Vitaliy Vostrikov avatar  avatar timothy h avatar  avatar Rhaskia avatar Yuta Katayama avatar

Watchers

 avatar

yasl.nvim's Issues

filetype icon disappeared

Once I save a file, or just enter the command mode, the filetype icon will disappear.

Here is a minimal config to reproduce:
Either the cmp or noice will trigger this issue (one is enough):

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"--single-branch",
		"https://github.com/folke/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	"folke/tokyonight.nvim",

	-- add any other plugins here
	{
		"brianaung/yasl.nvim",
		dependencies = { "nvim-tree/nvim-web-devicons" },
		config = true,
	},

        -- cup
	{
		"hrsh7th/nvim-cmp",
		dependencies = { "hrsh7th/cmp-cmdline" },
		config = function()
			require("cmp").setup.cmdline(":", {
				sources = {
					{ name = "cmdline" },
				},
			})
		end,
	},

        -- noice
	{
		"folke/noice.nvim",
		dependencies = { "MunifTanjim/nui.nvim" },
		config = true,
	},
}

require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

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.