diff options
Diffstat (limited to 'nvim/lua/config/statusline.lua')
| -rw-r--r-- | nvim/lua/config/statusline.lua | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/nvim/lua/config/statusline.lua b/nvim/lua/config/statusline.lua index 01339d0..ef6f315 100644 --- a/nvim/lua/config/statusline.lua +++ b/nvim/lua/config/statusline.lua | |||
| @@ -46,19 +46,6 @@ local function git_diff() | |||
| 46 | return "" | 46 | return "" |
| 47 | end | 47 | end |
| 48 | 48 | ||
| 49 | ---------------------------------------------------------------------- | ||
| 50 | -- Dateiname mit Modifikationsstatus | ||
| 51 | ---------------------------------------------------------------------- | ||
| 52 | |||
| 53 | local function filename() | ||
| 54 | local name = vim.fn.expand("%:.") | ||
| 55 | if name == "" then name = "[No Name]" end | ||
| 56 | |||
| 57 | if vim.bo.modified then name = name .. " [+]" end | ||
| 58 | |||
| 59 | return " " .. name .. " " | ||
| 60 | end | ||
| 61 | |||
| 62 | ------------------------------------------------------------------------ | 49 | ------------------------------------------------------------------------ |
| 63 | -- Treesitter-Aktivität (buffer-lokal, kein redraw-spam) | 50 | -- Treesitter-Aktivität (buffer-lokal, kein redraw-spam) |
| 64 | ------------------------------------------------------------------------ | 51 | ------------------------------------------------------------------------ |
| @@ -70,6 +57,23 @@ local function treesitter() | |||
| 70 | end | 57 | end |
| 71 | 58 | ||
| 72 | ------------------------------------------------------------------------ | 59 | ------------------------------------------------------------------------ |
| 60 | -- LSP-Clients des Buffers | ||
| 61 | ------------------------------------------------------------------------ | ||
| 62 | |||
| 63 | local function lsp() | ||
| 64 | local clients = vim.lsp.get_clients({ bufnr = 0 }) | ||
| 65 | |||
| 66 | if #clients == 0 then return "" end | ||
| 67 | |||
| 68 | local names = {} | ||
| 69 | for _, client in ipairs(clients) do | ||
| 70 | table.insert(names, client.name) | ||
| 71 | end | ||
| 72 | |||
| 73 | return " " .. table.concat(names, ", ") .. " " | ||
| 74 | end | ||
| 75 | |||
| 76 | ------------------------------------------------------------------------ | ||
| 73 | -- Diagnostik-Counts (buffer-lokal, kein redraw-spam) | 77 | -- Diagnostik-Counts (buffer-lokal, kein redraw-spam) |
| 74 | ------------------------------------------------------------------------ | 78 | ------------------------------------------------------------------------ |
| 75 | 79 | ||
| @@ -103,14 +107,6 @@ local function fileinfo() | |||
| 103 | return string.format(" %s %s ", ft, enc) | 107 | return string.format(" %s %s ", ft, enc) |
| 104 | end | 108 | end |
| 105 | 109 | ||
| 106 | ------------------------------------------------------------------------ | ||
| 107 | -- Cursor-Position (kein redraw-spam) | ||
| 108 | ------------------------------------------------------------------------ | ||
| 109 | |||
| 110 | local function position() | ||
| 111 | return string.format(" %d:%d ", vim.fn.line("."), vim.fn.col(".")) | ||
| 112 | end | ||
| 113 | |||
| 114 | ---------------------------------------------------------------------- | 110 | ---------------------------------------------------------------------- |
| 115 | -- Öffentliche Statusline-Funktion | 111 | -- Öffentliche Statusline-Funktion |
| 116 | ---------------------------------------------------------------------- | 112 | ---------------------------------------------------------------------- |
| @@ -123,16 +119,18 @@ function M.statusline() | |||
| 123 | git(), | 119 | git(), |
| 124 | git_diff(), | 120 | git_diff(), |
| 125 | "%#StatusLine#", | 121 | "%#StatusLine#", |
| 126 | filename(), | 122 | -- %f Dateiname, %m Modifikationsstatus; %(..%) faellt weg, wenn %m leer ist |
| 123 | " %f%( %m%) ", | ||
| 127 | 124 | ||
| 128 | "%=", | 125 | "%=", |
| 129 | 126 | ||
| 130 | -- RIGHT: Feedback & Meta | 127 | -- RIGHT: Feedback & Meta |
| 131 | diagnostics(), | 128 | diagnostics(), |
| 129 | lsp(), | ||
| 132 | treesitter(), | 130 | treesitter(), |
| 133 | fileinfo(), | 131 | fileinfo(), |
| 134 | " %p%% ", | 132 | " %p%% ", |
| 135 | position(), | 133 | " %l:%c ", |
| 136 | }) | 134 | }) |
| 137 | end | 135 | end |
| 138 | 136 | ||
