Skip to content

Commit

Permalink
apps/neovim: Fix an issue with statusline highlight in vsplits
Browse files Browse the repository at this point in the history
  • Loading branch information
Shados committed Apr 19, 2021
1 parent 90e790e commit fc460c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 8 additions & 5 deletions apps/neovim/extraConfig.moon
Expand Up @@ -202,7 +202,7 @@ status_widget_functions = {}
is_active_statusline = (statusline_winid) ->
statusline_winid == fn.win_getid!

setup_status_line = (widget_groups, highlights) ->
setup_status_line = (widget_groups, base_highlights, highlights) ->
-- TODO rethink this interface to allow same level of flexibility, but
-- cleanly separate content and presentation?
for i, widgets in ipairs widget_groups
Expand All @@ -213,14 +213,16 @@ setup_status_line = (widget_groups, highlights) ->
highlight_cache = {}

highlight_name = (idx) -> "StatusLineWidgetGroup#{idx}"
generate_highlight = (idx, highlight) ->
name = highlight_name idx
generate_highlight = (name, highlight) ->
base = "hi #{name} guifg=#{highlight.fg} guibg=#{highlight.bg}"
if highlight.style
base .. " gui=#{highlight.style}"
else
base

cmd (generate_highlight "StatusLine", base_highlights[1])
cmd (generate_highlight "StatusLineNC", base_highlights[2])

widget_group_strs = {}

for group_idx, widget_group in ipairs widget_groups
Expand Down Expand Up @@ -257,7 +259,8 @@ setup_status_line = (widget_groups, highlights) ->

-- Write highlight group for highlight
if set_highlight
cmd (generate_highlight idx, highlight)
hi_name = highlight_name idx
cmd (generate_highlight hi_name, highlight)

widget_group_str = ""
for {:callable, :widget_str} in *widget_strs
Expand Down Expand Up @@ -385,5 +388,5 @@ do
{ ' ', sl.file_percentage, ' %l:%c ' }, -- Line & column information
}

setup_status_line widgets, statusline_highlights
setup_status_line widgets, statusline_base_highlights, statusline_highlights
-- }}}
7 changes: 5 additions & 2 deletions apps/neovim/oceanicnext.nix
Expand Up @@ -18,7 +18,7 @@ in
extraConfig = ''
set "background", "dark"
cmd 'colorscheme OceanicNext'
statusline_highlights = do
statusline_base_highlights, statusline_highlights = do
statusline_highlights
colors =
base00: '#1b2b34'
Expand Down Expand Up @@ -53,7 +53,7 @@ in
SHELL: {colors.base01, colors.green}
TERM: {colors.base01, colors.green}
NONE: {colors.base01, colors.purple}
base_hi = { bg: colors.base01, fg: colors.white }
base_hi = { bg: colors.base01, fg: colors.white, style: "NONE" }
file_hi = { bg: colors.base03, fg: colors.white }
fileinfo_hi = file_hi
warning_hi = { bg: colors.yellow, fg: colors.base01 }
Expand All @@ -65,6 +65,9 @@ in
base_hi
{
base_hi,
base_hi,
}, {
mode_highlight
file_hi
warning_hi,
Expand Down

0 comments on commit fc460c6

Please sign in to comment.