This commit is contained in:
Nachuan Tang
2023-03-20 16:46:34 -04:00
parent 21a9ef1d18
commit 69efb28c6f
2 changed files with 58 additions and 22 deletions
+32 -9
View File
@@ -1,5 +1,6 @@
" (jump to the topic)
"
" OPTIONS
" PLUGIN_INSTALL
" UTILITIES
" PLUGIN_CONFIGURATION
@@ -7,6 +8,12 @@
" KEY_MAPS
" OTHER_CONFIGS
let g:high_performence = v:false
" only used by neovim
let g:classic_vim_ui = v:false
let g:animation_enable = v:true
" PLUGIN_INSTALL
" {
" Plugin environment
@@ -37,7 +44,7 @@
"""""""""""""""""""""""
Plug 'gelguy/wilder.nvim'
Plug 'gelguy/wilder.nvim', Cond(g:vim_type == 'vim' \|\| g:classic_vim_ui)
" To use Python remote plugin features in Vim for wilder, can be skipped
" Plug 'roxma/nvim-yarp', Cond(g:vim_type == 'vim')
" Plug 'roxma/vim-hug-neovim-rpc', Cond(g:vim_type == 'vim')
@@ -71,7 +78,7 @@
" vim only plugins
Plug 'scrooloose/nerdtree', Cond(g:vim_type == 'vim' \|\| g:vim_version < 0.8, { 'on' : ['NERDTreeToggle', 'NERDTreeFind'] })
Plug 'tiagofumo/vim-nerdtree-syntax-highlight', Cond(g:vim_type == 'vim')
Plug 'tiagofumo/vim-nerdtree-syntax-highlight', Cond(g:vim_type == 'vim' && !g:high_performence)
Plug 'neoclide/coc.nvim', Cond(!exists('g:vscode') && executable('node'), {'branch': 'release'})
@@ -95,7 +102,7 @@
if g:vim_type == 'nvim'
if g:vim_version >= 0.5
Plug 'xiyaowong/nvim-transparent'
Plug 'lukas-reineke/indent-blankline.nvim'
Plug 'lukas-reineke/indent-blankline.nvim', Cond(!g:animation_enable)
Plug 'echasnovski/mini.indentscope'
Plug 'echasnovski/mini.animate'
@@ -490,24 +497,28 @@ endfunction
let time = float2nr(str2float(reltime()->reltimestr()[4:]) * 1000)
let speed = 800
let loadidx = time % speed
let msg = 'lsp[' . id . ']'
let msg = 'lsp:' . id
if state == "starting"
return msg . " " . loading[loadidx/(speed/10)]
let s:coc_lsp_loading = 1
return msg . " " . loading[loadidx/(speed/10)] . " "
endif
return msg . " ✔"
if exists('s:coc_lsp_loading')
unlet s:coc_lsp_loading
endif
return msg . " ✔ "
endfunction
" Set configuration options for the statusline plugin vim-airline.
" Use the powerline theme and optionally enable powerline symbols.
" This must using my fork version of bufferline
" TODO
" 22 is a magic number, it is best it can change as buffer width
" changing
" This must use my fork version of bufferline
let g:bufferline_max_length = &columns - 22
function! AirlineBufferNumber()
return len(g:index_to_buffer)
return len(g:index_to_buffer) . " "
endfunction
call airline#parts#define_function('bufnum', 'AirlineBufferNumber')
call airline#parts#define_function('cocstatus', 'AirlineCocStatus')
@@ -526,9 +537,20 @@ endfunction
let g:airline_section_x = airline#section#create(['bufnum'])
let g:airline_section_y = airline#section#create(['cocstatus'])
let g:airline_section_z = airline#section#create(['filetype'])
" see source for current list
function s:aireline_refresh(timer)
if exists(':AirlineRefresh')
:AirlineRefresh!
end
endfunction
if !g:high_performence
call timer_start(100, 's:aireline_refresh', {'repeat' : -1 })
endif
endfunction
autocmd User AirlineAfterInit call AirlineInit()
autocmd! User AirlineAfterInit call AirlineInit()
let g:airline#extensions#localsearch#enabled = 0
let g:airline_extensions = ['bufferline']
@@ -1035,3 +1057,4 @@ endif
if filereadable(g:mydotfiles_directory . "/config/theme.vim")
" exec "source " . g:mydotfiles_directory . "/config/theme.vim"
endif
+26 -13
View File
@@ -4,29 +4,40 @@
-- enable animation of command like "<C-u>" and "<C-d>", or cursor
-- jump animation. (Performence will be effected)
local animation_enable = true
local animation_enable = vim.g.animation_enable
local high_performence = vim.g.high_performence
-- false basicly enable plugins like noice, nvim-notify etc.
-- local classic_vim_ui = true
local classic_vim_ui = vim.g.classic_vim_ui
-------------------------------------------------
------------------UTILITIES----------------------
-------------------------------------------------
local vim = vim
local vim = vim
function HasPlug(name)
return vim.fn.HasPlug(name)
end
function _G.put(...)
local objects = {}
for i = 1, select('#', ...) do
local v = select(i, ...)
table.insert(objects, vim.inspect(v))
end
-- use as a wrapper function to set keymap that call a function with
-- parameters
local _wrap = function(func, ...)
local args = { ... }
return function()
func(unpack(args))
end
end
print(table.concat(objects, '\n'))
return ...
-- use to print object
function _G.put(...)
local objects = {}
for i = 1, select('#', ...) do
local v = select(i, ...)
table.insert(objects, vim.inspect(v))
end
print(table.concat(objects, '\n'))
return ...
end
local wk = nil
@@ -143,7 +154,8 @@ local function vim_illuminate_config()
if not HasPlug('vim-illuminate') then
return
end
require('illuminate').configure({
local illuminate = require('illuminate')
illuminate.configure({
providers = {
'lsp',
'treesitter',
@@ -290,7 +302,8 @@ local function indentline_config()
-- Example config in Lua
require("indent_blankline").setup {
show_current_context = true,
filetype_exclude = { "lspinfo", "packer", "checkhealth", "help", "man", "", "startify",}
filetype_exclude = { "lspinfo", "packer", "checkhealth",
"help", "man", "", "startify", }
-- use_treesitter = true,
}
end