neovim configuration using rocks.nvim plugin manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: basic statusline

+46
+1
init.lua
··· 6 6 require("core.options") 7 7 require("core.autocmds") 8 8 require("core.highlights") 9 + require("core.ui.statusline") 9 10 require("core.lsp") 10 11 11 12 require("utils.format").setup()
+45
lua/core/ui/statusline.lua
··· 1 + ---Show attached LSP clients in `[name1, name2]` format. 2 + ---Long server names will be modified. For example, `lua-language-server` will be shorten to `lua-ls` 3 + ---Returns an empty string if there aren't any attached LSP clients. 4 + ---@return string 5 + local function lsp_status() 6 + local attached_clients = vim.lsp.get_clients({ bufnr = 0 }) 7 + if #attached_clients == 0 then 8 + return "" 9 + end 10 + local it = vim.iter(attached_clients) 11 + it:map(function (client) 12 + local name = client.name:gsub("language.server", "ls") 13 + return name 14 + end) 15 + local names = it:totable() 16 + return "[" .. table.concat(names, ", ") .. "]" 17 + end 18 + 19 + local function tab_size() 20 + local tabsize = vim.bo.tabstop 21 + -- local sts = vim.bo.softtabstop 22 + -- if sts < 0 then 23 + -- tabsize = vim.bo.shiftwidth 24 + -- elseif sts == 0 then 25 + -- else 26 + -- end 27 + -- if vim.bo.expandtab then 28 + -- end 29 + return "[ts:" .. tabsize .. "]" 30 + end 31 + 32 + function _G.statusline() 33 + return table.concat({ 34 + "%f", 35 + "%h%w%r", 36 + "%=", 37 + tab_size(), 38 + lsp_status(), 39 + " ", 40 + "%-14(%l,%c%V%)", 41 + "%P", 42 + }, "") 43 + end 44 + 45 + vim.o.statusline = "%{%v:lua._G.statusline()%}"