mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
Compare commits
No commits in common. "cc523acd3ce90cb5240393ed921fbd2800a021b1" and "f421a7245fe69619531f24144bb7f7c0e9d575f5" have entirely different histories.
cc523acd3c
...
f421a7245f
5 changed files with 6 additions and 146 deletions
|
@ -1,126 +0,0 @@
|
|||
if !exists('g:did_coc_loaded')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#init(ext) abort
|
||||
let g:coc_user_config['list.statusLineSegments'] = v:null
|
||||
|
||||
call a:ext.add_statusline_func('airline#extensions#dotfiles_coclist#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#dotfiles_coclist#apply')
|
||||
|
||||
call airline#parts#define('dotfiles_coclist_mode', {
|
||||
\ 'function': 'airline#extensions#dotfiles_coclist#part_mode',
|
||||
\ 'accent': 'bold',
|
||||
\ })
|
||||
call airline#parts#define('dotfiles_coclist_args', {
|
||||
\ 'function': 'airline#extensions#dotfiles_coclist#part_args',
|
||||
\ })
|
||||
call airline#parts#define('dotfiles_coclist_name', {
|
||||
\ 'function': 'airline#extensions#dotfiles_coclist#part_name',
|
||||
\ })
|
||||
call airline#parts#define('dotfiles_coclist_cwd', {
|
||||
\ 'function': 'airline#extensions#dotfiles_coclist#part_cwd',
|
||||
\ })
|
||||
call airline#parts#define('dotfiles_coclist_loading', {
|
||||
\ 'function': 'airline#extensions#dotfiles_coclist#part_loading',
|
||||
\ })
|
||||
call airline#parts#define('dotfiles_coclist_total', {
|
||||
\ 'function': 'airline#extensions#dotfiles_coclist#part_total',
|
||||
\ })
|
||||
|
||||
" Default airline section setup:
|
||||
" <https://github.com/vim-airline/vim-airline/blob/49cdcb7b3ea76ee19c737885c0ab19e64e564169/autoload/airline/init.vim#L209-L250>
|
||||
" Beware that whitespaces in function expansions can cause some weirdness:
|
||||
" <https://github.com/vim/vim/issues/3898>
|
||||
let s:section_a = airline#section#create_left(['dotfiles_coclist_mode'])
|
||||
let s:section_b = airline#section#create(['dotfiles_coclist_name'])
|
||||
let s:section_c = airline#section#create(['%<', 'dotfiles_coclist_args', ' ', 'dotfiles_coclist_loading'])
|
||||
let s:section_x = airline#section#create(['dotfiles_coclist_cwd'])
|
||||
let s:section_y = airline#section#create(['#%L/', 'dotfiles_coclist_total'])
|
||||
let s:section_z = airline#section#create(['%p%%', 'linenr', 'maxlinenr'])
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#statusline() abort
|
||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': bufnr() }
|
||||
let builder = airline#builder#new(context)
|
||||
call airline#extensions#dotfiles_coclist#apply(builder, context)
|
||||
return builder.build()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#apply(builder, context) abort
|
||||
if getbufvar(a:context.bufnr, '&filetype', '') !=# 'list' | return 0 | endif
|
||||
let list_status = getbufvar(a:context.bufnr, 'list_status', 0)
|
||||
if type(list_status) !=# v:t_dict | return 0 | endif
|
||||
|
||||
" How b:list_status is populated:
|
||||
" <https://github.com/neoclide/coc.nvim/blob/0aa97ad1bbdcc2bb95cf7aabd7818643db1e269d/src/list/session.ts#L417-L433>
|
||||
" How the list buffer is created:
|
||||
" <https://github.com/neoclide/coc.nvim/blob/0aa97ad1bbdcc2bb95cf7aabd7818643db1e269d/autoload/coc/list.vim#L82-L100>
|
||||
" The default statusline:
|
||||
" <https://github.com/neoclide/coc.nvim/blob/0aa97ad1bbdcc2bb95cf7aabd7818643db1e269d/data/schema.json#L870-L884>
|
||||
" How airline generates its actual statuslines:
|
||||
" <https://github.com/vim-airline/vim-airline/blob/49cdcb7b3ea76ee19c737885c0ab19e64e564169/autoload/airline/extensions/default.vim>
|
||||
" <https://github.com/vim-airline/vim-airline/blob/49cdcb7b3ea76ee19c737885c0ab19e64e564169/autoload/airline/builder.vim>
|
||||
" <https://github.com/vim-airline/vim-airline/blob/49cdcb7b3ea76ee19c737885c0ab19e64e564169/autoload/airline/section.vim>
|
||||
|
||||
let spc = g:airline_symbols.space
|
||||
if a:context.active || (!a:context.active && !g:airline_inactive_collapse)
|
||||
call a:builder.add_section('airline_a', s:get_section('a'))
|
||||
call a:builder.add_section('airline_b', s:get_section('b'))
|
||||
endif
|
||||
call a:builder.add_section('airline_c', s:get_section('c'))
|
||||
call a:builder.split()
|
||||
call a:builder.add_section('airline_x', s:get_section('x'))
|
||||
call a:builder.add_section('airline_y', s:get_section('y'))
|
||||
call a:builder.add_section('airline_z', s:get_section('z'))
|
||||
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" Copied from <https://github.com/vim-airline/vim-airline/blob/49cdcb7b3ea76ee19c737885c0ab19e64e564169/autoload/airline/extensions/default.vim#L7-L14>
|
||||
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', {
|
||||
\ 'b': 79,
|
||||
\ 'x': 60,
|
||||
\ 'y': 88,
|
||||
\ 'z': 45,
|
||||
\ })
|
||||
|
||||
function! s:get_section(key) abort
|
||||
if has_key(s:section_truncate_width, a:key) && airline#util#winwidth() < s:section_truncate_width[a:key]
|
||||
return ''
|
||||
endif
|
||||
let spc = g:airline_symbols.space
|
||||
let text = s:section_{a:key}
|
||||
if empty(text) | return '' | endif
|
||||
return '%(' . spc . text . spc . '%)'
|
||||
endfunction
|
||||
|
||||
" TODO: Is recoloring of the section A based on `b:list_status.mode` possible?
|
||||
function! airline#extensions#dotfiles_coclist#part_mode() abort
|
||||
if get(w:, 'airline_active', 1)
|
||||
" <https://github.com/vim-airline/vim-airline/blob/49cdcb7b3ea76ee19c737885c0ab19e64e564169/autoload/airline/parts.vim#L55-L57>
|
||||
return airline#util#shorten(get(b:list_status, 'mode', ''), 79, 1)
|
||||
else
|
||||
return get(g:airline_mode_map, '__')
|
||||
else
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#part_args() abort
|
||||
return get(b:list_status, 'args', '')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#part_name() abort
|
||||
return get(b:list_status, 'name', '')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#part_loading() abort
|
||||
return get(b:list_status, 'loading', '')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#part_total() abort
|
||||
return get(b:list_status, 'total', '')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#dotfiles_coclist#part_cwd() abort
|
||||
return pathshorten(fnamemodify(get(b:list_status, 'cwd', ''), ':~:.'))
|
||||
endfunction
|
|
@ -62,7 +62,6 @@
|
|||
call s:hi('Title', 0xD, '', '', '')
|
||||
hi! link Directory Title
|
||||
call s:hi('Conceal', 0xC, '', '', '')
|
||||
call s:hi('IndentLine', 0x2, '', '', '')
|
||||
call s:hi('NonText', 0x3, '', '', '')
|
||||
hi! link SpecialKey Special
|
||||
call s:hi('MatchParen', 'fg', 0x3, '', '')
|
||||
|
@ -108,22 +107,12 @@
|
|||
call s:hi('WarningMsg', 0x9, '', '', '')
|
||||
call s:hi('TooLong', 0x8, '', '', '')
|
||||
call s:hi('Debug', 0x8, '', '', '')
|
||||
|
||||
call s:hi('CocErrorSign', 'bg', 0x8, '', '')
|
||||
call s:hi('CocWarningSign', 'bg', 0xA, '', '')
|
||||
call s:hi('CocInfoSign', 'bg', 0xD, '', '')
|
||||
hi! link CocHintSign CocInfoSign
|
||||
call s:hi('CocSelectedText', 0xE, 0x1, 'bold', '')
|
||||
call s:hi('CocCodeLens', 0x4, '', '', '')
|
||||
call s:hi('CocFadeOut', 0x3, '', '', '')
|
||||
call s:hi('CocStrikeThrough', '', '', 'strikethrough', '')
|
||||
hi! link CocMarkdownLink Underlined
|
||||
hi! link CocDiagnosticsFile Directory
|
||||
hi! link CocOutlineName NONE
|
||||
hi! link CocExtensionsLoaded NONE
|
||||
hi! link CocSymbolsName NONE
|
||||
hi! link CocOutlineIndentLine IndentLine
|
||||
hi! link CocSymbolsFile Directory
|
||||
hi! link CocErrorSign Error
|
||||
call s:hi('CocWarningSign', 'bg', 0xA, '', '')
|
||||
call s:hi('CocInfoSign', 'bg', 0xD, '', '')
|
||||
hi! link CocHintSign CocInfoSign
|
||||
call s:hi('CocFadeOut', 0x3, '', '', '')
|
||||
hi! link CocMarkdownLink Underlined
|
||||
|
||||
call s:hi('FoldColumn', 0xC, 0x1, '', '')
|
||||
call s:hi('Folded', 0x3, 0x1, '', '')
|
||||
|
|
|
@ -90,7 +90,6 @@ endif
|
|||
\ }
|
||||
let g:coc_user_config['suggest.floatEnable'] = v:false
|
||||
let g:coc_user_config['workspace.progressTarget'] = "statusline"
|
||||
let g:coc_user_config['list.selectedSignText'] = '> '
|
||||
|
||||
runtime! coc-languages/*.vim
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ set commentstring=//%s
|
|||
let g:indentLine_first_char = g:indentLine_char
|
||||
let g:indentLine_showFirstIndentLevel = 1
|
||||
let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man']
|
||||
let g:indentLine_defaultGroup = 'IndentLine'
|
||||
|
||||
augroup vimrc-indentlines-disable
|
||||
autocmd!
|
||||
|
|
|
@ -113,7 +113,6 @@ endif
|
|||
\ 'obsession',
|
||||
\ 'dotfiles_tweaks',
|
||||
\ 'dotfiles_filesize',
|
||||
\ 'dotfiles_coclist',
|
||||
\ ]
|
||||
let g:airline_detect_iminsert = 1
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue