set up for multiplexing

This commit is contained in:
Michele Guerini Rocco 2021-03-16 12:00:15 +01:00
parent b19e514dde
commit eb385dcf9d
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
2 changed files with 69 additions and 37 deletions

View File

@ -77,12 +77,35 @@ set expandtab "
set number " Line numbering set number " Line numbering
set smartindent " Indentation set smartindent " Indentation
set noshowmode " Disable printing of mode changes set noshowmode " Disable printing of mode changes
set noruler " Already in statusline
set fillchars=eob:\ " Hide ~ on empty lines set fillchars=eob:\ " Hide ~ on empty lines
runtime colors.vim " Load color scheme runtime colors.vim " Load color scheme
filetype indent plugin on " Identify file type 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("\<CR>")
" Easier escape
tnoremap <C-b> <C-\><C-n>
" Emulate tmux
map <silent><C-w>- :split +term<CR>
map <silent><C-w>\| :vsplit +term<CR>
map <silent><C-w>t :tabnew +term<CR>
map <silent><C-w>c :quit<CR>
"" ""
"" Key bindings "" Key bindings
"" ""

View File

@ -3,45 +3,54 @@
"" ""
let g:lightline = { let g:lightline = {
\"active": { \ "active": {
\ "left": [[ "mode", "paste" ], \ "left": [[ "mode", "paste" ],
\ ["branch", "filename", "readonly", "ctrlp"]], \ ["branch", "filename", "readonly", "ctrlp"]],
\ "right": [[ "encoding", "filetype"], \ "right": [[ "encoding", "filetype"],
\ [ "lineinfo", "warnings", "errors"]], \ [ "lineinfo", "warnings", "errors"]],
\ }, \ },
\"subseparator": { 'left': '→', 'right': '∘' }, \ "tabline": { "left": [ [ "tabs" ] ], "right": [ [ "battery", "date" ] ] },
\"component": { \ "subseparator": { 'left': '→', 'right': '∘' },
\ "branch" : '⚑ %{SpecialBuffer()? "" : fugitive#head()}', \ "component": {
\ "readonly": '%{SpecialBuffer() || !&readonly? "" : "∅"}', \ "date": '%{strftime("%a %H:%M")}',
\ "encoding": '%{!strlen(&fenc) || winwidth(0) < 70? "" : &fenc}', \ "battery": '%{BatteryLevel()}',
\ "filetype": '%{SpecialBuffer() || winwidth(0) < 70? "" : strlen(&filetype) ? &filetype : "no ft"}', \ "branch" : '⚑ %{SpecialBuffer()? "" : fugitive#head()}',
\ }, \ "readonly": '%{SpecialBuffer() || !&readonly? "" : "∅"}',
\'component_visible_condition': { \ "encoding": '%{!strlen(&fenc) || winwidth(0) < 70? "" : &fenc}',
\ "branch" : '(!SpecialBuffer() && strlen(fugitive#head()))', \ "filetype": '%{SpecialBuffer() || winwidth(0) < 70? "" : strlen(&filetype) ? &filetype : "no ft"}',
\ "readonly": '(!SpecialBuffer() && &readonly)', \ },
\ "filetype": '(!SpecialBuffer() && winwidth(0) > 70)', \ 'component_visible_condition': {
\ "encoding": '(strlen(&fenc) && winwidth(0) > 70)', \ "battery": '(filereadable("/sys/class/power_supply/BAT0/capacity"))',
\ }, \ "branch" : '(!SpecialBuffer() && strlen(fugitive#head()))',
\"component_expand": { \ "readonly": '(!SpecialBuffer() && &readonly)',
\ "errors": "NeomakeErr", \ "filetype": '(!SpecialBuffer() && winwidth(0) > 70)',
\ "warnings": "NeomakeWarn", \ "encoding": '(strlen(&fenc) && winwidth(0) > 70)',
\ }, \ },
\"component_type": { \ "component_expand": {
\ "errors": "error", \ "errors": "NeomakeErr",
\ "warnings": "warning", \ "warnings": "NeomakeWarn",
\ }, \ },
\"component_function": { \ "component_type": {
\ "mode": "Mode", \ "errors": "error",
\ "filename": "Filename", \ "warnings": "warning",
\ "ctrlp": "CtrlPMark", \ },
\ } \ "component_function": {
\ } \ "mode": "Mode",
\ "filename": "Filename",
\ "ctrlp": "CtrlPMark",
\ }
\}
"" ""
"" Function helpers "" Function helpers
"" ""
function BatteryLevel()
let val = system("head -c2 /sys/class/power_supply/BAT0/capacity")
return v:shell_error? "" : "⚡" . val . "%"
endfunction
function SpecialBuffer() function SpecialBuffer()
return &filetype == "help" || bufname() =~ '\v(undotree|diffpanel|ControlP)' return &filetype == "help" || bufname() =~ '\v(undotree|diffpanel|ControlP)'
endfunction 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.visual.left = [ [ 00, 03 ], [ 14, 00 ] ]
let s:p.replace.left = [ [ 00, 02 ], [ 14, 00 ] ] let s:p.replace.left = [ [ 00, 02 ], [ 14, 00 ] ]
let s:p.inactive.left = [ [ 12, 00 ], [ 15, 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.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.inactive.right = [ [ 12, 00 ], [ 13, 00 ] ]
let s:p.normal.middle = [ [ 12, 00 ] ] let s:p.normal.middle = [ [ 12, 00 ] ]
let s:p.inactive.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.error = [ [ 00, 05 ] ]
let s:p.normal.warning = [ [ 00, 02 ] ] 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) let g:lightline#colorscheme#default#palette = lightline#colorscheme#fill(s:p)