From eb385dcf9d8abed98b313901deb64e7b53db130c Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 16 Mar 2021 12:00:15 +0100 Subject: [PATCH] set up for multiplexing --- init.vim | 23 ++++++++++++++ lightline.vim | 83 ++++++++++++++++++++++++++++----------------------- 2 files changed, 69 insertions(+), 37 deletions(-) diff --git a/init.vim b/init.vim index d6efab8..bd8ce11 100644 --- a/init.vim +++ b/init.vim @@ -77,12 +77,35 @@ set expandtab " set number " Line numbering set smartindent " Indentation set noshowmode " Disable printing of mode changes +set noruler " Already in statusline set fillchars=eob:\ " Hide ~ on empty lines runtime colors.vim " Load color scheme filetype indent plugin on " Identify file type +"" +"" Terminal mode +"" + +" Hide some elements +autocmd TermOpen * setlocal nonumber +autocmd TermEnter * set laststatus=0 +autocmd TermLeave * set laststatus=2 + +" Exit without confirmation +autocmd TermClose * call feedkeys("\") + +" Easier escape +tnoremap + +" Emulate tmux +map - :split +term +map \| :vsplit +term +map t :tabnew +term +map c :quit + + "" "" Key bindings "" diff --git a/lightline.vim b/lightline.vim index df24688..e26a439 100644 --- a/lightline.vim +++ b/lightline.vim @@ -3,45 +3,54 @@ "" let g:lightline = { - \"active": { - \ "left": [[ "mode", "paste" ], - \ ["branch", "filename", "readonly", "ctrlp"]], - \ "right": [[ "encoding", "filetype"], - \ [ "lineinfo", "warnings", "errors"]], - \ }, - \"subseparator": { 'left': '→', 'right': '∘' }, - \"component": { - \ "branch" : '⚑ %{SpecialBuffer()? "" : fugitive#head()}', - \ "readonly": '%{SpecialBuffer() || !&readonly? "" : "∅"}', - \ "encoding": '%{!strlen(&fenc) || winwidth(0) < 70? "" : &fenc}', - \ "filetype": '%{SpecialBuffer() || winwidth(0) < 70? "" : strlen(&filetype) ? &filetype : "no ft"}', - \ }, - \'component_visible_condition': { - \ "branch" : '(!SpecialBuffer() && strlen(fugitive#head()))', - \ "readonly": '(!SpecialBuffer() && &readonly)', - \ "filetype": '(!SpecialBuffer() && winwidth(0) > 70)', - \ "encoding": '(strlen(&fenc) && winwidth(0) > 70)', - \ }, - \"component_expand": { - \ "errors": "NeomakeErr", - \ "warnings": "NeomakeWarn", - \ }, - \"component_type": { - \ "errors": "error", - \ "warnings": "warning", - \ }, - \"component_function": { - \ "mode": "Mode", - \ "filename": "Filename", - \ "ctrlp": "CtrlPMark", - \ } -\ } +\ "active": { +\ "left": [[ "mode", "paste" ], +\ ["branch", "filename", "readonly", "ctrlp"]], +\ "right": [[ "encoding", "filetype"], +\ [ "lineinfo", "warnings", "errors"]], +\ }, +\ "tabline": { "left": [ [ "tabs" ] ], "right": [ [ "battery", "date" ] ] }, +\ "subseparator": { 'left': '→', 'right': '∘' }, +\ "component": { +\ "date": '%{strftime("%a %H:%M")}', +\ "battery": '%{BatteryLevel()}', +\ "branch" : '⚑ %{SpecialBuffer()? "" : fugitive#head()}', +\ "readonly": '%{SpecialBuffer() || !&readonly? "" : "∅"}', +\ "encoding": '%{!strlen(&fenc) || winwidth(0) < 70? "" : &fenc}', +\ "filetype": '%{SpecialBuffer() || winwidth(0) < 70? "" : strlen(&filetype) ? &filetype : "no ft"}', +\ }, +\ 'component_visible_condition': { +\ "battery": '(filereadable("/sys/class/power_supply/BAT0/capacity"))', +\ "branch" : '(!SpecialBuffer() && strlen(fugitive#head()))', +\ "readonly": '(!SpecialBuffer() && &readonly)', +\ "filetype": '(!SpecialBuffer() && winwidth(0) > 70)', +\ "encoding": '(strlen(&fenc) && winwidth(0) > 70)', +\ }, +\ "component_expand": { +\ "errors": "NeomakeErr", +\ "warnings": "NeomakeWarn", +\ }, +\ "component_type": { +\ "errors": "error", +\ "warnings": "warning", +\ }, +\ "component_function": { +\ "mode": "Mode", +\ "filename": "Filename", +\ "ctrlp": "CtrlPMark", +\ } +\} "" "" Function helpers "" +function BatteryLevel() + let val = system("head -c2 /sys/class/power_supply/BAT0/capacity") + return v:shell_error? "" : "⚡" . val . "%" +endfunction + function SpecialBuffer() return &filetype == "help" || bufname() =~ '\v(undotree|diffpanel|ControlP)' endfunction @@ -107,15 +116,15 @@ let s:p.insert.left = [ [ 07, 05 ], [ 14, 00 ] ] let s:p.visual.left = [ [ 00, 03 ], [ 14, 00 ] ] let s:p.replace.left = [ [ 00, 02 ], [ 14, 00 ] ] let s:p.inactive.left = [ [ 12, 00 ], [ 15, 00 ] ] -let s:p.tabline.left = [ [ 14, 00 ] ] let s:p.normal.right = [ [ 12, 00 ], [ 03, 00 ] ] -let s:p.tabline.right = [ [ 12, 00 ], [ 03, 00 ] ] let s:p.inactive.right = [ [ 12, 00 ], [ 13, 00 ] ] let s:p.normal.middle = [ [ 12, 00 ] ] let s:p.inactive.middle = [ [ 12, 00 ] ] -let s:p.tabline.middle = [ [ 14, 00 ] ] -let s:p.tabline.tabsel = [ [ 14, 00 ] ] let s:p.normal.error = [ [ 00, 05 ] ] let s:p.normal.warning = [ [ 00, 02 ] ] +let s:p.tabline.left = [ [ 04, 00 ] ] +let s:p.tabline.right = [ [ 03, 00 ] ] +let s:p.tabline.tabsel = [ [ 00, 08 ] ] + let g:lightline#colorscheme#default#palette = lightline#colorscheme#fill(s:p)