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