GithubHelp home page GithubHelp logo

Comments (10)

luetage avatar luetage commented on May 29, 2024

Great write‐up, thanks for sharing. This was very helpful in getting my own lua statusline going.

from elianiva.my.id.

bryant-the-coder avatar bryant-the-coder commented on May 29, 2024

@elianiva error 404 for neovim-lua-statusline website

from elianiva.my.id.

luetage avatar luetage commented on May 29, 2024

https://web.archive.org/web/20210924021734/https://elianiva.my.id/post/neovim-lua-statusline

from elianiva.my.id.

elianiva avatar elianiva commented on May 29, 2024

@elianiva error 404 for neovim-lua-statusline website

Thanks for pointing out! Should be fixed now.

from elianiva.my.id.

bryant-the-coder avatar bryant-the-coder commented on May 29, 2024

thz... wanna make my own statusline for so long xD

from elianiva.my.id.

nathanielevan avatar nathanielevan commented on May 29, 2024

Pretty informative article, great write-up. Coming from someone entirely new to Lua and Neovim as a whole, I have a question that has been lingering on my mind recently: seeing that these functions you defined within M are only used within this Lua file alone, what are the advantages of defining them within a module instead of as "standalone" functions, like so:

function get_git_status()
    -- stuff here
end

I'm seeing a lot of people do it this way (i.e. encapsulating these functions within modules), but I have no idea exactly what purpose it serves.

from elianiva.my.id.

elianiva avatar elianiva commented on May 29, 2024

I think it's just a personal preference. I prefer to use self to access related values instead of relying on local variables inside this file. It's kinda like using class.

from elianiva.my.id.

bryant-the-coder avatar bryant-the-coder commented on May 29, 2024

hey @elianiva , can u try changing the highlight group when we select the text in ur post?

from elianiva.my.id.

mnjm avatar mnjm commented on May 29, 2024

Hey, here is the code snippet to replace VimL autocmds with Lua-API

local _au = vim.api.nvim_create_augroup('status_line', { clear = true })
vim.api.nvim_create_autocmd({'WinEnter', 'BufEnter'}, {
    pattern = "*",
    callback = function()
        vim.wo.statusline = statusline.active()
    end,
    group = _au
})
vim.api.nvim_create_autocmd({'WinLeave', 'BufLeave'}, {
    pattern = "*",
    callback = function()
        vim.wo.statusline = statusline.inactive()
    end,
    group = _au
})

from elianiva.my.id.

elianiva avatar elianiva commented on May 29, 2024

closing since I migrated to giscus

from elianiva.my.id.

Related Issues (19)

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.