Skip to content

Commit

Permalink
Add experimental :TmuxlineSimple
Browse files Browse the repository at this point in the history
  • Loading branch information
edkolev committed Dec 9, 2016
1 parent b090788 commit 05c6870
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions autoload/tmuxline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,45 @@ fun! tmuxline#set_statusline(...) abort
endtry
endfun

fun! tmuxline#set_statusline_simple(...) abort
let colors = tmuxline#util#get_colors_from_vim_statusline()

let variant = empty(a:000) ? '1' : a:1

if (variant == 1)
let [fg, bg, attr] = colors.statusline_nc
let [curr_fg, curr_bg, curr_attr] = colors.statusline
elseif (variant == 2)
let [fg, bg, attr] = colors.statusline
let [curr_fg, curr_bg, curr_attr] = colors.statusline_nc
elseif (variant == 3)
let fg = colors.statusline[0]
let bg = colors.statusline[1]
let attr = ''
let curr_fg = colors.statusline[0]
let curr_bg = colors.statusline[1]
let curr_attr = 'reverse'
elseif (variant == 4)
let [fg, bg, attr] = colors.statusline_nc
let [curr_fg, curr_bg, curr_attr] = colors.statusline_nc
else
echohl ErrorMsg | echomsg "tmuxline: invalid variant" | echohl None
endif

let attr = len(attr) ? ',' . attr : attr
let curr_attr = len(curr_attr) ? ',' . curr_attr : curr_attr

let line_settings = [
\ 'set -g status-style fg=colour' . fg . ',bg=colour' . bg . attr,
\ 'set -g window-status-current-style fg=colour' . curr_fg . ',bg=colour' . curr_bg . curr_attr]

try
call tmuxline#apply(line_settings)
catch /^tmuxline:/
echohl ErrorMsg | echomsg v:exception | echohl None
endtry
endfun

fun! tmuxline#set_statusline_theme_and_preset(theme, preset)
let line = tmuxline#load_line(a:preset)
let colors = tmuxline#load_colors(a:theme)
Expand Down
2 changes: 1 addition & 1 deletion plugin/tmuxline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ endif

command! -nargs=* -bar -complete=customlist,tmuxline#command_completion#complete_themes_and_presets Tmuxline call tmuxline#set_statusline(<f-args>)
command! -nargs=1 -bang -complete=file -bar TmuxlineSnapshot call tmuxline#snapshot(<f-args>, strlen("<bang>"))

command! -nargs=? TmuxlineSimple call tmuxline#set_statusline_simple(<f-args>)

0 comments on commit 05c6870

Please sign in to comment.