Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 15 characters in body
Source Link
D. Ben Knoble
  • 27.7k
  • 3
  • 31
  • 68

I build my own statusline because I don't need such fancy things inside my statusline as some plug-ins provides. Usually everything is fine. The result looks like the following:

" NORMAL | ~/.config/nvim/lua/statusline.lua | + | ft:LUA| buf:1| 1/123:23"

NORMAL   | ~/.config/nvim/lua/statusline.lua | +  | ft:LUA| buf:1| 1/123:23

But if I open a file with a deep nested path, my statusline swallows up my mode section. Like:

"<ocal/share/nvim/site/pack/packer/start/zenburn.nvim/lua/zenburn/palette.lua/nvim/lua/statusline.lua | ft:LUA| buf:1| 1/123:23"

<ocal/share/nvim/site/pack/packer/start/zenburn.nvim/lua/zenburn/palette.lua/nvim/lua/statusline.lua | ft:LUA| buf:1| 1/123:23

This happendhappens even if I put a minimal width toon my mode section. Here is my function to create the statusline:

local function create_statusline(mapped_mode)
  local statusline_raw = {
    "%#", mapped_mode.hl, "#",
    " %7(", -- Breite des Mode (zusammen 9 Zeichen)
    mapped_mode.text, -- Mode
    "%) ", -- Schließt Mode-Teil
    "%*", -- Stellt eigentliche Highlightgroup wieder her
    " %F", -- Filename + Path
    " |", -- Separator
    " %.5(%M %R%)", -- Modifier +, ro
    "%=", -- rechte Seite
    " :%Y", -- FileType
    " ﬘:%n", -- BufferNr
    " %l/%L:%c", -- Line/line_count:column
  }         )
  return table.concat(statusline_raw)
end

The mapped_mode is a table with the text and a highlight group name as elements. The comments are a mix of German and English.

I think, I don't understand the right meaning of {minwid}. I hope some of you can help me out to get the mode section all the time in my statusline.

Thank you for your help

I build my own statusline because I don't need such fancy things inside my statusline as some plug-ins provides. Usually everything is fine. The result looks like the following:

" NORMAL | ~/.config/nvim/lua/statusline.lua | + | ft:LUA| buf:1| 1/123:23"

But if I open a file with a deep nested path, my statusline swallows up my mode section. Like:

"<ocal/share/nvim/site/pack/packer/start/zenburn.nvim/lua/zenburn/palette.lua/nvim/lua/statusline.lua | ft:LUA| buf:1| 1/123:23"

This happend even I put a minimal width to my mode section. Here my function to create the statusline:

local function create_statusline(mapped_mode)
  local statusline_raw = {
    "%#", mapped_mode.hl, "#",
    " %7(", -- Breite des Mode (zusammen 9 Zeichen)
    mapped_mode.text, -- Mode
    "%) ", -- Schließt Mode-Teil
    "%*", -- Stellt eigentliche Highlightgroup wieder her
    " %F", -- Filename + Path
    " |", -- Separator
    " %.5(%M %R%)", -- Modifier +, ro
    "%=", -- rechte Seite
    " :%Y", -- FileType
    " ﬘:%n", -- BufferNr
    " %l/%L:%c", -- Line/line_count:column
  }         )
  return table.concat(statusline_raw)
end

The mapped_mode is a table with the text and a highlight group name as elements. The comments are a mix of German and English.

I think, I don't understand the right meaning of {minwid}. I hope some of you can help me out to get the mode section all the time in my statusline.

Thank you for your help

I build my own statusline because I don't need such fancy things inside my statusline as some plug-ins provides. Usually everything is fine. The result looks like the following:

NORMAL   | ~/.config/nvim/lua/statusline.lua | +  | ft:LUA| buf:1| 1/123:23

But if I open a file with a deep nested path, my statusline swallows up my mode section. Like:

<ocal/share/nvim/site/pack/packer/start/zenburn.nvim/lua/zenburn/palette.lua/nvim/lua/statusline.lua | ft:LUA| buf:1| 1/123:23

This happens even if I put a minimal width on my mode section. Here is my function to create the statusline:

local function create_statusline(mapped_mode)
  local statusline_raw = {
    "%#", mapped_mode.hl, "#",
    " %7(", -- Breite des Mode (zusammen 9 Zeichen)
    mapped_mode.text, -- Mode
    "%) ", -- Schließt Mode-Teil
    "%*", -- Stellt eigentliche Highlightgroup wieder her
    " %F", -- Filename + Path
    " |", -- Separator
    " %.5(%M %R%)", -- Modifier +, ro
    "%=", -- rechte Seite
    " :%Y", -- FileType
    " ﬘:%n", -- BufferNr
    " %l/%L:%c", -- Line/line_count:column
  }         )
  return table.concat(statusline_raw)
end

The mapped_mode is a table with the text and a highlight group name as elements. The comments are a mix of German and English.

I think I don't understand the meaning of {minwid}. I hope some of you can help me out to get the mode section all the time in my statusline.

Source Link
grrr
  • 11
  • 2

Long file name overrides other items in statusline

I build my own statusline because I don't need such fancy things inside my statusline as some plug-ins provides. Usually everything is fine. The result looks like the following:

" NORMAL | ~/.config/nvim/lua/statusline.lua | + | ft:LUA| buf:1| 1/123:23"

But if I open a file with a deep nested path, my statusline swallows up my mode section. Like:

"<ocal/share/nvim/site/pack/packer/start/zenburn.nvim/lua/zenburn/palette.lua/nvim/lua/statusline.lua | ft:LUA| buf:1| 1/123:23"

This happend even I put a minimal width to my mode section. Here my function to create the statusline:

local function create_statusline(mapped_mode)
  local statusline_raw = {
    "%#", mapped_mode.hl, "#",
    " %7(", -- Breite des Mode (zusammen 9 Zeichen)
    mapped_mode.text, -- Mode
    "%) ", -- Schließt Mode-Teil
    "%*", -- Stellt eigentliche Highlightgroup wieder her
    " %F", -- Filename + Path
    " |", -- Separator
    " %.5(%M %R%)", -- Modifier +, ro
    "%=", -- rechte Seite
    " :%Y", -- FileType
    " ﬘:%n", -- BufferNr
    " %l/%L:%c", -- Line/line_count:column
  }         )
  return table.concat(statusline_raw)
end

The mapped_mode is a table with the text and a highlight group name as elements. The comments are a mix of German and English.

I think, I don't understand the right meaning of {minwid}. I hope some of you can help me out to get the mode section all the time in my statusline.

Thank you for your help