Merge branch 'main' of https://github.com/Donaldttt/dotfiles into main
This commit is contained in:
@@ -1,9 +1,15 @@
|
|||||||
" Modeline and Notes {
|
" Modeline and Notes {
|
||||||
" Environment {
|
" Environment {
|
||||||
" get current neovim version
|
" get current neovim version
|
||||||
|
let g:vim_version = -1
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
let g:nvim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
let g:vim_type = 'nvim'
|
||||||
|
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
||||||
|
else
|
||||||
|
let g:vim_type = 'vim'
|
||||||
|
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
|
||||||
endif
|
endif
|
||||||
|
let g:vim_version = str2float(g:vim_version)
|
||||||
|
|
||||||
" 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
|
||||||
let mapleader = ','
|
let mapleader = ','
|
||||||
@@ -13,8 +19,6 @@
|
|||||||
|
|
||||||
" General {
|
" General {
|
||||||
|
|
||||||
set background=dark " Assume a dark background
|
|
||||||
|
|
||||||
noremap <leader>h :noh<CR> " turn off highlight
|
noremap <leader>h :noh<CR> " turn off highlight
|
||||||
|
|
||||||
filetype plugin indent on " Automatically detect file types.
|
filetype plugin indent on " Automatically detect file types.
|
||||||
|
|||||||
+171
-39
@@ -8,6 +8,7 @@
|
|||||||
" Plugin directory
|
" Plugin directory
|
||||||
let config_dir = '~/.dotfiles/'
|
let config_dir = '~/.dotfiles/'
|
||||||
let plugin_dir = '~/.vim/plugged/'
|
let plugin_dir = '~/.vim/plugged/'
|
||||||
|
let g:vim_dir = '~/.vim/'
|
||||||
call plug#begin(plugin_dir)
|
call plug#begin(plugin_dir)
|
||||||
|
|
||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
@@ -49,8 +50,12 @@
|
|||||||
" {
|
" {
|
||||||
Plug 'mg979/vim-visual-multi'
|
Plug 'mg979/vim-visual-multi'
|
||||||
" }
|
" }
|
||||||
|
"if has('nvim') && str2float(g:nvim_version) >= 0.5
|
||||||
|
" Plug 'nvim-lualine/lualine.nvim'
|
||||||
|
"else
|
||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
|
"endif
|
||||||
|
|
||||||
" For nvim-bufferline
|
" For nvim-bufferline
|
||||||
" {
|
" {
|
||||||
@@ -73,15 +78,26 @@
|
|||||||
|
|
||||||
" vim theme
|
" vim theme
|
||||||
" {
|
" {
|
||||||
Plug 'nanotech/jellybeans.vim'
|
|
||||||
Plug 'danilo-augusto/vim-afterglow'
|
Plug 'danilo-augusto/vim-afterglow'
|
||||||
Plug 'NLKNguyen/papercolor-theme'
|
Plug 'NLKNguyen/papercolor-theme'
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
|
Plug 'xiyaowong/nvim-transparent'
|
||||||
|
endif
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
|
" Helper functions
|
||||||
|
" {
|
||||||
|
|
||||||
|
" }
|
||||||
|
|
||||||
" Plugin Preferences
|
" Plugin Preferences
|
||||||
" {
|
" {
|
||||||
|
" xiyaowong/nvim-transparent {
|
||||||
|
|
||||||
|
" }
|
||||||
|
|
||||||
" NerdTree {
|
" NerdTree {
|
||||||
if isdirectory(expand(plugin_dir . "/nerdtree"))
|
if isdirectory(expand(plugin_dir . "/nerdtree"))
|
||||||
let g:NERDShutUp=1
|
let g:NERDShutUp=1
|
||||||
@@ -89,7 +105,7 @@
|
|||||||
nnoremap <leader>e :NERDTreeToggle<CR>
|
nnoremap <leader>e :NERDTreeToggle<CR>
|
||||||
"nmap <leader>e :NERDTreeFind<CR>
|
"nmap <leader>e :NERDTreeFind<CR>
|
||||||
|
|
||||||
let NERDTreeShowBookmarks=1
|
"let NERDTreeShowBookmarks=1
|
||||||
"let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
|
"let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
|
||||||
let NERDTreeChDirMode=0
|
let NERDTreeChDirMode=0
|
||||||
let NERDTreeQuitOnOpen=1
|
let NERDTreeQuitOnOpen=1
|
||||||
@@ -107,6 +123,11 @@
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
"if has('nvim') && str2float(g:nvim_version) >= 0.5 && isdirectory(expand(plugin_dir . "/lualine.nvim"))
|
||||||
|
" nvim-lualine/lualine.nvim {
|
||||||
|
" }
|
||||||
|
"else
|
||||||
" vim-airline {
|
" 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.
|
||||||
@@ -122,7 +143,8 @@
|
|||||||
"let g:airline_theme = 'solarized'
|
"let g:airline_theme = 'solarized'
|
||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
|
"endif
|
||||||
|
|
||||||
" junegunnjunegunn/fzf {
|
" junegunnjunegunn/fzf {
|
||||||
" [Buffers] Jump to the existing window if possible
|
" [Buffers] Jump to the existing window if possible
|
||||||
let g:fzf_buffers_jump = 1
|
let g:fzf_buffers_jump = 1
|
||||||
@@ -152,56 +174,166 @@
|
|||||||
|
|
||||||
" THEME APPEARANCE
|
" THEME APPEARANCE
|
||||||
" {
|
" {
|
||||||
|
" dark or light
|
||||||
|
if filereadable(expand(g:vim_dir . '.light_theme.signal'))
|
||||||
|
let g:theme_color = 'light'
|
||||||
|
else
|
||||||
|
let g:theme_color = 'dark'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" what to use for dark theme
|
||||||
|
let g:dark_theme = ''
|
||||||
|
|
||||||
|
" what to use for light theme
|
||||||
|
let g:light_theme = ''
|
||||||
|
|
||||||
|
" transparent backgroud for supported terminal emulator
|
||||||
|
if filereadable(expand(g:vim_dir . '.transparent_theme.signal'))
|
||||||
|
let g:transparent_theme = v:true
|
||||||
|
else
|
||||||
|
let g:transparent_theme = v:false
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Change bottom airline/lualine theme
|
||||||
|
" Currently only support airline
|
||||||
|
function! SetAirlineTheme(theme)
|
||||||
|
if has('nvim') && g:vim_version >= 0.5
|
||||||
|
else
|
||||||
|
execute('AirlineTheme ' . a:theme)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! EnableTransparent()
|
||||||
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
|
:TransparentEnable
|
||||||
|
elseif g:theme_color == 'dark'
|
||||||
|
let g:afterglow_inherit_background=1
|
||||||
|
execute("colorscheme " . g:dark_theme)
|
||||||
|
elseif g:theme_color == 'light'
|
||||||
|
let g:PaperColor_Theme_Options = {
|
||||||
|
\ 'theme': {
|
||||||
|
\ 'default.light': {
|
||||||
|
\ 'transparent_background': 1
|
||||||
|
\ }
|
||||||
|
\ }
|
||||||
|
\ }
|
||||||
|
execute("colorscheme " . g:light_theme)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! DisableTransparent()
|
||||||
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
|
:TransparentDisable
|
||||||
|
elseif g:theme_color == 'dark'
|
||||||
|
let g:afterglow_inherit_background=0
|
||||||
|
execute("colorscheme " . g:dark_theme)
|
||||||
|
elseif g:theme_color == 'light'
|
||||||
|
let g:PaperColor_Theme_Options = {
|
||||||
|
\ 'theme': {
|
||||||
|
\ 'default.light': {
|
||||||
|
\ 'transparent_background': 0
|
||||||
|
\ }
|
||||||
|
\ }
|
||||||
|
\ }
|
||||||
|
execute("colorscheme " . g:light_theme)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" ToggleTransparent background
|
||||||
|
" only works in dark theme
|
||||||
|
function! ToggleTransparent()
|
||||||
|
if g:transparent_theme == v:true
|
||||||
|
call DisableTransparent()
|
||||||
|
let g:transparent_theme = v:false
|
||||||
|
if filereadable(expand(g:vim_dir . '.transparent_theme.signal'))
|
||||||
|
call delete(expand(g:vim_dir . ".transparent_theme.signal"))
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
call EnableTransparent()
|
||||||
|
let g:transparent_theme = v:true
|
||||||
|
call system("touch " . g:vim_dir . ".transparent_theme.signal")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
noremap <leader>tb :call ToggleTransparent()<CR>
|
||||||
|
|
||||||
" {
|
" {
|
||||||
" nvim only theme
|
" nvim only theme
|
||||||
|
|
||||||
" has('nvim') check if it's running on nvim rather than
|
" has('nvim') check if it's running on nvim rather than
|
||||||
" having neovim on your machine
|
" having neovim on your machine
|
||||||
if isdirectory(expand(plugin_dir . "/github-nvim-theme")) && has('nvim') && str2float(g:nvim_version) >= 0.5
|
if isdirectory(expand(plugin_dir . "/github-nvim-theme")) && has('nvim') && g:vim_version >= 0.5
|
||||||
let g:github_function_style = "italic"
|
let g:github_function_style = "italic"
|
||||||
"let g:github_sidebars = ["qf", "vista_kind", "terminal", "packer"]
|
"let g:github_sidebars = ["qf", "vista_kind", "terminal", "packer"]
|
||||||
colorscheme github_dark
|
let g:dark_theme = 'github_dark'
|
||||||
|
let g:light_theme = 'github_light'
|
||||||
|
|
||||||
" Allow to trigger background
|
|
||||||
function! ToggleBG()
|
|
||||||
" Inversion
|
|
||||||
if g:colors_name == "github_light"
|
|
||||||
colorscheme github_dark
|
|
||||||
:AirlineTheme afterglow
|
|
||||||
else
|
|
||||||
colorscheme github_light
|
|
||||||
:AirlineTheme silver
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
noremap <leader>bg :call ToggleBG()<CR>
|
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" {
|
" {
|
||||||
" vim theme
|
" vim theme
|
||||||
"elseif isdirectory(expand(plugin_dir . "/jellybeans.vim")) && !has('nvim')
|
elseif isdirectory(expand(plugin_dir . "/vim-afterglow"))
|
||||||
elseif isdirectory(expand(plugin_dir . "/vim-afterglow"))
|
if isdirectory(expand(plugin_dir . "/papercolor-theme"))
|
||||||
let g:afterglow_inherit_background=1
|
let g:light_theme = 'PaperColor'
|
||||||
colorscheme afterglow
|
endif
|
||||||
let g:airline_theme='afterglow'
|
"let g:afterglow_inherit_background=1
|
||||||
|
let g:dark_theme = 'afterglow'
|
||||||
" Allow to trigger background
|
|
||||||
function! ToggleBG()
|
|
||||||
" Inversion
|
|
||||||
if g:colors_name == "afterglow"
|
|
||||||
set background=light
|
|
||||||
colorscheme PaperColor
|
|
||||||
:AirlineTheme silver
|
|
||||||
else
|
|
||||||
set background=dark
|
|
||||||
colorscheme afterglow
|
|
||||||
:AirlineTheme afterglow
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
noremap <leader>bg :call ToggleBG()<CR>
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
if g:theme_color == 'dark'
|
||||||
|
set background=dark
|
||||||
|
execute("colorscheme " . g:dark_theme)
|
||||||
|
let g:airline_theme='afterglow'
|
||||||
|
else
|
||||||
|
set background=light
|
||||||
|
execute("colorscheme " . g:light_theme)
|
||||||
|
let g:airline_theme='silver'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" since in .vimrc we cannot call plugin function as they
|
||||||
|
" are not loaded (:help startup)
|
||||||
|
if g:transparent_theme
|
||||||
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
|
let g:transparent_enabled = v:true
|
||||||
|
else
|
||||||
|
call EnableTransparent()
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if g:vim_type == 'nvim' && g:vim_version > 0.5
|
||||||
|
let g:transparent_enabled = v:false
|
||||||
|
else
|
||||||
|
call DisableTransparent()
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Allow to trigger background
|
||||||
|
function! ToggleBG()
|
||||||
|
" Inversion
|
||||||
|
if g:theme_color == "dark"
|
||||||
|
set background=light
|
||||||
|
execute("colorscheme " . g:light_theme)
|
||||||
|
call SetAirlineTheme("silver")
|
||||||
|
let g:theme_color = 'light'
|
||||||
|
call system("touch " . g:vim_dir . ".light_theme.signal")
|
||||||
|
else
|
||||||
|
set background=dark
|
||||||
|
execute("colorscheme " . g:dark_theme)
|
||||||
|
call SetAirlineTheme("afterglow")
|
||||||
|
let g:theme_color = 'dark'
|
||||||
|
if filereadable(expand(g:vim_dir . '.light_theme.signal'))
|
||||||
|
call delete(expand(g:vim_dir . ".light_theme.signal"))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:transparent_theme
|
||||||
|
call EnableTransparent()
|
||||||
|
else
|
||||||
|
call DisableTransparent()
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
noremap <leader>bg :call ToggleBG()<CR>
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user