switch from airline to lightline for nvim

airline was misbehaving all of the sudden for no reason

like I didnt even update it it just started throwing errors lmao
This commit is contained in:
Hedy Li 2021-07-27 21:36:33 +08:00
parent 61b6e2ff9a
commit 576f0355bc
Signed by: hedy
GPG Key ID: B51B5A8D1B176372
1 changed files with 54 additions and 15 deletions

View File

@ -10,7 +10,8 @@ Plug 'tpope/vim-fugitive' " git stuff
Plug 'tpope/vim-surround' " quoting and parenthesizing plugin
Plug 'jiangmiao/auto-pairs' " quote pairs and other neat stuff
Plug 'https://github.com/tpope/vim-commentary'
Plug 'vim-airline/vim-airline' " airline plugin for status bar
" Plug 'vim-airline/vim-airline' " airline plugin for status bar
Plug 'itchyny/lightline.vim' " airline was throwing shitty errors so yeah.
Plug 'mbbill/undotree' " undo tree
Plug 'bling/vim-bufferline' " buffer line
Plug 'tpope/vim-fugitive'
@ -29,8 +30,46 @@ call plug#end()
"let g:dracula_colorterm = 0
colorscheme dracula
" airline integrations
let g:airline#extensions#tagbar#enabled = 1
" lightline
let g:lightline = {
\ 'colorscheme': 'dracula',
\ 'mode_map': {
\ 'n' : 'NORM',
\ 'i' : 'INS',
\ 'R' : 'REP',
\ 'v' : 'VIS',
\ 'V' : 'VL',
\ "\<C-v>": 'VB',
\ 'c' : 'C',
\ 's' : 'S',
\ 'S' : 'SL',
\ "\<C-s>": 'SB',
\ 't': 'T',
\ },
\ 'component': {
\ 'tagbar': '%{tagbar#currenttag("[%s]", "")}',
\ },
\ 'component_function': {
\ 'fugitive': 'LightlineFugitive',
\ 'ctrlpmark': 'CtrlPMark',
\ },
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark', 'tagbar'] ],
\ },
\ }
function! LightlineFugitive()
try
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*FugitiveHead')
let mark = '' " edit here for cool mark
let branch = FugitiveHead()
return branch !=# '' ? mark.branch : ''
endif
catch
endtry
return ''
endfunction
" open current dir in nerdtree
noremap <Leader>nf :NERDTreeFind<CR>
@ -74,14 +113,14 @@ nnoremap <silent> <space>y :<C-u>CocList -A --normal yank<cr>
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
@ -91,9 +130,9 @@ inoremap <silent><expr> <c-space> coc#refresh()
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use `[g` and `]g` to navigate diagnostics
@ -110,11 +149,11 @@ nmap <silent> gr <Plug>(coc-references)
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.