This commit is contained in:
Nachuan Tang
2023-03-25 02:25:27 -04:00
parent e0518c302f
commit 4fa43c8d4d
6 changed files with 32 additions and 94 deletions
-1
View File
@@ -2,6 +2,5 @@
*.pyc
*._*
.vim/
autoload/
node_modules/
tags
+1 -1
View File
@@ -115,7 +115,7 @@
" endif
set backspace=indent,eol,start " Backspace for dummies
set fillchars=eob:\ " it can remove '~' at the end of buffer
set number " Line numbers on
set showmatch " Show matching brackets/parenthesis
set incsearch " Find as you type search
+26 -21
View File
@@ -7,7 +7,7 @@
" KEY_MAPS
" OTHER_CONFIGS
let g:debug_mode = v:true
let g:debug_mode = v:false
let g:high_performence = v:false " set true will also disable animation
let g:autocomplte_enable = v:true
let g:copilot_enable = v:false
@@ -27,7 +27,7 @@ nmap <leader><leader>t :call SwapWord()<CR>
"""""" PLUGIN_INSTALL """"""
let g:mydotfiles_directory = expand('~/.dotfiles/')
let g:dotfiledir = expand('~/.dotfiles/')
let g:plugin_dir = expand('~/.vim/plugged/')
let g:config_file_path = g:vim_dir . ".config.vim"
call plug#begin(g:plugin_dir)
@@ -38,6 +38,9 @@ call plug#begin(g:plugin_dir)
endfunction
let g:animation_enable = g:high_performence ? v:false : g:animation_enable
" custom plugin
Plug 'Donaldttt/fzf-color-preview', Cond(g:vim_v >= 800)
"""" THEME_PLUGINS """"
Plug 'sainnhe/everforest'
@@ -160,7 +163,7 @@ augroup end
"""""" UTILITIES """"""
" import ultilities functions
execute('source ' . g:mydotfiles_directory . '/utils.vim')
execute('source ' . g:dotfiledir . '/utils.vim')
function! SaveConfig()
let p = ReadVariable(g:config_file_path)
@@ -431,10 +434,10 @@ if HasPlug("vim-bufferline") && HasPlug("vim-airline")
" scrolling with fixed current buffer position
let g:bufferline_active_buffer_left = ''
let g:bufferline_active_buffer_right = ''
let g:bufferline_inactive_highlight = 'airline_b_inactive'
let g:bufferline_active_highlight = 'airline_b_bold'
let g:bufferline_active_buffer_left = '['
let g:bufferline_active_buffer_right = ']'
let g:bufferline_inactive_highlight = 'airline_c'
let g:bufferline_active_highlight = 'airline_c_bold'
endif
if HasPlug("undotree")
@@ -504,8 +507,10 @@ if HasPlug("vim-airline")
" 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
" the number of cols bufferline cannot use out of max of screen cols
let g:bufferline_forbided_col = 32
call airline#parts#define_function('bufnum', 'AirlineBufferNumber')
call airline#parts#define_function('cocstatus', 'AirlineCocStatus')
call airline#parts#define_accent('cocstatus', 'italic')
@@ -527,9 +532,10 @@ if HasPlug("vim-airline")
" let g:airline_section_y = '%{%airline#util#wrap(AirlineCocStatus(), 0)%}'
let g:airline_section_a = airline#section#create(['mode'])
let g:airline_section_b = ''
let g:airline_section_error = ''
let g:airline_section_warning = ''
let g:airline_section_x = airline#section#create(['bufnum'])
let g:airline_section_error = ''
let g:airline_section_warning = ''
" let g:airline_section_x = airline#section#create(['bufnum'])
let g:airline_section_x = ''
let g:airline_section_y = _airline_section_y
let g:airline_section_z = airline#section#create(['filetype'])
" see source for current list
@@ -598,7 +604,7 @@ if HasPlug("fzf") && HasPlug("fzf.vim")
if g:os == 'Windows'
let g:fzf_preview_window = []
else
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
let g:fzf_preview_window = ['right:50%']
end
let g:fzf_colors = {
@@ -630,22 +636,21 @@ if HasPlug("fzf") && HasPlug("fzf.vim")
function! FzfAirlineColorSelect(color_name)
call SetStatusLineTheme(&background, a:color_name)
endfunction
let g:VimrpcFzfColor = function('FzfColorSelect')
let g:VimrpcFzfAirline = function('FzfAirlineColorSelect')
noremap <leader>fr :Rg<CR>
noremap <leader>ff :Files<CR>
noremap <leader>ft :CFile<CR>
noremap <leader>fc :call fzf#vim#colors({
\ 'sink': function('FzfColorSelect')})<CR>
noremap <leader>fa :call fzf#run(fzf#wrap({
\ 'source': airline#util#themes(''),
\ 'sink': function('FzfAirlineColorSelect')}))<CR>
noremap <leader>fa :AirlinePreview<CR>
noremap <leader>fc :ColorsPreview<CR>
endif
if HasPlug("coc.nvim") && executable('node')
" coc-clangd: c/c++, may need to install clangd seperatly
if filereadable(g:mydotfiles_directory . "/coc-nvim-config.vim")
exec "source " . g:mydotfiles_directory . "/coc-nvim-config.vim"
if filereadable(g:dotfiledir . "/coc-nvim-config.vim")
exec "source " . g:dotfiledir . "/coc-nvim-config.vim"
endif
" warning that coc work best for vim >= 8.3
let g:coc_disable_startup_warning = 1
@@ -941,8 +946,8 @@ endif
"""""" OTHERS """"""
" Lua configuration
if has('nvim') && filereadable(g:mydotfiles_directory . '.vimrc.lua')
execute('source ' . g:mydotfiles_directory . '/.vimrc.lua')
if has('nvim') && filereadable(g:dotfiledir . '.vimrc.lua')
execute('source ' . g:dotfiledir . '/.vimrc.lua')
endif
call s:executeLateInit()
+4 -1
View File
@@ -502,7 +502,7 @@ local function nvim_tree_config()
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
local api = require('nvim-tree.api')
local api = require('nvim-tree.api')
local M = {}
function M.print_node_path()
@@ -539,6 +539,9 @@ local function nvim_tree_config()
filters = {
dotfiles = false,
},
git = {
ignore = false,
},
actions = {
open_file = {
quit_on_open = true,
+1 -1
View File
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
""" Convert values between RGB hex codes and xterm-256 color codes.
-69
View File
@@ -1,69 +0,0 @@
function! GetHi(group, term)
" Store output of group to variable
let output = execute('hi ' . a:group)
" Find the term we're looking for
return matchstr(output, a:term.'=\zs\S*')
endfunction
function! StrIsNr(input)
if a:input =~# '^\d\+$'
return v:true
endif
return v:false
endfunction
" Pick an appropriate 256 color base on old color
function! SuitableColor(oldColor)
return a:oldColor - 40
endfunction
function! ThemeFix()
let newValue = -1
let hiGroups = ['CocErrorFloat', 'CocFloating', 'NormalFloat']
if has('nvim')
for group in hiGroups
if hlexists(group)
let oldColor = GetHi(group, 'ctermbg')
if StrIsNr(oldColor)
let newValue = SuitableColor(str2nr(oldColor))
" execute('hi ' . group . ' ctermbg=' . newValue)
execute('autocmd! ColorScheme * hi ' . group . ' ctermbg=' . newValue)
endif
endif
endfor
end
endfunction
function! GetRidOfBg()
let hiGroups = ['CocErrorSign', 'CocWarningSign', 'CocHintSign']
for group in hiGroups
if hlexists(group)
execute('hi ' . group . ' ctermbg=none')
endif
endfor
endfunction
function! CocThemeFix()
hi CocErrorHighlight cterm=underline ctermfg=124 ctermbg=none " Keyword at the error position highlight
hi CocErrorSign ctermbg=none ctermfg=124 " Error Sign at the sign column highlight
hi CocWarningSign ctermbg=none ctermfg=214 " Warning Sign at the sign column highlight
hi CocHintSign ctermbg=none ctermfg=214 " Hint Sign at the sign column highlight
hi CocUnusedHighlight cterm=underline ctermfg=214 ctermbg=none " Unused variable/function etc. highlight
hi CocWarningHighlight cterm=underline ctermfg=214 ctermbg=none " Warning variable/function etc. highlight
hi CocInfoHighlight ctermfg=207 ctermbg=none " Info variable/function etc. highlight
hi CocInfoSign ctermbg=none ctermfg=207 " Info Sign at the sign column highlight
hi Todo ctermbg=none ctermfg=214 " Info Sign at the sign column highlight
hi Error cterm=underline ctermfg=124 ctermbg=none
hi javaError cterm=underline ctermfg=124 ctermbg=none
highlight CursorLineNr ctermbg=none
highlight SignColumn ctermbg=none
endfunction
call CocThemeFix()
au! ColorScheme * call CocThemeFix()