set up for multiplexing

master
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 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("\<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
""

View File

@ -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)