This commit is contained in:
2023-02-05 20:15:38 -05:00
4 changed files with 196 additions and 51 deletions
+12 -4
View File
@@ -7,7 +7,7 @@
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*') let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
else else
let g:vim_type = 'vim' let g:vim_type = 'vim'
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*') let g:vim_version = matchstr(execute('version'), 'Vi IMproved \zs[^\n]*')
endif 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/'
@@ -78,9 +78,15 @@
" Vim UI { " Vim UI {
" "
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
augroup CLClear
autocmd! ColorScheme * hi clear CursorLine
augroup END
set cmdheight=1 " get rid of the extra useless line at the bottom(not working, probably a plugin is changing the value) set cmdheight=1 " get rid of the extra useless line at the bottom(not working, probably a plugin is changing the value)
"highlight clear SignColumn " SignColumn should match background "highlight clear SignColumn " SignColumn should match background
@@ -91,6 +97,7 @@
set ruler " Show the ruler set ruler " Show the ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
set showcmd " Show partial commands in status line and set showcmd " Show partial commands in status line and
endif endif
set backspace=indent,eol,start " Backspace for dummies set backspace=indent,eol,start " Backspace for dummies
@@ -109,6 +116,7 @@
set scrolloff=5 " Minimum lines to keep above and below cursor set scrolloff=5 " Minimum lines to keep above and below cursor
set sidescrolloff=5 " Minimum lines to keep at the left or right of the cursor set sidescrolloff=5 " Minimum lines to keep at the left or right of the cursor
" } " }
" Formatting { " Formatting {
+81 -44
View File
@@ -36,18 +36,12 @@
let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js' let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js'
" } " }
Plug 'scrooloose/nerdtree'
" for markdown{ " for markdown{
Plug 'preservim/vim-markdown' Plug 'preservim/vim-markdown'
"} "}
" for window resize{ Plug 'simeji/winresizer'
Plug 'simeji/winresizer'
let g:winresizer_start_key = '<leader-r>'
let g:winresizer_vert_resize = 2
let g:winresizer_horiz_resize = 2
" }
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plug 'rhysd/conflict-marker.vim' Plug 'rhysd/conflict-marker.vim'
@@ -55,12 +49,7 @@
Plug 'jiangmiao/auto-pairs' Plug 'jiangmiao/auto-pairs'
Plug 'mg979/vim-visual-multi' Plug 'mg979/vim-visual-multi'
Plug 'vim-airline/vim-airline' "Plug 'easymotion/vim-easymotion'
Plug 'vim-airline/vim-airline-themes'
" The bottom buffer display
Plug 'bling/vim-bufferline'
Plug 'easymotion/vim-easymotion'
Plug 'vim-scripts/restore_view.vim' Plug 'vim-scripts/restore_view.vim'
if executable('fzf') if executable('fzf')
@@ -77,10 +66,20 @@
" 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'] } Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp'] }
Plug 'lambdalisue/readablefold.vim' Plug 'lambdalisue/readablefold.vim'
" only work with vim
if g:vim_type == 'vim'
Plug 'scrooloose/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
endif
" The bottom buffer display
Plug 'bling/vim-bufferline'
" only work with nvim > 0.5 " only work with nvim > 0.5
" For other versions, just loading the plugin may " For other versions, just loading the plugin may
" cause error " cause error
@@ -92,11 +91,15 @@
Plug 'EdenEast/nightfox.nvim' Plug 'EdenEast/nightfox.nvim'
Plug 'projekt0n/github-nvim-theme' Plug 'projekt0n/github-nvim-theme'
" partial code execution Plug 'nvim-lualine/lualine.nvim'
" Plug 'michaelb/sniprun', {'do': 'bash install.sh'}
endif endif
if g:vim_version >= 0.7 if g:vim_version >= 0.7
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-tree/nvim-web-devicons'
endif
if g:vim_version >= 0.8
Plug 'nvim-tree/nvim-tree.lua'
endif endif
endif endif
@@ -133,11 +136,21 @@ if g:vim_type == 'nvim'
endif endif
endif endif
" } " }
" simeji/winresizer {
if isdirectory(expand(plugin_dir . "/winresizer"))
let g:winresizer_vert_resize = 2
let g:winresizer_horiz_resize = 2
nnoremap <C-w>r :WinResizerStartResize<CR>
endif
" ludovicchabant/vim-gutentags { " ludovicchabant/vim-gutentags {
set statusline+=%{gutentags#statusline()} if isdirectory(expand(plugin_dir . "/vim-gutentags"))
if exists("*gutentags#statusline()")
set statusline+=%{gutentags#statusline()}
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
"} "}
" easymotion/vim-easymotion { " easymotion/vim-easymotion {
@@ -192,7 +205,7 @@ endif
" } " }
" NerdTree { " NerdTree {
if isdirectory(expand(plugin_dir . "/nerdtree")) if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/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
@@ -211,12 +224,27 @@ endif
let NERDTreeKeepTreeInNewTab = 1 let NERDTreeKeepTreeInNewTab = 1
endif endif
" } " }
" nvim-tree.lua {
if g:vim_type == 'nvim' && isdirectory(expand(plugin_dir . "/nvim-tree.lua"))
nnoremap <leader>e :NvimTreeFindFileToggle<CR>
nnoremap <leader>r :NvimTreeRefresh<CR>
" Hide vim bottom statusline
" autocmd FileType NvimTree setlocal noshowmode noruler laststatus=0 noshowcmd
set noshowmode noruler laststatus=0 noshowcmd
" autocmd BufRead,BufNewFile NvimTree set laststatus=0 " This will work instead
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 && isdirectory(expand(plugin_dir . "/lualine.nvim"))
" nvim-lualine/lualine.nvim { " nvim-lualine/lualine.nvim {
" } " }
"else "else
" vim-airline { " vim-airline {
if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/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.
let g:airline_section_b = '' let g:airline_section_b = ''
@@ -254,6 +282,7 @@ endif
if isdirectory(expand(plugin_dir . "/vim-airline-themes/")) if isdirectory(expand(plugin_dir . "/vim-airline-themes/"))
"let g:airline_theme = 'solarized' "let g:airline_theme = 'solarized'
endif endif
endif
" } " }
"endif "endif
@@ -285,7 +314,7 @@ endif
" coc-tsserver: javascript " coc-tsserver: javascript
" coc-pyright: python " 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'] 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 = { let g:coc_user_config = {
\ 'suggest.noselect': v:true, \ 'suggest.noselect': v:true,
@@ -302,7 +331,6 @@ endif
" Theme_Appearance " Theme_Appearance
" { " {
" "
" debug function print out highlight group of cursor position " debug function print out highlight group of cursor position
function! SynStack() function! SynStack()
if !exists("*synstack") if !exists("*synstack")
@@ -321,9 +349,9 @@ endif
" dark or light " dark or light
if filereadable(expand(g:vim_dir . '.light_theme.signal')) if filereadable(expand(g:vim_dir . '.light_theme.signal'))
let g:theme_color = 'light' let g:dark_or_white_theme = 'light'
else else
let g:theme_color = 'dark' let g:dark_or_white_theme = 'dark'
endif endif
" what to use for dark theme " what to use for dark theme
@@ -350,21 +378,21 @@ endif
set background=dark set background=dark
hi clear hi clear
execute("colorscheme " . g:dark_theme) execute("colorscheme " . g:dark_theme)
let g:theme_color = 'dark' let g:dark_or_white_theme = 'dark'
endfunction endfunction
function! SetLightTheme() function! SetLightTheme()
set background=light set background=light
hi clear hi clear
execute("colorscheme " . g:light_theme) execute("colorscheme " . g:light_theme)
let g:theme_color = 'light' let g:dark_or_white_theme = 'light'
endfunction endfunction
" Change bottom airline/lualine theme " Change bottom airline/lualine theme
" Currently only support airline " Currently only support airline
function! SetAirlineTheme(theme) function! SetAirlineTheme(theme)
if has('nvim') && g:vim_version >= 0.5 if g:vim_type == 'nvim' && g:vim_version >= 0.5
execute('AirlineTheme ' . a:theme) "execute('AirlineTheme ' . a:theme)
else else
execute('AirlineTheme ' . a:theme) execute('AirlineTheme ' . a:theme)
endif endif
@@ -375,6 +403,7 @@ endif
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
highlight SignColumn ctermbg=none highlight SignColumn ctermbg=none
"highlight CursorLineNr ctermbg=none "highlight CursorLineNr ctermbg=none
highlight CocWarningHighlight ctermbg=none highlight CocWarningHighlight ctermbg=none
@@ -385,7 +414,7 @@ endif
highlight CocWarningSign ctermbg=none highlight CocWarningSign ctermbg=none
highlight CocInfoSign ctermbg=none highlight CocInfoSign ctermbg=none
highlight CocHintSign ctermbg=none highlight CocHintSign ctermbg=none
if g:theme_color == 'dark' if g:dark_or_white_theme == 'dark'
highlight! link TempColor Visual highlight! link TempColor Visual
highlight! link CocFloating TempColor highlight! link CocFloating TempColor
highlight! link CocErrorFloat TempColor highlight! link CocErrorFloat TempColor
@@ -399,7 +428,7 @@ endif
function! EnableTransparent() function! EnableTransparent()
if g:vim_type == 'nvim' && g:vim_version > 0.5 if g:vim_type == 'nvim' && g:vim_version > 0.5
:TransparentEnable :TransparentEnable
elseif g:theme_color == 'dark' elseif g:dark_or_white_theme == 'dark'
let g:PaperColor_Theme_Options = { let g:PaperColor_Theme_Options = {
\ 'theme': { \ 'theme': {
\ 'default.dark': { \ 'default.dark': {
@@ -408,7 +437,7 @@ endif
\ } \ }
\ } \ }
execute("colorscheme " . g:dark_theme) execute("colorscheme " . g:dark_theme)
elseif g:theme_color == 'light' elseif g:dark_or_white_theme == 'light'
let g:PaperColor_Theme_Options = { let g:PaperColor_Theme_Options = {
\ 'theme': { \ 'theme': {
\ 'default.light': { \ 'default.light': {
@@ -423,7 +452,7 @@ endif
function! DisableTransparent() function! DisableTransparent()
if g:vim_type == 'nvim' && g:vim_version > 0.5 if g:vim_type == 'nvim' && g:vim_version > 0.5
:TransparentDisable :TransparentDisable
elseif g:theme_color == 'dark' elseif g:dark_or_white_theme == 'dark'
let g:PaperColor_Theme_Options = { let g:PaperColor_Theme_Options = {
\ 'theme': { \ 'theme': {
\ 'default.dark': { \ 'default.dark': {
@@ -432,7 +461,7 @@ endif
\ } \ }
\ } \ }
execute("colorscheme " . g:dark_theme) execute("colorscheme " . g:dark_theme)
elseif g:theme_color == 'light' elseif g:dark_or_white_theme == 'light'
let g:PaperColor_Theme_Options = { let g:PaperColor_Theme_Options = {
\ 'theme': { \ 'theme': {
\ 'default.light': { \ 'default.light': {
@@ -459,17 +488,17 @@ endif
" ToggleTransparent background " ToggleTransparent background
" only works in dark theme " only works in dark theme
function! ToggleTransparent() function! ToggleTransparent()
if g:transparent_dark_theme && g:theme_color == 'dark' if g:transparent_dark_theme && g:dark_or_white_theme == 'dark'
call DisableTransparent() call DisableTransparent()
let g:transparent_dark_theme = v:false let g:transparent_dark_theme = v:false
call DeleteSignalFile('.transparent_dark_theme.signal') call DeleteSignalFile('.transparent_dark_theme.signal')
elseif g:transparent_light_theme && g:theme_color == 'light' elseif g:transparent_light_theme && g:dark_or_white_theme == 'light'
call DisableTransparent() call DisableTransparent()
let g:transparent_light_theme = v:false let g:transparent_light_theme = v:false
call DeleteSignalFile('.transparent_light_theme.signal') call DeleteSignalFile('.transparent_light_theme.signal')
else else
call EnableTransparent() call EnableTransparent()
if g:theme_color == 'dark' if g:dark_or_white_theme == 'dark'
let g:transparent_dark_theme = v:true let g:transparent_dark_theme = v:true
call CreateSignalFile('.transparent_dark_theme.signal') call CreateSignalFile('.transparent_dark_theme.signal')
else else
@@ -482,22 +511,30 @@ endif
" vim theme " vim theme
if isdirectory(expand(plugin_dir . "/papercolor-theme")) if !has('nvim') && isdirectory(expand(plugin_dir . "/papercolor-theme"))
" improve coc color in this theme set t_Co=256
let g:light_theme = 'PaperColor' " improve coc color in this theme
let g:dark_theme = 'PaperColor' let g:light_theme = 'PaperColor'
endif let g:dark_theme = 'PaperColor'
"let g:airline_dark_theme = "papercolor"
"let g:airline_light_theme = "papercolor"
endif
" nvim only theme " nvim only theme
if isdirectory(expand(plugin_dir . "/nightfox.nvim")) && isdirectory(expand(plugin_dir . "/github-nvim-theme")) && has('nvim') && g:vim_version >= 0.5 if has('nvim')
if g:vim_version >= 0.8 && isdirectory(expand(plugin_dir . "/nightfox.nvim"))
let g:light_theme = 'dawnfox' let g:light_theme = 'dawnfox'
"let g:dark_theme = 'nightfox' "let g:dark_theme = 'nightfox'
end
if g:vim_version >= 0.5 && isdirectory(expand(plugin_dir . "/github-nvim-theme"))
let g:dark_theme = 'github_dark' let g:dark_theme = 'github_dark'
let g:airline_dark_theme = "hybrid" let g:airline_dark_theme = "hybrid"
endif end
endif
if g:theme_color == 'dark' if g:dark_or_white_theme == 'dark'
let g:airline_theme=g:airline_dark_theme let g:airline_theme=g:airline_dark_theme
call SetDarkTheme() call SetDarkTheme()
else else
@@ -507,7 +544,7 @@ 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:theme_color == 'dark' || g:transparent_light_theme && g:theme_color == '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
@@ -525,7 +562,7 @@ endif
" Allow to trigger background " Allow to trigger background
function! ToggleBG() function! ToggleBG()
" Inversion " Inversion
if g:theme_color == "dark" if g:dark_or_white_theme == "dark"
call SetLightTheme() call SetLightTheme()
call SetAirlineTheme(g:airline_light_theme) call SetAirlineTheme(g:airline_light_theme)
call CreateSignalFile('.light_theme.signal') call CreateSignalFile('.light_theme.signal')
@@ -536,7 +573,7 @@ endif
call DeleteSignalFile(".light_theme.signal") call DeleteSignalFile(".light_theme.signal")
endif endif
if g:transparent_dark_theme && g:theme_color == 'dark' || g:transparent_light_theme && g:theme_color == 'light' if g:transparent_dark_theme && g:dark_or_white_theme == 'dark' || g:transparent_light_theme && g:dark_or_white_theme == 'light'
call EnableTransparent() call EnableTransparent()
else else
call DisableTransparent() call DisableTransparent()
+101 -1
View File
@@ -1,5 +1,5 @@
require'nvim-treesitter.configs'.setup { require('nvim-treesitter.configs').setup {
-- ensure_installed = { "c", "bash", "lua" }, -- ensure_installed = { "c", "bash", "lua" },
sync_install = false, sync_install = false,
auto_install = true, auto_install = true,
@@ -9,3 +9,103 @@ require'nvim-treesitter.configs'.setup {
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
} }
require('lualine').setup {
options = {
theme = 'auto', -- lualine theme
disabled_filetypes = { -- Filetypes to disable lualine for.
statusline = {}, -- only ignores the ft for statusline.
winbar = {}, -- only ignores the ft for winbar.
'NvimTree'
},
},
sections = {
lualine_a = {'mode'},
lualine_b = {},
lualine_c = {
{
'buffers',
mode = 4,
filetype_names = {
TelescopePrompt = 'Telescope',
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha',
NvimTree = 'NvimTree'
},
}
},
-- lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_x = {'encoding'},
lualine_y = {},
lualine_z = {'location'}
},
-- tabline = {
-- lualine_a = {
-- {
-- 'buffers',
-- mode = 4,
-- }
-- },
-- lualine_b = {},
-- lualine_c = {},
-- lualine_x = {},
-- lualine_y = {},
-- lualine_z = {'tabs'}
-- },
-- winbar = {
-- lualine_a = {},
-- lualine_b = {},
-- lualine_c = {'filename'},
-- lualine_x = {},
-- lualine_y = {},
-- lualine_z = {}
-- },
}
-- nvim-tree configuration
--
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
-- setup with some options
require("nvim-tree").setup({
sort_by = "case_sensitive",
view = {
width = 30,
mappings = {
list = {
{ key = "C-[", action = "dir_up" },
{ key = "C-]", action = "cd" },
{ key = "<C-k>", action = "toggle_file_info" },
},
},
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = false,
},
actions = {
open_file = {
quit_on_open = true,
resize_window = true,
window_picker = {
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
})
--
-- nvim-tree configuration end
+2 -2
View File
@@ -12,8 +12,8 @@ fzf_command_list_all=(\
# fzf match files # fzf match files
fzf_command_list_file=(\ fzf_command_list_file=(\
cat \ cat \
vim \ #vim \
nvim \ #nvim \
set_wallpaper \ set_wallpaper \
) )