From 4fa43c8d4d0bd8521d76080d5c0790b0e6596e54 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sat, 25 Mar 2023 02:25:27 -0400 Subject: [PATCH] . --- .gitignore | 1 - .vimrc | 2 +- .vimrc.bundles | 47 ++++++++++++++++-------------- .vimrc.lua | 5 +++- config/colortrans.py | 2 +- config/theme.vim | 69 -------------------------------------------- 6 files changed, 32 insertions(+), 94 deletions(-) delete mode 100644 config/theme.vim diff --git a/.gitignore b/.gitignore index cfb5e0e..ee9f8a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ *.pyc *._* .vim/ -autoload/ node_modules/ tags diff --git a/.vimrc b/.vimrc index 111ed0b..3eb653e 100644 --- a/.vimrc +++ b/.vimrc @@ -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 diff --git a/.vimrc.bundles b/.vimrc.bundles index ca1b8a3..5aa7f58 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -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 t :call SwapWord() """""" 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 fr :Rg noremap ff :Files noremap ft :CFile - noremap fc :call fzf#vim#colors({ - \ 'sink': function('FzfColorSelect')}) - noremap fa :call fzf#run(fzf#wrap({ - \ 'source': airline#util#themes(''), - \ 'sink': function('FzfAirlineColorSelect')})) + noremap fa :AirlinePreview + noremap fc :ColorsPreview 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() diff --git a/.vimrc.lua b/.vimrc.lua index 62f72f1..f60a556 100644 --- a/.vimrc.lua +++ b/.vimrc.lua @@ -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, diff --git a/config/colortrans.py b/config/colortrans.py index 513d503..329c668 100755 --- a/config/colortrans.py +++ b/config/colortrans.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """ Convert values between RGB hex codes and xterm-256 color codes. diff --git a/config/theme.vim b/config/theme.vim deleted file mode 100644 index 6d483a0..0000000 --- a/config/theme.vim +++ /dev/null @@ -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()