Merge branch 'dev' of https://github.com/Donaldttt/dotfiles into dev
This commit is contained in:
+10
-9
@@ -1,22 +1,23 @@
|
|||||||
set-option -sg escape-time 10
|
set-option -sg escape-time 10
|
||||||
set-option -g default-terminal "screen-256color"
|
set-option -g default-terminal "screen-256color"
|
||||||
|
set-option -g history-limit 6000
|
||||||
|
|
||||||
set-option -sa terminal-overrides ',xterm-256color:RGB'
|
set-option -sa terminal-overrides ',xterm-256color:RGB'
|
||||||
setw -g mode-keys vi
|
setw -g mode-keys vi
|
||||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||||
bind -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||||
|
|
||||||
# vim-like pane resizing
|
# vim-like pane resizing
|
||||||
bind -r C-k resize-pane -U
|
bind-key -r C-k resize-pane -U
|
||||||
bind -r C-j resize-pane -D
|
bind-key -r C-j resize-pane -D
|
||||||
bind -r C-h resize-pane -L
|
bind-key -r C-h resize-pane -L
|
||||||
bind -r C-l resize-pane -R
|
bind-key -r C-l resize-pane -R
|
||||||
|
|
||||||
# vim-like pane switching
|
# vim-like pane switching
|
||||||
bind -n C-k select-pane -U
|
bind-key -n C-k select-pane -U
|
||||||
bind -n C-j select-pane -D
|
bind-key -n C-j select-pane -D
|
||||||
bind -n C-h select-pane -L
|
bind-key -n C-h select-pane -L
|
||||||
bind -n C-l select-pane -R
|
bind-key -n C-l select-pane -R
|
||||||
|
|
||||||
# and now unbind keys
|
# and now unbind keys
|
||||||
unbind Up
|
unbind Up
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
" Environment {
|
" Environment {
|
||||||
" get current neovim version
|
" get current neovim version
|
||||||
let g:vim_version = -1
|
let g:vim_version = -1
|
||||||
|
|
||||||
|
" dotfile location
|
||||||
|
let g:mydotfiles_directory = expand('~/.dotfiles/')
|
||||||
|
let after_directory = g:mydotfiles_directory . 'config/vi-plugs/coc-theme/after/'
|
||||||
|
|
||||||
|
" detect vim type(vim or nvim)
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
let g:vim_type = 'nvim'
|
let g:vim_type = 'nvim'
|
||||||
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
||||||
@@ -9,10 +15,19 @@
|
|||||||
let g:vim_type = 'vim'
|
let g:vim_type = 'vim'
|
||||||
let g:vim_version = matchstr(execute('version'), 'Vi IMproved \zs[^\n]*')
|
let g:vim_version = matchstr(execute('version'), 'Vi IMproved \zs[^\n]*')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" detect operating system (Windows/Linux/Darwin)
|
||||||
|
if has("win64") || has("win32") || has("win16")
|
||||||
|
let g:os = "Windows"
|
||||||
|
else
|
||||||
|
let g:os = substitute(system('uname'), '\n', '', '')
|
||||||
|
endif
|
||||||
|
|
||||||
let g:vim_version = str2float(g:vim_version)
|
let g:vim_version = str2float(g:vim_version)
|
||||||
let g:dotfile_path = '~/.dotfiles/'
|
let g:dotfile_path = '~/.dotfiles/'
|
||||||
|
|
||||||
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||||
|
execute('set runtimepath^=' . after_directory)
|
||||||
let &packpath=&runtimepath
|
let &packpath=&runtimepath
|
||||||
|
|
||||||
" The default leader is '\', but many people prefer ',' as it's in a standard
|
" The default leader is '\', but many people prefer ',' as it's in a standard
|
||||||
@@ -80,7 +95,7 @@
|
|||||||
"
|
"
|
||||||
" set tabpagemax=15 " Only show 15 tabs
|
" set tabpagemax=15 " Only show 15 tabs
|
||||||
" set showmode " Display the current mode
|
" set showmode " Display the current mode
|
||||||
set cursorline " Highlight current line
|
" set cursorline " Highlight current line
|
||||||
|
|
||||||
" get rid of current line highlight, instead just highlight the number column
|
" get rid of current line highlight, instead just highlight the number column
|
||||||
augroup CLClear
|
augroup CLClear
|
||||||
@@ -123,10 +138,12 @@
|
|||||||
|
|
||||||
"set nowrap " Do not wrap long lines
|
"set nowrap " Do not wrap long lines
|
||||||
set autoindent " Indent at the same level of the previous line
|
set autoindent " Indent at the same level of the previous line
|
||||||
set shiftwidth=4 " Use indents of 4 spaces
|
|
||||||
set expandtab " Tabs are spaces, not tabs
|
set expandtab " Tabs are spaces, not tabs
|
||||||
|
set shiftwidth=4 " Use indents of 4 spaces
|
||||||
set tabstop=4 " An indentation every four columns
|
set tabstop=4 " An indentation every four columns
|
||||||
set softtabstop=4 " Let backspace delete indent
|
set softtabstop=4 " Let backspace delete indent
|
||||||
|
autocmd FileType javascript,typescript set tabstop=2 shiftwidth=2 softtabstop=2
|
||||||
|
autocmd FileType c,cpp,python,java set tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
|
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
|
||||||
set splitright " Puts new vsplit windows to the right of the current
|
set splitright " Puts new vsplit windows to the right of the current
|
||||||
set splitbelow " Puts new split windows to the bottom of the current
|
set splitbelow " Puts new split windows to the bottom of the current
|
||||||
|
|||||||
+170
-134
@@ -18,30 +18,26 @@
|
|||||||
" Plugin_Install
|
" Plugin_Install
|
||||||
" {
|
" {
|
||||||
" Plugin environment
|
" Plugin environment
|
||||||
let config_dir = '~/.dotfiles/'
|
let g:mydotfiles_directory = expand('~/.dotfiles/')
|
||||||
let plugin_dir = '~/.vim/plugged/'
|
let s:plugin_dir = expand('~/.vim/plugged/')
|
||||||
let g:vim_dir = '~/.vim/'
|
let g:vim_dir = expand('~/.vim/')
|
||||||
|
|
||||||
call plug#begin(plugin_dir)
|
call plug#begin(s:plugin_dir)
|
||||||
|
|
||||||
" make sure to install nodejs to use coc.nvim
|
|
||||||
if executable('node')
|
|
||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
||||||
endif
|
|
||||||
|
|
||||||
Plug 'rust-lang/rust.vim'
|
|
||||||
|
|
||||||
|
"Plug 'NoahTheDuke/vim-just'
|
||||||
|
" Plug 'mbbill/undotree'
|
||||||
" {
|
" {
|
||||||
Plug 'alvan/vim-closetag'
|
" Plug 'alvan/vim-closetag'
|
||||||
let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js'
|
" let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js'
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
|
||||||
" for markdown{
|
" for markdown{
|
||||||
Plug 'preservim/vim-markdown'
|
" Plug 'preservim/vim-markdown'
|
||||||
"}
|
"}
|
||||||
|
|
||||||
|
Plug 'dstein64/vim-startuptime'
|
||||||
Plug 'simeji/winresizer'
|
Plug 'simeji/winresizer'
|
||||||
|
Plug 'rust-lang/rust.vim'
|
||||||
|
|
||||||
Plug 'tpope/vim-surround'
|
Plug 'tpope/vim-surround'
|
||||||
Plug 'rhysd/conflict-marker.vim'
|
Plug 'rhysd/conflict-marker.vim'
|
||||||
@@ -51,6 +47,7 @@
|
|||||||
|
|
||||||
"Plug 'easymotion/vim-easymotion'
|
"Plug 'easymotion/vim-easymotion'
|
||||||
Plug 'vim-scripts/restore_view.vim'
|
Plug 'vim-scripts/restore_view.vim'
|
||||||
|
Plug 'mhinz/vim-startify'
|
||||||
|
|
||||||
if executable('fzf')
|
if executable('fzf')
|
||||||
" fzf#install() makes sure that you have the latest binary, comment out because I don't want it to install binary for me
|
" fzf#install() makes sure that you have the latest binary, comment out because I don't want it to install binary for me
|
||||||
@@ -61,25 +58,32 @@
|
|||||||
|
|
||||||
Plug 'NLKNguyen/papercolor-theme'
|
Plug 'NLKNguyen/papercolor-theme'
|
||||||
Plug 'airblade/vim-rooter'
|
Plug 'airblade/vim-rooter'
|
||||||
Plug 'mbbill/undotree'
|
|
||||||
|
" Comment stuff out
|
||||||
Plug 'tpope/vim-commentary'
|
Plug 'tpope/vim-commentary'
|
||||||
|
|
||||||
" put text in neibouring tmux pane into auto complete
|
" put text in neibouring tmux pane into auto complete
|
||||||
Plug 'wellle/tmux-complete.vim'
|
Plug 'wellle/tmux-complete.vim'
|
||||||
Plug 'NoahTheDuke/vim-just'
|
|
||||||
|
|
||||||
Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp', 'vim'] }
|
Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp'] }
|
||||||
Plug 'lambdalisue/readablefold.vim'
|
Plug 'lambdalisue/readablefold.vim'
|
||||||
|
|
||||||
" only work with vim
|
" only work with vim
|
||||||
if g:vim_type == 'vim'
|
if g:vim_type == 'vim'
|
||||||
|
set encoding=UTF-8
|
||||||
Plug 'scrooloose/nerdtree'
|
Plug 'scrooloose/nerdtree'
|
||||||
|
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
|
||||||
" Plug 'tribela/vim-transparent'
|
" Plug 'tribela/vim-transparent'
|
||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
" The bottom buffer display
|
" The bottom buffer display
|
||||||
Plug 'Donaldttt/vim-bufferline'
|
Plug 'Donaldttt/vim-bufferline'
|
||||||
" Plug 'itchyny/lightline.vim'
|
Plug 'ryanoasis/vim-devicons'
|
||||||
|
Plug 'Yggdroot/indentLine'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if executable('node')
|
||||||
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" only work with nvim > 0.5
|
" only work with nvim > 0.5
|
||||||
@@ -91,7 +95,7 @@
|
|||||||
Plug 'lukas-reineke/indent-blankline.nvim'
|
Plug 'lukas-reineke/indent-blankline.nvim'
|
||||||
" nvim theme
|
" nvim theme
|
||||||
Plug 'EdenEast/nightfox.nvim'
|
Plug 'EdenEast/nightfox.nvim'
|
||||||
Plug 'projekt0n/github-nvim-theme'
|
Plug 'projekt0n/github-nvim-theme', { 'tag': 'v0.0.7' }
|
||||||
|
|
||||||
Plug 'nvim-lualine/lualine.nvim'
|
Plug 'nvim-lualine/lualine.nvim'
|
||||||
|
|
||||||
@@ -102,6 +106,7 @@
|
|||||||
" comment out this plugin if the machine doesn't have required
|
" comment out this plugin if the machine doesn't have required
|
||||||
" font install
|
" font install
|
||||||
Plug 'nvim-tree/nvim-web-devicons'
|
Plug 'nvim-tree/nvim-web-devicons'
|
||||||
|
Plug 'ziontee113/color-picker.nvim'
|
||||||
endif
|
endif
|
||||||
if g:vim_version >= 0.8
|
if g:vim_version >= 0.8
|
||||||
Plug 'nvim-tree/nvim-tree.lua'
|
Plug 'nvim-tree/nvim-tree.lua'
|
||||||
@@ -114,48 +119,84 @@
|
|||||||
call plug#end()
|
call plug#end()
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
function! HasPlug(plug_name, ...)
|
||||||
|
let plug_dir_name = get(a:, 1, a:plug_name) " optional argument for the name of plug's folder
|
||||||
|
if has_key(g:plugs, a:plug_name) && isdirectory(s:plugin_dir . "/" . plug_dir_name)
|
||||||
|
return v:true
|
||||||
|
endif
|
||||||
|
return v:false
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Plugin_Preferences
|
" Plugin_Preferences
|
||||||
" {
|
" {
|
||||||
"
|
" Yggdroot/indentLine {
|
||||||
" nvim > 0.5 or above plugin {
|
if HasPlug('indentLine')
|
||||||
|
let g:indentLine_fileTypeExclude = ['startify']
|
||||||
if g:vim_type == 'nvim'
|
|
||||||
if g:vim_version >= 0.5
|
|
||||||
" xiyaowong/nvim-transparent {
|
|
||||||
|
|
||||||
" }
|
|
||||||
|
|
||||||
" lukas-reineke/indent-blankline.nvim {
|
|
||||||
let g:indent_blankline_use_treesitter = v:true
|
|
||||||
let g:indent_blankline_show_current_context = v:true
|
|
||||||
"let g:indent_blankline_show_current_context_start = v:true
|
|
||||||
" }
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:vim_version >= 0.7
|
|
||||||
" nvim-treesitter/nvim-treesitter {
|
|
||||||
|
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
" mhinz/vim-startify {
|
||||||
|
if HasPlug("vim-startify")
|
||||||
|
if g:vim_type == 'nvim'
|
||||||
|
let buffer_str_len = (&columns - 60) / 2
|
||||||
|
let buf_str = repeat(' ', buffer_str_len)
|
||||||
|
let g:startify_custom_header = [
|
||||||
|
\ buf_str . ' __ __ ________ ______ __ __ ______ __ __ ',
|
||||||
|
\ buf_str . '| \ | \| \ / \ | \ | \| \| \ / \',
|
||||||
|
\ buf_str . '| $$\ | $$| $$$$$$$$| $$$$$$\| $$ | $$ \$$$$$$| $$\ / $$',
|
||||||
|
\ buf_str . '| $$$\| $$| $$__ | $$ | $$| $$ | $$ | $$ | $$$\ / $$$',
|
||||||
|
\ buf_str . '| $$$$\ $$| $$ \ | $$ | $$ \$$\ / $$ | $$ | $$$$\ $$$$',
|
||||||
|
\ buf_str . '| $$\$$ $$| $$$$$ | $$ | $$ \$$\ $$ | $$ | $$\$$ $$ $$',
|
||||||
|
\ buf_str . '| $$ \$$$$| $$_____ | $$__/ $$ \$$ $$ _| $$_ | $$ \$$$| $$',
|
||||||
|
\ buf_str . '| $$ \$$$| $$ \ \$$ $$ \$$$ | $$ \| $$ \$ | $$',
|
||||||
|
\ buf_str . ' \$$ \$$ \$$$$$$$$ \$$$$$$ \$ \$$$$$$ \$$ \$$',
|
||||||
|
\]
|
||||||
|
else
|
||||||
|
let buffer_str_len = (&columns - 30) / 2
|
||||||
|
let buf_str = repeat(' ', buffer_str_len)
|
||||||
|
let g:startify_custom_header = [
|
||||||
|
\ buf_str . ' __ __ ______ __ __ ',
|
||||||
|
\ buf_str . '| \ | \| \| \ / \',
|
||||||
|
\ buf_str . '| $$ | $$ \$$$$$$| $$\ / $$',
|
||||||
|
\ buf_str . '| $$ | $$ | $$ | $$$\ / $$$',
|
||||||
|
\ buf_str . ' \$$\ / $$ | $$ | $$$$\ $$$$',
|
||||||
|
\ buf_str . ' \$$\ $$ | $$ | $$\$$ $$ $$',
|
||||||
|
\ buf_str . ' \$$ $$ _| $$_ | $$ \$$$| $$',
|
||||||
|
\ buf_str . ' \$$$ | $$ \| $$ \$ | $$',
|
||||||
|
\ buf_str . ' \$ \$$$$$$ \$$ \$$',
|
||||||
|
\]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:startify_lists = [
|
||||||
|
\ { 'header': [' RECENT'], 'type': 'files' },
|
||||||
|
\ { 'header': [' SESSIONS'], 'type': 'sessions' },
|
||||||
|
\ ]
|
||||||
endif
|
endif
|
||||||
endif
|
" }
|
||||||
" }
|
"
|
||||||
|
" ryanoasis/vim-devicons {
|
||||||
|
if HasPlug("vim-devicons")
|
||||||
|
let g:webdevicons_enable_airline_statusline = 0
|
||||||
|
endif
|
||||||
|
" }
|
||||||
|
"
|
||||||
" simeji/winresizer {
|
" simeji/winresizer {
|
||||||
if isdirectory(expand(plugin_dir . "/winresizer"))
|
if HasPlug("winresizer")
|
||||||
let g:winresizer_vert_resize = 2
|
let g:winresizer_vert_resize = 2
|
||||||
let g:winresizer_horiz_resize = 2
|
let g:winresizer_horiz_resize = 2
|
||||||
nnoremap <C-w>r :WinResizerStartResize<CR>
|
nnoremap <C-w>r :WinResizerStartResize<CR>
|
||||||
endif
|
endif
|
||||||
|
" }
|
||||||
|
|
||||||
" ludovicchabant/vim-gutentags {
|
" ludovicchabant/vim-gutentags {
|
||||||
if isdirectory(expand(plugin_dir . "/vim-gutentags"))
|
if HasPlug("vim-gutentags")
|
||||||
if exists("*gutentags#statusline()")
|
if exists("*gutentags#statusline()")
|
||||||
set statusline+=%{gutentags#statusline()}
|
set statusline+=%{gutentags#statusline()}
|
||||||
endif
|
endif
|
||||||
let g:gutentags_cache_dir=g:vim_dir . '/.vimtags/'
|
let g:gutentags_cache_dir=g:vim_dir . '/.vimtags/'
|
||||||
let g:gutentags_project_root=['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout', 'src']
|
let g:gutentags_project_root=['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout', 'src']
|
||||||
endif
|
endif
|
||||||
"}
|
" }
|
||||||
|
|
||||||
" easymotion/vim-easymotion {
|
" easymotion/vim-easymotion {
|
||||||
|
|
||||||
@@ -177,7 +218,7 @@ endif
|
|||||||
" }
|
" }
|
||||||
|
|
||||||
" antoinemadec/coc-fzf {
|
" antoinemadec/coc-fzf {
|
||||||
if isdirectory(expand(plugin_dir . "/coc-fzf"))
|
if HasPlug("coc-fzf")
|
||||||
nnoremap <silent> <space><space> :<C-u>CocFzfList<CR>
|
nnoremap <silent> <space><space> :<C-u>CocFzfList<CR>
|
||||||
nnoremap <leader>o :<C-u>CocFzfList outline<CR>
|
nnoremap <leader>o :<C-u>CocFzfList outline<CR>
|
||||||
endif
|
endif
|
||||||
@@ -203,7 +244,7 @@ endif
|
|||||||
" }
|
" }
|
||||||
|
|
||||||
" airblade/vim-rooter {
|
" airblade/vim-rooter {
|
||||||
if isdirectory(expand(plugin_dir . "/vim-rooter"))
|
if HasPlug("vim-rooter")
|
||||||
let g:rooter_patterns = ['.vscode', '.git', '*.sln', 'src']
|
let g:rooter_patterns = ['.vscode', '.git', '*.sln', 'src']
|
||||||
let g:rooter_change_directory_for_non_project_files = 'current'
|
let g:rooter_change_directory_for_non_project_files = 'current'
|
||||||
let g:rooter_silent_chdir = 1
|
let g:rooter_silent_chdir = 1
|
||||||
@@ -211,17 +252,18 @@ endif
|
|||||||
" }
|
" }
|
||||||
|
|
||||||
" NerdTree {
|
" NerdTree {
|
||||||
if (g:vim_type == 'vim' || g:vim_version < 0.8) && isdirectory(expand(plugin_dir . "/nerdtree"))
|
if (g:vim_type == 'vim' || g:vim_version < 0.8) && HasPlug('nerdtree')
|
||||||
let g:NERDShutUp=1
|
let g:NERDShutUp=1
|
||||||
|
|
||||||
" work around for nerdtree bug: https://github.com/preservim/nerdtree/issues/1321
|
" work around for nerdtree bug: https://github.com/preservim/nerdtree/issues/1321
|
||||||
let g:NERDTreeMinimalMenu=1
|
let g:NERDTreeMinimalMenu = v:true
|
||||||
|
let g:NERDTreeMinimalUI = v:true
|
||||||
|
|
||||||
"nnoremap <C-e> :NERDTreeToggle<CR>
|
"nnoremap <C-e> :NERDTreeToggle<CR>
|
||||||
" nnoremap <leader>e :NERDTreeToggle<CR>
|
|
||||||
function! NERDTreeFindToggle()
|
function! NERDTreeFindToggle()
|
||||||
let my_filetype = &filetype
|
let my_filetype = &filetype
|
||||||
if my_filetype == 'nerdtree' || my_filetype == ''
|
let specical_fts = ['nerdtree', 'startify']
|
||||||
|
if my_filetype == '' || index(specical_fts, my_filetype) >= 0
|
||||||
:NERDTreeToggle
|
:NERDTreeToggle
|
||||||
else
|
else
|
||||||
:NERDTreeFind
|
:NERDTreeFind
|
||||||
@@ -243,7 +285,7 @@ endif
|
|||||||
" }
|
" }
|
||||||
|
|
||||||
" nvim-tree.lua {
|
" nvim-tree.lua {
|
||||||
if g:vim_type == 'nvim' && isdirectory(expand(plugin_dir . "/nvim-tree.lua"))
|
if g:vim_type == 'nvim' && HasPlug("nvim-tree.lua")
|
||||||
|
|
||||||
" Hide vim bottom statusline
|
" Hide vim bottom statusline
|
||||||
" autocmd FileType NvimTree setlocal noshowmode noruler laststatus=0 noshowcmd
|
" autocmd FileType NvimTree setlocal noshowmode noruler laststatus=0 noshowcmd
|
||||||
@@ -252,47 +294,29 @@ endif
|
|||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
|
|
||||||
"if has('nvim') && str2float(g:nvim_version) >= 0.5 && isdirectory(expand(plugin_dir . "/lualine.nvim"))
|
"if has('nvim') && str2float(g:nvim_version) >= 0.5 && HasPlug("lualine.nvim")
|
||||||
" nvim-lualine/lualine.nvim {
|
" nvim-lualine/lualine.nvim {
|
||||||
" }
|
" }
|
||||||
"else
|
"else
|
||||||
"
|
"
|
||||||
" itchyny/lightline.vim {
|
|
||||||
if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/lightline.vim"))
|
|
||||||
set laststatus=2
|
|
||||||
let g:lightline = {
|
|
||||||
\ 'colorscheme': 'wombat',
|
|
||||||
\ 'active': {
|
|
||||||
\ 'left': [ [ 'mode', 'paste' ],
|
|
||||||
\ [ 'buffers' ] ]
|
|
||||||
\ },
|
|
||||||
\ 'component_function': {
|
|
||||||
\ 'buffers': 'bufferline#get_echo_string'
|
|
||||||
\ },
|
|
||||||
\ }
|
|
||||||
endif
|
|
||||||
" }
|
|
||||||
"
|
|
||||||
" vim-airline {
|
" vim-airline {
|
||||||
if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/vim-airline"))
|
if g:vim_type == 'vim' && HasPlug("vim-airline")
|
||||||
" 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
|
" This must using my fork version of bufferline
|
||||||
"
|
"
|
||||||
let g:bufferline_max_length = &columns - 25
|
let g:bufferline_max_length = &columns - 22
|
||||||
function! BufferNumber()
|
function! BufferNumber()
|
||||||
return len(g:index_to_buffer)
|
return len(g:index_to_buffer)
|
||||||
endfunction
|
endfunction
|
||||||
call airline#parts#define_function('bufnum', 'BufferNumber')
|
call airline#parts#define_function('bufnum', 'BufferNumber')
|
||||||
|
|
||||||
let g:airline_section_b = ''
|
let g:airline_extensions = ['bufferline']
|
||||||
let g:airline_section_x = ''
|
let g:airline_section_x = airline#section#create(['bufnum'])
|
||||||
"let g:airline_section_gutter = ''
|
let g:airline_section_y = ''
|
||||||
let g:airline_section_y = airline#section#create(['bufnum'])
|
|
||||||
let g:airline_section_z = airline#section#create(['filetype'])
|
let g:airline_section_z = airline#section#create(['filetype'])
|
||||||
let g:airline_section_warning = ''
|
let g:airline_skip_empty_sections = 1
|
||||||
let g:airline_section_error = ''
|
|
||||||
"let g:airline_exclude_filetypes = ['nerdtree'] " see source for current list
|
"let g:airline_exclude_filetypes = ['nerdtree'] " see source for current list
|
||||||
let g:airline#extensions#nerdtree_statusline = 0
|
let g:airline#extensions#nerdtree_statusline = 0
|
||||||
"let g:airline#extensions#bufferline#overwrite_variables = 0
|
"let g:airline#extensions#bufferline#overwrite_variables = 0
|
||||||
@@ -316,7 +340,7 @@ endif
|
|||||||
\ 'V' : 'V',
|
\ 'V' : 'V',
|
||||||
\ '' : 'V',
|
\ '' : 'V',
|
||||||
\ }
|
\ }
|
||||||
if isdirectory(expand(plugin_dir . "/vim-airline-themes/"))
|
if HasPlug("vim-airline-themes/")
|
||||||
"let g:airline_theme = 'solarized'
|
"let g:airline_theme = 'solarized'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -331,7 +355,11 @@ endif
|
|||||||
|
|
||||||
" - Preview window on the right with 50% width
|
" - Preview window on the right with 50% width
|
||||||
" - CTRL-/ will toggle preview window.
|
" - CTRL-/ will toggle preview window.
|
||||||
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
|
if g:os == 'Windows'
|
||||||
|
let g:fzf_preview_window = []
|
||||||
|
else
|
||||||
|
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
" check if ripgrep is installed
|
" check if ripgrep is installed
|
||||||
@@ -346,19 +374,12 @@ endif
|
|||||||
" }
|
" }
|
||||||
|
|
||||||
" neoclide/coc.nvim {
|
" neoclide/coc.nvim {
|
||||||
if isdirectory(expand(plugin_dir . "/coc.nvim/")) && executable('node')
|
if HasPlug("coc.nvim") && executable('node')
|
||||||
" add desired extensions to the following global variable
|
" add desired extensions to the following global variable
|
||||||
" coc-tsserver: javascript
|
|
||||||
" coc-pyright: python
|
|
||||||
" coc-clangd: c/c++, may need to install clangd seperatly
|
" coc-clangd: c/c++, may need to install clangd seperatly
|
||||||
let g:coc_global_extensions = ['coc-pyright', 'coc-rls', 'coc-clangd', 'coc-tsserver', 'coc-html', 'coc-cmake', 'coc-json', 'coc-sh', 'coc-java']
|
|
||||||
|
|
||||||
let g:coc_user_config = {
|
if filereadable(g:mydotfiles_directory . "/coc-nvim-config.vim")
|
||||||
\ 'suggest.noselect': v:true,
|
exec "source " . g:mydotfiles_directory . "/coc-nvim-config.vim"
|
||||||
\ 'suggest.enablePreselect': v:false }
|
|
||||||
|
|
||||||
if filereadable(expand(config_dir . "/.exp-coc-config"))
|
|
||||||
exec "source " . config_dir . "/.exp-coc-config"
|
|
||||||
endif
|
endif
|
||||||
" warning that coc work best for vim >= 8.3
|
" warning that coc work best for vim >= 8.3
|
||||||
let g:coc_disable_startup_warning = 1
|
let g:coc_disable_startup_warning = 1
|
||||||
@@ -387,7 +408,7 @@ endif
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" dark or light
|
" dark or light
|
||||||
if filereadable(expand(g:vim_dir . '.light_theme.signal'))
|
if filereadable(g:vim_dir . '.light_theme.signal')
|
||||||
let g:dark_or_white_theme = 'light'
|
let g:dark_or_white_theme = 'light'
|
||||||
else
|
else
|
||||||
let g:dark_or_white_theme = 'dark'
|
let g:dark_or_white_theme = 'dark'
|
||||||
@@ -407,10 +428,10 @@ endif
|
|||||||
" exist and set respect variable
|
" exist and set respect variable
|
||||||
let g:transparent_dark_theme = v:false
|
let g:transparent_dark_theme = v:false
|
||||||
let g:transparent_light_theme = v:false
|
let g:transparent_light_theme = v:false
|
||||||
if filereadable(expand(g:vim_dir . '.transparent_dark_theme.signal'))
|
if filereadable(g:vim_dir . '.transparent_dark_theme.signal')
|
||||||
let g:transparent_dark_theme = v:true
|
let g:transparent_dark_theme = v:true
|
||||||
endif
|
endif
|
||||||
if filereadable(expand(g:vim_dir . '.transparent_light_theme.signal'))
|
if filereadable(g:vim_dir . '.transparent_light_theme.signal')
|
||||||
let g:transparent_light_theme = v:true
|
let g:transparent_light_theme = v:true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -441,26 +462,29 @@ endif
|
|||||||
" Fix colorscheme not working correctly under transparent background
|
" Fix colorscheme not working correctly under transparent background
|
||||||
" There is no plugin for this for nvim < 0.5 or vim without lua support
|
" There is no plugin for this for nvim < 0.5 or vim without lua support
|
||||||
function! TransparentBackgroundFix()
|
function! TransparentBackgroundFix()
|
||||||
"if !has('nvim') || g:vim_version < 0.5
|
if !has('nvim') || g:vim_version < 0.5
|
||||||
if v:true
|
" if v:true
|
||||||
"if v:false
|
" if v:true
|
||||||
|
highlight CursorLineNr ctermbg=none
|
||||||
highlight SignColumn ctermbg=none
|
highlight SignColumn ctermbg=none
|
||||||
"highlight CursorLineNr ctermbg=none
|
if v:false
|
||||||
highlight CocWarningHighlight ctermbg=none
|
"highlight CursorLineNr ctermbg=none
|
||||||
highlight CocErrorSign ctermbg=none ctermfg=9 cterm=bold
|
highlight CocWarningHighlight ctermbg=none
|
||||||
highlight CocErrorHighlight ctermbg=none ctermfg=9 cterm=underline,bold
|
highlight CocErrorSign ctermbg=none ctermfg=9 cterm=bold
|
||||||
highlight CocInfoHighlight ctermbg=none
|
highlight CocErrorHighlight ctermbg=none ctermfg=9 cterm=underline,bold
|
||||||
highlight CocHintHighlight ctermbg=none
|
highlight CocInfoHighlight ctermbg=none
|
||||||
highlight CocWarningSign ctermbg=none
|
highlight CocHintHighlight ctermbg=none
|
||||||
highlight CocInfoSign ctermbg=none
|
highlight CocWarningSign ctermbg=none
|
||||||
highlight CocHintSign ctermbg=none
|
highlight CocInfoSign ctermbg=none
|
||||||
if g:dark_or_white_theme == 'dark'
|
highlight CocHintSign ctermbg=none
|
||||||
highlight! link TempColor Visual
|
if g:dark_or_white_theme == 'dark'
|
||||||
highlight! link CocFloating TempColor
|
highlight! link TempColor Visual
|
||||||
highlight! link CocErrorFloat TempColor
|
highlight! link CocFloating TempColor
|
||||||
highlight! link CocWarningFloat TempColor
|
highlight! link CocErrorFloat TempColor
|
||||||
highlight! link CocInfoFloat TempColor
|
highlight! link CocWarningFloat TempColor
|
||||||
highlight! link CocHintFloat TempColor
|
highlight! link CocInfoFloat TempColor
|
||||||
|
highlight! link CocHintFloat TempColor
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -489,6 +513,7 @@ endif
|
|||||||
execute("colorscheme " . g:light_theme)
|
execute("colorscheme " . g:light_theme)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
call TransparentBackgroundFix()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! DisableTransparent()
|
function! DisableTransparent()
|
||||||
@@ -519,8 +544,8 @@ endif
|
|||||||
|
|
||||||
" delete signal file if exist
|
" delete signal file if exist
|
||||||
function! DeleteSignalFile(name)
|
function! DeleteSignalFile(name)
|
||||||
if filereadable(expand(g:vim_dir . a:name))
|
if filereadable(g:vim_dir . a:name)
|
||||||
call delete(expand(g:vim_dir . a:name))
|
call delete(g:vim_dir . a:name)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -550,12 +575,11 @@ endif
|
|||||||
call CreateSignalFile('.transparent_light_theme.signal')
|
call CreateSignalFile('.transparent_light_theme.signal')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
call TransparentBackgroundFix()
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" vim theme
|
" vim theme
|
||||||
if !has('nvim') && isdirectory(expand(plugin_dir . "/papercolor-theme"))
|
if !has('nvim') && HasPlug("papercolor-theme") && HasPlug('papercolor-theme')
|
||||||
set t_Co=256
|
set t_Co=256
|
||||||
" improve coc color in this theme
|
" improve coc color in this theme
|
||||||
let g:light_theme = 'PaperColor'
|
let g:light_theme = 'PaperColor'
|
||||||
@@ -566,13 +590,15 @@ endif
|
|||||||
|
|
||||||
" nvim only theme
|
" nvim only theme
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
if g:vim_version >= 0.8 && isdirectory(expand(plugin_dir . "/nightfox.nvim"))
|
if g:vim_version >= 0.8 && HasPlug("nightfox.nvim")
|
||||||
let g:light_theme = 'dawnfox'
|
let g:light_theme = 'dawnfox'
|
||||||
"let g:dark_theme = 'nightfox'
|
"let g:dark_theme = 'nightfox'
|
||||||
end
|
end
|
||||||
|
|
||||||
if g:vim_version >= 0.5 && isdirectory(expand(plugin_dir . "/github-nvim-theme"))
|
if g:vim_version >= 0.5 && HasPlug("/github-nvim-theme")
|
||||||
let g:dark_theme = 'github_dark'
|
let g:dark_theme = 'github_dark'
|
||||||
|
" let g:dark_theme = 'github_dark_default'
|
||||||
|
" let g:dark_theme = 'github_dimmed'
|
||||||
let g:airline_dark_theme = "hybrid"
|
let g:airline_dark_theme = "hybrid"
|
||||||
end
|
end
|
||||||
endif
|
endif
|
||||||
@@ -588,12 +614,13 @@ endif
|
|||||||
|
|
||||||
" Since in .vimrc we cannot call plugin function as they
|
" Since in .vimrc we cannot call plugin function as they
|
||||||
" are not loaded (:help startup)
|
" are not loaded (:help startup)
|
||||||
if g:transparent_dark_theme && g:dark_or_white_theme == 'dark' || g:transparent_light_theme && g:dark_or_white_theme == 'light'
|
if (g:transparent_dark_theme && g:dark_or_white_theme == 'dark') || (g:transparent_light_theme && g:dark_or_white_theme == 'light')
|
||||||
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
let g:transparent_enabled = v:true
|
let g:transparent_enabled = v:true
|
||||||
else
|
else
|
||||||
call EnableTransparent()
|
call EnableTransparent()
|
||||||
endif
|
endif
|
||||||
|
call TransparentBackgroundFix()
|
||||||
else
|
else
|
||||||
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
let g:transparent_enabled = v:false
|
let g:transparent_enabled = v:false
|
||||||
@@ -602,7 +629,6 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call TransparentBackgroundFix()
|
|
||||||
" Allow to trigger background
|
" Allow to trigger background
|
||||||
function! ToggleBG()
|
function! ToggleBG()
|
||||||
" Inversion
|
" Inversion
|
||||||
@@ -622,7 +648,6 @@ endif
|
|||||||
else
|
else
|
||||||
call DisableTransparent()
|
call DisableTransparent()
|
||||||
endif
|
endif
|
||||||
call TransparentBackgroundFix()
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }
|
" }
|
||||||
@@ -657,32 +682,43 @@ endif
|
|||||||
" nnoremap <Leader>7 :b7<CR>
|
" nnoremap <Leader>7 :b7<CR>
|
||||||
" nnoremap <Leader>8 :b8<CR>
|
" nnoremap <Leader>8 :b8<CR>
|
||||||
" nnoremap <Leader>9 :b9<CR>
|
" nnoremap <Leader>9 :b9<CR>
|
||||||
nnoremap <nowait> <Leader>1 :call bufferline#jump(1)<CR>
|
nnoremap <silent> <nowait> <Leader>1 :call bufferline#jump(1)<CR>
|
||||||
nnoremap <nowait> <Leader>2 :call bufferline#jump(2)<CR>
|
nnoremap <silent> <nowait> <Leader>2 :call bufferline#jump(2)<CR>
|
||||||
nnoremap <nowait> <Leader>3 :call bufferline#jump(3)<CR>
|
nnoremap <silent> <nowait> <Leader>3 :call bufferline#jump(3)<CR>
|
||||||
nnoremap <nowait> <Leader>4 :call bufferline#jump(4)<CR>
|
nnoremap <silent> <nowait> <Leader>4 :call bufferline#jump(4)<CR>
|
||||||
nnoremap <nowait> <Leader>5 :call bufferline#jump(5)<CR>
|
nnoremap <silent> <nowait> <Leader>5 :call bufferline#jump(5)<CR>
|
||||||
nnoremap <nowait> <Leader>6 :call bufferline#jump(6)<CR>
|
nnoremap <silent> <nowait> <Leader>6 :call bufferline#jump(6)<CR>
|
||||||
nnoremap <nowait> <Leader>7 :call bufferline#jump(7)<CR>
|
nnoremap <silent> <nowait> <Leader>7 :call bufferline#jump(7)<CR>
|
||||||
nnoremap <nowait> <Leader>8 :call bufferline#jump(8)<CR>
|
nnoremap <silent> <nowait> <Leader>8 :call bufferline#jump(8)<CR>
|
||||||
nnoremap <nowait> <Leader>9 :call bufferline#jump(9)<CR>
|
nnoremap <silent> <nowait> <Leader>9 :call bufferline#jump(9)<CR>
|
||||||
nnoremap <nowait> <Space>10 :call bufferline#jump(10)<CR>
|
nnoremap <silent> <nowait> <Space>10 :call bufferline#jump(10)<CR>
|
||||||
nnoremap <nowait> <Space>11 :call bufferline#jump(11)<CR>
|
nnoremap <silent> <nowait> <Space>11 :call bufferline#jump(11)<CR>
|
||||||
nnoremap <nowait> <Space>12 :call bufferline#jump(12)<CR>
|
nnoremap <silent> <nowait> <Space>12 :call bufferline#jump(12)<CR>
|
||||||
nnoremap <nowait> <Space>13 :call bufferline#jump(13)<CR>
|
nnoremap <silent> <nowait> <Space>13 :call bufferline#jump(13)<CR>
|
||||||
end
|
end
|
||||||
|
|
||||||
" split window comform with other window management shortcuts
|
" split window comform with other window management shortcuts
|
||||||
nnoremap <silent> <C-w>% :vsplit<CR>
|
nnoremap <silent> <C-w>% :vsplit<CR>
|
||||||
nnoremap <silent> <C-w>" :split<CR>
|
nnoremap <silent> <C-w>" :split<CR>
|
||||||
|
|
||||||
|
" session related KeyBinding. These KeyBinding uses function from startify
|
||||||
|
nnoremap <silent> <leader><leader>s :SSave<CR>
|
||||||
|
nnoremap <silent> <leader><leader>l :SLoad<CR>
|
||||||
|
nnoremap <silent> <leader><leader>d :SDelete!<CR>
|
||||||
|
nnoremap <silent> <leader><leader>c :SClose<CR>
|
||||||
|
|
||||||
" }
|
" }
|
||||||
"
|
"
|
||||||
" Lua configuration
|
" Lua configuration
|
||||||
if g:vim_type == 'nvim' && filereadable(expand(g:dotfile_path . '.vimrc.lua'))
|
if g:vim_type == 'nvim' && filereadable(g:mydotfiles_directory . '.vimrc.lua')
|
||||||
execute('source ' . g:dotfile_path . '/.vimrc.lua')
|
execute('source ' . g:mydotfiles_directory . '/.vimrc.lua')
|
||||||
endif
|
endif
|
||||||
"
|
"
|
||||||
" Useful_Info{
|
" Useful_Info{
|
||||||
" show mapping info
|
" show mapping info
|
||||||
" :verbose map ,cf
|
" :verbose map ,cf
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
if filereadable(g:mydotfiles_directory . "/config/theme.vim")
|
||||||
|
exec "source " . g:mydotfiles_directory . "/config/theme.vim"
|
||||||
|
endif
|
||||||
|
|||||||
+72
-35
@@ -1,41 +1,58 @@
|
|||||||
vim_version = vim.version()
|
local vim_version = vim.version()
|
||||||
vim_version_minor = vim_version['minor']
|
local vim_version_minor = vim_version['minor']
|
||||||
|
|
||||||
-- debug
|
-- debug
|
||||||
-- print(vim.inspect(version))
|
-- print(vim.inspect(version))
|
||||||
|
--
|
||||||
if vim_version_minor >= 5 then
|
local function github_theme_config()
|
||||||
|
-- Example config in Lua
|
||||||
require("transparent").setup({
|
require("github-theme").setup({
|
||||||
enable = true, -- boolean: enable transparent
|
-- Overwrite the highlight groups
|
||||||
extra_groups = { -- table/string: additional groups that should be cleared
|
overrides = function(c)
|
||||||
-- In particular, when you set it to 'all', that means all available groups
|
return {
|
||||||
|
NormalFloat = { link = 'Pmenu' },
|
||||||
"NvimTreeNormal",
|
}
|
||||||
"VertSplit",
|
end
|
||||||
},
|
|
||||||
exclude = {}, -- table: groups you don't want to clear
|
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim_version_minor >= 7 then
|
local function color_picker_nvim_config()
|
||||||
|
-- config for ziontee113/color-picker.nvim
|
||||||
require('nvim-treesitter.configs').setup {
|
require("color-picker").setup({
|
||||||
-- ensure_installed = { "c", "bash", "lua" },
|
["keymap"] = { -- mapping example:
|
||||||
sync_install = false,
|
["U"] = "<Plug>ColorPickerSlider5Decrease",
|
||||||
auto_install = true,
|
["O"] = "<Plug>ColorPickerSlider5Increase",
|
||||||
-- ignore_install = { "javascript" },
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
},
|
},
|
||||||
|
})
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
vim.keymap.set("n", "cp", "<cmd>PickColor<cr>", opts)
|
||||||
|
-- vim.keymap.set("i", "<C-u>c", "<cmd>PickColorInsert<cr>", opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function indent_blankline_config()
|
||||||
|
-- Example config in Lua
|
||||||
|
require("indent_blankline").setup {
|
||||||
|
show_current_context = true,
|
||||||
|
filetype_exclude = { "lspinfo", "packer", "checkhealth", "help", "man", "", "startify",}
|
||||||
|
-- use_treesitter = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim_version_minor >= 5 then
|
local function transparent_config()
|
||||||
|
require("transparent").setup({
|
||||||
|
enable = true, -- boolean: enable transparent
|
||||||
|
extra_groups = { -- table/string: additional groups that should be cleared
|
||||||
|
-- In particular, when you set it to 'all', that means all available groups
|
||||||
|
"NvimTreeNormal",
|
||||||
|
"VertSplit",
|
||||||
|
},
|
||||||
|
exclude = {}, -- table: groups you don't want to clear
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lualine_config()
|
||||||
for i=1,9 do
|
for i=1,9 do
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>'..i, ':LualineBuffersJump '..i..'<CR>', { noremap = true, silent = true, nowait = true })
|
vim.api.nvim_set_keymap('n', '<Leader>'..i, ':LualineBuffersJump '..i..'<CR>', { noremap = true, silent = true, nowait = true })
|
||||||
-- :nnoremap <silent> <Leader>1 :LualineBuffersJump 1<CR>
|
-- :nnoremap <silent> <Leader>1 :LualineBuffersJump 1<CR>
|
||||||
@@ -54,7 +71,6 @@ if vim_version_minor >= 5 then
|
|||||||
'NvimTree'
|
'NvimTree'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
require('lualine').setup {
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
theme = 'auto', -- lualine theme
|
theme = 'auto', -- lualine theme
|
||||||
@@ -96,13 +112,22 @@ if vim_version_minor >= 5 then
|
|||||||
lualine_z = {'encoding', 'location'}
|
lualine_z = {'encoding', 'location'}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim_version_minor >= 8 then
|
local function nvim_treesitter_config()
|
||||||
-- nvim-tree configuration
|
require('nvim-treesitter.configs').setup {
|
||||||
--
|
-- ensure_installed = { "c", "bash", "lua" },
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = true,
|
||||||
|
-- ignore_install = { "javascript" },
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function nvim_tree_config()
|
||||||
-- disable netrw at the very start of your init.lua (strongly advised)
|
-- disable netrw at the very start of your init.lua (strongly advised)
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
@@ -144,8 +169,20 @@ if vim_version_minor >= 8 then
|
|||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeFindFileToggle<CR>', { noremap = true, silent = true })
|
vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeFindFileToggle<CR>', { noremap = true, silent = true })
|
||||||
|
|
||||||
--
|
|
||||||
-- nvim-tree configuration end
|
|
||||||
--
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if vim_version_minor >= 5 then
|
||||||
|
transparent_config()
|
||||||
|
lualine_config()
|
||||||
|
github_theme_config()
|
||||||
|
indent_blankline_config()
|
||||||
|
end
|
||||||
|
if vim_version_minor >= 7 then
|
||||||
|
nvim_treesitter_config()
|
||||||
|
color_picker_nvim_config()
|
||||||
|
-- lsp_zero_config()
|
||||||
|
end
|
||||||
|
if vim_version_minor >= 8 then
|
||||||
|
nvim_tree_config()
|
||||||
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,9 @@
|
|||||||
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
|
|
||||||
" unicode characters in the file autoload/float.vim
|
|
||||||
" set encoding=utf-8
|
|
||||||
|
|
||||||
" TextEdit might fail if hidden is not set.
|
" let g:coc_global_extensions = ['coc-pyright', 'coc-rls', 'coc-clangd', 'coc-tsserver', 'coc-html', 'coc-cmake', 'coc-json', 'coc-sh', 'coc-java']
|
||||||
set hidden
|
let g:coc_global_extensions = ['coc-pyright', 'coc-tsserver']
|
||||||
|
|
||||||
" Some servers have issues with backup files, see #649.
|
let g:coc_data_home = g:vim_dir . '/coc'
|
||||||
set nobackup
|
let g:coc_config_home = g:vim_dir . '/coc'
|
||||||
set nowritebackup
|
|
||||||
|
|
||||||
" Give more space for displaying messages.
|
|
||||||
"set cmdheight=2
|
|
||||||
|
|
||||||
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
|
||||||
" delays and poor user experience.
|
|
||||||
set updatetime=2000
|
|
||||||
|
|
||||||
" Don't pass messages to |ins-completion-menu|.
|
|
||||||
set shortmess+=c
|
|
||||||
|
|
||||||
" Always show the signcolumn, otherwise it would shift the text each time
|
|
||||||
" diagnostics appear/become resolved.
|
|
||||||
"set signcolumn=yes
|
|
||||||
|
|
||||||
" Use <c-space> to trigger completion.
|
" Use <c-space> to trigger completion.
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
@@ -30,16 +12,13 @@ else
|
|||||||
inoremap <silent><expr> <c-@> coc#refresh()
|
inoremap <silent><expr> <c-@> coc#refresh()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
set updatetime=300
|
||||||
|
|
||||||
" Make <CR> auto-select the first completion item and notify coc.nvim to
|
" Make <CR> auto-select the first completion item and notify coc.nvim to
|
||||||
" format on enter, <cr> could be remapped by other vim plugin
|
" format on enter, <cr> could be remapped by other vim plugin
|
||||||
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
||||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||||
|
|
||||||
" Use `[g` and `]g` to navigate diagnostics
|
|
||||||
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
|
||||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
||||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
||||||
|
|
||||||
" GoTo code navigation.
|
" GoTo code navigation.
|
||||||
nmap <silent> gd <Plug>(coc-definition)
|
nmap <silent> gd <Plug>(coc-definition)
|
||||||
nmap <silent> gy <Plug>(coc-type-definition)
|
nmap <silent> gy <Plug>(coc-type-definition)
|
||||||
@@ -57,8 +36,6 @@ function! s:show_documentation()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Highlight the symbol and its references when holding the cursor.
|
|
||||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
|
||||||
|
|
||||||
" Symbol renaming.
|
" Symbol renaming.
|
||||||
nmap <leader>rn <Plug>(coc-rename)
|
nmap <leader>rn <Plug>(coc-rename)
|
||||||
@@ -75,30 +52,9 @@ augroup mygroup
|
|||||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||||
augroup end
|
augroup end
|
||||||
|
|
||||||
" Applying codeAction to the selected region.
|
|
||||||
" Example: `<leader>aap` for current paragraph
|
|
||||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
|
||||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
|
||||||
|
|
||||||
" Remap keys for applying codeAction to the current buffer.
|
|
||||||
nmap <leader>ac <Plug>(coc-codeaction)
|
|
||||||
" Apply AutoFix to problem on the current line.
|
" Apply AutoFix to problem on the current line.
|
||||||
nmap <leader>qf <Plug>(coc-fix-current)
|
nmap <leader>qf <Plug>(coc-fix-current)
|
||||||
|
|
||||||
" Run the Code Lens action on the current line.
|
|
||||||
nmap <leader>cl <Plug>(coc-codelens-action)
|
|
||||||
|
|
||||||
" Map function and class text objects
|
|
||||||
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
|
||||||
xmap if <Plug>(coc-funcobj-i)
|
|
||||||
omap if <Plug>(coc-funcobj-i)
|
|
||||||
xmap af <Plug>(coc-funcobj-a)
|
|
||||||
omap af <Plug>(coc-funcobj-a)
|
|
||||||
xmap ic <Plug>(coc-classobj-i)
|
|
||||||
omap ic <Plug>(coc-classobj-i)
|
|
||||||
xmap ac <Plug>(coc-classobj-a)
|
|
||||||
omap ac <Plug>(coc-classobj-a)
|
|
||||||
|
|
||||||
" Remap <C-f> and <C-b> for scroll float windows/popups.
|
" Remap <C-f> and <C-b> for scroll float windows/popups.
|
||||||
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||||
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||||
@@ -109,25 +65,6 @@ if has('nvim-0.4.0') || has('patch-8.2.0750')
|
|||||||
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Use CTRL-S for selections ranges.
|
|
||||||
" Requires 'textDocument/selectionRange' support of language server.
|
|
||||||
nmap <silent> <C-s> <Plug>(coc-range-select)
|
|
||||||
xmap <silent> <C-s> <Plug>(coc-range-select)
|
|
||||||
|
|
||||||
" Add `:Format` command to format current buffer.
|
|
||||||
command! -nargs=0 Format :call CocActionAsync('format')
|
|
||||||
|
|
||||||
" Add `:Fold` command to fold current buffer.
|
|
||||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
|
||||||
|
|
||||||
" Add `:OR` command for organize imports of the current buffer.
|
|
||||||
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
|
|
||||||
|
|
||||||
" Add (Neo)Vim's native statusline support.
|
|
||||||
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
|
||||||
" provide custom statusline: lightline.vim, vim-airline.
|
|
||||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
|
||||||
|
|
||||||
" Mappings for CoCList
|
" Mappings for CoCList
|
||||||
" Show all diagnostics.
|
" Show all diagnostics.
|
||||||
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||||
@@ -145,3 +82,13 @@ nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
|||||||
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||||
" Resume latest coc list.
|
" Resume latest coc list.
|
||||||
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||||
|
|
||||||
|
"COC LSP SETTING
|
||||||
|
let g:coc_user_config = {
|
||||||
|
\ 'suggest.noselect': v:true,
|
||||||
|
\ 'suggest.enablePreselect': v:false, }
|
||||||
|
|
||||||
|
call coc#config("java.jdt.ls.vmargs", '-javaagent:' . g:mydotfiles_directory . '/config/coc/java/lombok-1.18.26.jar')
|
||||||
|
call coc#config("java.jdt.ls.lombokSupport.enabled", v:false)
|
||||||
|
call coc#config("java.inlayHints.parameterNames.enabled", v:false)
|
||||||
|
call coc#config("inlayHint.enable", v:false)
|
||||||
Binary file not shown.
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"suggest.noselect": true,
|
|
||||||
"suggest.enablePreselect": false
|
|
||||||
}
|
|
||||||
Executable
+376
@@ -0,0 +1,376 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
|
||||||
|
""" Convert values between RGB hex codes and xterm-256 color codes.
|
||||||
|
|
||||||
|
Nice long listing of all 256 colors and their codes. Useful for
|
||||||
|
developing console color themes, or even script output schemes.
|
||||||
|
|
||||||
|
Resources:
|
||||||
|
* http://en.wikipedia.org/wiki/8-bit_color
|
||||||
|
* http://en.wikipedia.org/wiki/ANSI_escape_code
|
||||||
|
* /usr/share/X11/rgb.txt
|
||||||
|
|
||||||
|
I'm not sure where this script was inspired from. I think I must have
|
||||||
|
written it from scratch, though it's been several years now.
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = 'Micah Elliott http://MicahElliott.com'
|
||||||
|
__version__ = '0.1'
|
||||||
|
__copyright__ = 'Copyright (C) 2011 Micah Elliott. All rights reserved.'
|
||||||
|
__license__ = 'WTFPL http://sam.zoy.org/wtfpl/'
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
|
import sys, re
|
||||||
|
|
||||||
|
CLUT = [ # color look-up table
|
||||||
|
# 8-bit, RGB hex
|
||||||
|
|
||||||
|
# Primary 3-bit (8 colors). Unique representation!
|
||||||
|
('00', '000000'),
|
||||||
|
('01', '800000'),
|
||||||
|
('02', '008000'),
|
||||||
|
('03', '808000'),
|
||||||
|
('04', '000080'),
|
||||||
|
('05', '800080'),
|
||||||
|
('06', '008080'),
|
||||||
|
('07', 'c0c0c0'),
|
||||||
|
|
||||||
|
# Equivalent "bright" versions of original 8 colors.
|
||||||
|
('08', '808080'),
|
||||||
|
('09', 'ff0000'),
|
||||||
|
('10', '00ff00'),
|
||||||
|
('11', 'ffff00'),
|
||||||
|
('12', '0000ff'),
|
||||||
|
('13', 'ff00ff'),
|
||||||
|
('14', '00ffff'),
|
||||||
|
('15', 'ffffff'),
|
||||||
|
|
||||||
|
# Strictly ascending.
|
||||||
|
('16', '000000'),
|
||||||
|
('17', '00005f'),
|
||||||
|
('18', '000087'),
|
||||||
|
('19', '0000af'),
|
||||||
|
('20', '0000d7'),
|
||||||
|
('21', '0000ff'),
|
||||||
|
('22', '005f00'),
|
||||||
|
('23', '005f5f'),
|
||||||
|
('24', '005f87'),
|
||||||
|
('25', '005faf'),
|
||||||
|
('26', '005fd7'),
|
||||||
|
('27', '005fff'),
|
||||||
|
('28', '008700'),
|
||||||
|
('29', '00875f'),
|
||||||
|
('30', '008787'),
|
||||||
|
('31', '0087af'),
|
||||||
|
('32', '0087d7'),
|
||||||
|
('33', '0087ff'),
|
||||||
|
('34', '00af00'),
|
||||||
|
('35', '00af5f'),
|
||||||
|
('36', '00af87'),
|
||||||
|
('37', '00afaf'),
|
||||||
|
('38', '00afd7'),
|
||||||
|
('39', '00afff'),
|
||||||
|
('40', '00d700'),
|
||||||
|
('41', '00d75f'),
|
||||||
|
('42', '00d787'),
|
||||||
|
('43', '00d7af'),
|
||||||
|
('44', '00d7d7'),
|
||||||
|
('45', '00d7ff'),
|
||||||
|
('46', '00ff00'),
|
||||||
|
('47', '00ff5f'),
|
||||||
|
('48', '00ff87'),
|
||||||
|
('49', '00ffaf'),
|
||||||
|
('50', '00ffd7'),
|
||||||
|
('51', '00ffff'),
|
||||||
|
('52', '5f0000'),
|
||||||
|
('53', '5f005f'),
|
||||||
|
('54', '5f0087'),
|
||||||
|
('55', '5f00af'),
|
||||||
|
('56', '5f00d7'),
|
||||||
|
('57', '5f00ff'),
|
||||||
|
('58', '5f5f00'),
|
||||||
|
('59', '5f5f5f'),
|
||||||
|
('60', '5f5f87'),
|
||||||
|
('61', '5f5faf'),
|
||||||
|
('62', '5f5fd7'),
|
||||||
|
('63', '5f5fff'),
|
||||||
|
('64', '5f8700'),
|
||||||
|
('65', '5f875f'),
|
||||||
|
('66', '5f8787'),
|
||||||
|
('67', '5f87af'),
|
||||||
|
('68', '5f87d7'),
|
||||||
|
('69', '5f87ff'),
|
||||||
|
('70', '5faf00'),
|
||||||
|
('71', '5faf5f'),
|
||||||
|
('72', '5faf87'),
|
||||||
|
('73', '5fafaf'),
|
||||||
|
('74', '5fafd7'),
|
||||||
|
('75', '5fafff'),
|
||||||
|
('76', '5fd700'),
|
||||||
|
('77', '5fd75f'),
|
||||||
|
('78', '5fd787'),
|
||||||
|
('79', '5fd7af'),
|
||||||
|
('80', '5fd7d7'),
|
||||||
|
('81', '5fd7ff'),
|
||||||
|
('82', '5fff00'),
|
||||||
|
('83', '5fff5f'),
|
||||||
|
('84', '5fff87'),
|
||||||
|
('85', '5fffaf'),
|
||||||
|
('86', '5fffd7'),
|
||||||
|
('87', '5fffff'),
|
||||||
|
('88', '870000'),
|
||||||
|
('89', '87005f'),
|
||||||
|
('90', '870087'),
|
||||||
|
('91', '8700af'),
|
||||||
|
('92', '8700d7'),
|
||||||
|
('93', '8700ff'),
|
||||||
|
('94', '875f00'),
|
||||||
|
('95', '875f5f'),
|
||||||
|
('96', '875f87'),
|
||||||
|
('97', '875faf'),
|
||||||
|
('98', '875fd7'),
|
||||||
|
('99', '875fff'),
|
||||||
|
('100', '878700'),
|
||||||
|
('101', '87875f'),
|
||||||
|
('102', '878787'),
|
||||||
|
('103', '8787af'),
|
||||||
|
('104', '8787d7'),
|
||||||
|
('105', '8787ff'),
|
||||||
|
('106', '87af00'),
|
||||||
|
('107', '87af5f'),
|
||||||
|
('108', '87af87'),
|
||||||
|
('109', '87afaf'),
|
||||||
|
('110', '87afd7'),
|
||||||
|
('111', '87afff'),
|
||||||
|
('112', '87d700'),
|
||||||
|
('113', '87d75f'),
|
||||||
|
('114', '87d787'),
|
||||||
|
('115', '87d7af'),
|
||||||
|
('116', '87d7d7'),
|
||||||
|
('117', '87d7ff'),
|
||||||
|
('118', '87ff00'),
|
||||||
|
('119', '87ff5f'),
|
||||||
|
('120', '87ff87'),
|
||||||
|
('121', '87ffaf'),
|
||||||
|
('122', '87ffd7'),
|
||||||
|
('123', '87ffff'),
|
||||||
|
('124', 'af0000'),
|
||||||
|
('125', 'af005f'),
|
||||||
|
('126', 'af0087'),
|
||||||
|
('127', 'af00af'),
|
||||||
|
('128', 'af00d7'),
|
||||||
|
('129', 'af00ff'),
|
||||||
|
('130', 'af5f00'),
|
||||||
|
('131', 'af5f5f'),
|
||||||
|
('132', 'af5f87'),
|
||||||
|
('133', 'af5faf'),
|
||||||
|
('134', 'af5fd7'),
|
||||||
|
('135', 'af5fff'),
|
||||||
|
('136', 'af8700'),
|
||||||
|
('137', 'af875f'),
|
||||||
|
('138', 'af8787'),
|
||||||
|
('139', 'af87af'),
|
||||||
|
('140', 'af87d7'),
|
||||||
|
('141', 'af87ff'),
|
||||||
|
('142', 'afaf00'),
|
||||||
|
('143', 'afaf5f'),
|
||||||
|
('144', 'afaf87'),
|
||||||
|
('145', 'afafaf'),
|
||||||
|
('146', 'afafd7'),
|
||||||
|
('147', 'afafff'),
|
||||||
|
('148', 'afd700'),
|
||||||
|
('149', 'afd75f'),
|
||||||
|
('150', 'afd787'),
|
||||||
|
('151', 'afd7af'),
|
||||||
|
('152', 'afd7d7'),
|
||||||
|
('153', 'afd7ff'),
|
||||||
|
('154', 'afff00'),
|
||||||
|
('155', 'afff5f'),
|
||||||
|
('156', 'afff87'),
|
||||||
|
('157', 'afffaf'),
|
||||||
|
('158', 'afffd7'),
|
||||||
|
('159', 'afffff'),
|
||||||
|
('160', 'd70000'),
|
||||||
|
('161', 'd7005f'),
|
||||||
|
('162', 'd70087'),
|
||||||
|
('163', 'd700af'),
|
||||||
|
('164', 'd700d7'),
|
||||||
|
('165', 'd700ff'),
|
||||||
|
('166', 'd75f00'),
|
||||||
|
('167', 'd75f5f'),
|
||||||
|
('168', 'd75f87'),
|
||||||
|
('169', 'd75faf'),
|
||||||
|
('170', 'd75fd7'),
|
||||||
|
('171', 'd75fff'),
|
||||||
|
('172', 'd78700'),
|
||||||
|
('173', 'd7875f'),
|
||||||
|
('174', 'd78787'),
|
||||||
|
('175', 'd787af'),
|
||||||
|
('176', 'd787d7'),
|
||||||
|
('177', 'd787ff'),
|
||||||
|
('178', 'd7af00'),
|
||||||
|
('179', 'd7af5f'),
|
||||||
|
('180', 'd7af87'),
|
||||||
|
('181', 'd7afaf'),
|
||||||
|
('182', 'd7afd7'),
|
||||||
|
('183', 'd7afff'),
|
||||||
|
('184', 'd7d700'),
|
||||||
|
('185', 'd7d75f'),
|
||||||
|
('186', 'd7d787'),
|
||||||
|
('187', 'd7d7af'),
|
||||||
|
('188', 'd7d7d7'),
|
||||||
|
('189', 'd7d7ff'),
|
||||||
|
('190', 'd7ff00'),
|
||||||
|
('191', 'd7ff5f'),
|
||||||
|
('192', 'd7ff87'),
|
||||||
|
('193', 'd7ffaf'),
|
||||||
|
('194', 'd7ffd7'),
|
||||||
|
('195', 'd7ffff'),
|
||||||
|
('196', 'ff0000'),
|
||||||
|
('197', 'ff005f'),
|
||||||
|
('198', 'ff0087'),
|
||||||
|
('199', 'ff00af'),
|
||||||
|
('200', 'ff00d7'),
|
||||||
|
('201', 'ff00ff'),
|
||||||
|
('202', 'ff5f00'),
|
||||||
|
('203', 'ff5f5f'),
|
||||||
|
('204', 'ff5f87'),
|
||||||
|
('205', 'ff5faf'),
|
||||||
|
('206', 'ff5fd7'),
|
||||||
|
('207', 'ff5fff'),
|
||||||
|
('208', 'ff8700'),
|
||||||
|
('209', 'ff875f'),
|
||||||
|
('210', 'ff8787'),
|
||||||
|
('211', 'ff87af'),
|
||||||
|
('212', 'ff87d7'),
|
||||||
|
('213', 'ff87ff'),
|
||||||
|
('214', 'ffaf00'),
|
||||||
|
('215', 'ffaf5f'),
|
||||||
|
('216', 'ffaf87'),
|
||||||
|
('217', 'ffafaf'),
|
||||||
|
('218', 'ffafd7'),
|
||||||
|
('219', 'ffafff'),
|
||||||
|
('220', 'ffd700'),
|
||||||
|
('221', 'ffd75f'),
|
||||||
|
('222', 'ffd787'),
|
||||||
|
('223', 'ffd7af'),
|
||||||
|
('224', 'ffd7d7'),
|
||||||
|
('225', 'ffd7ff'),
|
||||||
|
('226', 'ffff00'),
|
||||||
|
('227', 'ffff5f'),
|
||||||
|
('228', 'ffff87'),
|
||||||
|
('229', 'ffffaf'),
|
||||||
|
('230', 'ffffd7'),
|
||||||
|
('231', 'ffffff'),
|
||||||
|
|
||||||
|
# Gray-scale range.
|
||||||
|
('232', '080808'),
|
||||||
|
('233', '121212'),
|
||||||
|
('234', '1c1c1c'),
|
||||||
|
('235', '262626'),
|
||||||
|
('236', '303030'),
|
||||||
|
('237', '3a3a3a'),
|
||||||
|
('238', '444444'),
|
||||||
|
('239', '4e4e4e'),
|
||||||
|
('240', '585858'),
|
||||||
|
('241', '626262'),
|
||||||
|
('242', '6c6c6c'),
|
||||||
|
('243', '767676'),
|
||||||
|
('244', '808080'),
|
||||||
|
('245', '8a8a8a'),
|
||||||
|
('246', '949494'),
|
||||||
|
('247', '9e9e9e'),
|
||||||
|
('248', 'a8a8a8'),
|
||||||
|
('249', 'b2b2b2'),
|
||||||
|
('250', 'bcbcbc'),
|
||||||
|
('251', 'c6c6c6'),
|
||||||
|
('252', 'd0d0d0'),
|
||||||
|
('253', 'dadada'),
|
||||||
|
('254', 'e4e4e4'),
|
||||||
|
('255', 'eeeeee'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def _str2hex(hexstr):
|
||||||
|
return int(hexstr, 16)
|
||||||
|
|
||||||
|
def _strip_hash(rgb):
|
||||||
|
# Strip leading `#` if exists.
|
||||||
|
if rgb.startswith('#'):
|
||||||
|
rgb = rgb.lstrip('#')
|
||||||
|
return rgb
|
||||||
|
|
||||||
|
def _create_dicts():
|
||||||
|
short2rgb_dict = dict(CLUT)
|
||||||
|
rgb2short_dict = {}
|
||||||
|
for k, v in short2rgb_dict.items():
|
||||||
|
rgb2short_dict[v] = k
|
||||||
|
return rgb2short_dict, short2rgb_dict
|
||||||
|
|
||||||
|
def short2rgb(short):
|
||||||
|
return SHORT2RGB_DICT[short]
|
||||||
|
|
||||||
|
def print_all():
|
||||||
|
""" Print all 256 xterm color codes.
|
||||||
|
"""
|
||||||
|
for short, rgb in CLUT:
|
||||||
|
sys.stdout.write('\033[48;5;%sm%s:%s' % (short, short, rgb))
|
||||||
|
sys.stdout.write("\033[0m ")
|
||||||
|
sys.stdout.write('\033[38;5;%sm%s:%s' % (short, short, rgb))
|
||||||
|
sys.stdout.write("\033[0m\n")
|
||||||
|
print("Printed all codes.")
|
||||||
|
print("You can translate a hex or 0-255 code by providing an argument.")
|
||||||
|
|
||||||
|
def rgb2short(rgb):
|
||||||
|
""" Find the closest xterm-256 approximation to the given RGB value.
|
||||||
|
@param rgb: Hex code representing an RGB value, eg, 'abcdef'
|
||||||
|
@returns: String between 0 and 255, compatible with xterm.
|
||||||
|
>>> rgb2short('123456')
|
||||||
|
('23', '005f5f')
|
||||||
|
>>> rgb2short('ffffff')
|
||||||
|
('231', 'ffffff')
|
||||||
|
>>> rgb2short('0DADD6') # vimeo logo
|
||||||
|
('38', '00afd7')
|
||||||
|
"""
|
||||||
|
rgb = _strip_hash(rgb)
|
||||||
|
incs = (0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff)
|
||||||
|
# Break 6-char RGB code into 3 integer vals.
|
||||||
|
parts = [ int(h, 16) for h in re.split(r'(..)(..)(..)', rgb)[1:4] ]
|
||||||
|
res = []
|
||||||
|
for part in parts:
|
||||||
|
i = 0
|
||||||
|
while i < len(incs)-1:
|
||||||
|
s, b = incs[i], incs[i+1] # smaller, bigger
|
||||||
|
if s <= part <= b:
|
||||||
|
s1 = abs(s - part)
|
||||||
|
b1 = abs(b - part)
|
||||||
|
if s1 < b1: closest = s
|
||||||
|
else: closest = b
|
||||||
|
res.append(closest)
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
#print '***', res
|
||||||
|
res = ''.join([ ('%02.x' % i) for i in res ])
|
||||||
|
equiv = RGB2SHORT_DICT[ res ]
|
||||||
|
#print '***', res, equiv
|
||||||
|
return equiv, res
|
||||||
|
|
||||||
|
RGB2SHORT_DICT, SHORT2RGB_DICT = _create_dicts()
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import doctest
|
||||||
|
doctest.testmod()
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
print_all()
|
||||||
|
raise SystemExit
|
||||||
|
arg = sys.argv[1]
|
||||||
|
if len(arg) < 4 and int(arg) < 256:
|
||||||
|
rgb = short2rgb(arg)
|
||||||
|
sys.stdout.write('xterm color \033[38;5;%sm%s\033[0m -> RGB exact \033[38;5;%sm%s\033[0m' % (arg, arg, arg, rgb))
|
||||||
|
sys.stdout.write("\033[0m\n")
|
||||||
|
else:
|
||||||
|
short, rgb = rgb2short(arg)
|
||||||
|
sys.stdout.write('RGB %s -> xterm color approx \033[38;5;%sm%s (%s)' % (arg, short, short, rgb))
|
||||||
|
sys.stdout.write("\033[0m\n")
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
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
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call CocThemeFix()
|
||||||
|
au! ColorScheme * call CocThemeFix()
|
||||||
+1
-1
@@ -19,7 +19,7 @@ def exist(app):
|
|||||||
|
|
||||||
def program_must_exist(app):
|
def program_must_exist(app):
|
||||||
if not exist(app):
|
if not exist(app):
|
||||||
fatal_error(app, "must be installed to continue")
|
fatal_error("must be installed to continue")
|
||||||
|
|
||||||
def fatal_error(msg):
|
def fatal_error(msg):
|
||||||
print('Error:', msg)
|
print('Error:', msg)
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ program_exists() {
|
|||||||
# return 0 if exists
|
# return 0 if exists
|
||||||
# 1 not contain string
|
# 1 not contain string
|
||||||
# 2 file not exist
|
# 2 file not exist
|
||||||
|
# when using this function:
|
||||||
|
# file path should not be quoted but like this:
|
||||||
|
# file_contains 'abc' file_path
|
||||||
file_contains(){
|
file_contains(){
|
||||||
if [ -f "$2" ]; then
|
if [ -f "$2" ]; then
|
||||||
a=`grep "$1" $2`
|
a=`grep "$1" $2`
|
||||||
|
|||||||
Reference in New Issue
Block a user