diff options
author | listout <listout@protonmail.com> | 2022-08-02 01:10:05 +0530 |
---|---|---|
committer | listout <listout@protonmail.com> | 2022-09-01 16:26:25 +0530 |
commit | 18edf9861d1b38591b51b42465b224d77736db04 (patch) | |
tree | d3c47be47a0bb532444556f307a33465f9cf79fe /lua/plugins/statusline.lua | |
parent | b5d497da359e7d5224e0462bd5b55c3d1caefd26 (diff) |
nvim: moving init to lua
Signed-off-by: listout <listout@protonmail.com>
Diffstat (limited to 'lua/plugins/statusline.lua')
-rw-r--r-- | lua/plugins/statusline.lua | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua new file mode 100644 index 0000000..11c1435 --- /dev/null +++ b/lua/plugins/statusline.lua @@ -0,0 +1,56 @@ +vim.cmd([[ + function! StatusDiagnostic() abort + let info = get(b:, 'coc_diagnostic_info', {}) + if empty(info) | return '' | endif + let msgs = [] + if get(info, 'error', 0) + call add(msgs, 'E' . info['error']) + endif + if get(info, 'warning', 0) + call add(msgs, 'W' . info['warning']) + endif + return join(msgs, ' '). ' ' . get(g:, 'coc_status', '') + endfunction + + "let g:currentmode={ + "\ 'n' : 'NORMAL ', + "\ 'no' : 'N·Operator Pending ', + "\ 'v' : 'VISUAL ', + "\ 'V' : 'V·Line ', + "\ "\<C-V>" : 'V·Block ', + "\ 's' : 'Select ', + "\ 'S' : 'S·Line ', + "\ 'x19' : 'S·Block ', + "\ 'i' : 'INSERT ', + "\ 'R' : 'REPLACE ', + "\ 'Rv' : 'V·Replace ', + "\ 'c' : 'Command ', + "\ 'cv' : 'Vim Ex ', + "\ 'ce' : 'Ex ', + "\ 'r' : 'Prompt ', + "\ 'rm' : 'More ', + "\ 'r?' : 'Confirm ', + "\ '!' : 'Shell ', + "\ 't' : 'Terminal ' + "\} + + function! ReadOnly() + if &readonly || !&modifiable + return '' + else + return '' + endfunction + + set statusline= + "set statusline+=\ %{toupper(g:currentmode[mode()])} + set statusline^=%{StatusDiagnostic()} + set statusline+=%8*\ %<%f\ %{ReadOnly()}\ %w + set statusline+=%{&modified?'[+]':''} + set statusline+=%= + set statusline+=\ %y + "set statusline+=\ %{&fileencoding?&fileencoding:&encoding} + "set statusline+=\[%{&fileformat}\] + set statusline+=\ %p%% + set statusline+=\ %l:%c + set statusline+=\ " +]]) |