From dd1f2e107ab4bf5a17836f7def4443528bbbb32b Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sun, 5 Feb 2023 19:05:32 -0500 Subject: [PATCH 1/9] add java support --- .vimrc.bundles | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index da19fe2..3ade329 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -184,7 +184,7 @@ endif " airblade/vim-rooter { if isdirectory(expand(plugin_dir . "/vim-rooter")) - let g:rooter_patterns = ['.vscode', '.git', '*.sln'] + let g:rooter_patterns = ['.vscode', '.git', '*.sln', 'src'] let g:rooter_change_directory_for_non_project_files = 'current' let g:rooter_silent_chdir = 1 endif @@ -284,7 +284,7 @@ endif " coc-tsserver: javascript " coc-pyright: python " 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 = { \ 'suggest.noselect': v:true, From 2a6ef320ec2c0a0200b57556988c9efa48438848 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sun, 5 Feb 2023 19:30:27 -0500 Subject: [PATCH 2/9] . --- .vimrc.bundles | 6 +++++- bash_tools/fzf_file_seletor.sh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index 912d7eb..4438ec8 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -145,9 +145,13 @@ endif " } " 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_project_root=['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout', 'src'] + endif "} " easymotion/vim-easymotion { diff --git a/bash_tools/fzf_file_seletor.sh b/bash_tools/fzf_file_seletor.sh index a6d9d05..7f13e42 100755 --- a/bash_tools/fzf_file_seletor.sh +++ b/bash_tools/fzf_file_seletor.sh @@ -12,8 +12,8 @@ fzf_command_list_all=(\ # fzf match files fzf_command_list_file=(\ cat \ -vim \ -nvim \ +#vim \ +#nvim \ set_wallpaper \ ) From f57e8ed6363a0ff29499974dc5bea705a12a5ecd Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sun, 5 Feb 2023 20:02:39 -0500 Subject: [PATCH 3/9] . --- .vimrc | 8 +++++++- .vimrc.bundles | 22 ++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.vimrc b/.vimrc index 0c90f72..c9372c1 100644 --- a/.vimrc +++ b/.vimrc @@ -80,7 +80,13 @@ " " set tabpagemax=15 " Only show 15 tabs " 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) "highlight clear SignColumn " SignColumn should match background diff --git a/.vimrc.bundles b/.vimrc.bundles index 4438ec8..d997746 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -36,18 +36,12 @@ let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js' " } - Plug 'scrooloose/nerdtree' " for markdown{ Plug 'preservim/vim-markdown' "} - " for window resize{ - Plug 'simeji/winresizer' - let g:winresizer_start_key = '' - let g:winresizer_vert_resize = 2 - let g:winresizer_horiz_resize = 2 - " } + Plug 'simeji/winresizer' Plug 'tpope/vim-surround' Plug 'rhysd/conflict-marker.vim' @@ -55,7 +49,7 @@ Plug 'jiangmiao/auto-pairs' Plug 'mg979/vim-visual-multi' - Plug 'easymotion/vim-easymotion' + "Plug 'easymotion/vim-easymotion' Plug 'vim-scripts/restore_view.vim' if executable('fzf') @@ -79,6 +73,7 @@ " only work with vim if g:vim_type == 'vim' + Plug 'scrooloose/nerdtree' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' endif @@ -98,8 +93,6 @@ Plug 'nvim-lualine/lualine.nvim' - " partial code execution - " Plug 'michaelb/sniprun', {'do': 'bash install.sh'} endif if g:vim_version >= 0.7 Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} @@ -143,6 +136,12 @@ if g:vim_type == 'nvim' endif endif " } + " simeji/winresizer { + if isdirectory(expand(plugin_dir . "/winresizer")) + let g:winresizer_vert_resize = 2 + let g:winresizer_horiz_resize = 2 + nnoremap r :WinResizerStartResize + endif " ludovicchabant/vim-gutentags { if isdirectory(expand(plugin_dir . "/vim-gutentags")) @@ -245,7 +244,7 @@ endif " } "else " vim-airline { - if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/airline")) + if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/vim-airline")) " Set configuration options for the statusline plugin vim-airline. " Use the powerline theme and optionally enable powerline symbols. let g:airline_section_b = '' @@ -332,7 +331,6 @@ endif " Theme_Appearance " { " - " debug function print out highlight group of cursor position function! SynStack() if !exists("*synstack") From 0bf78b35e13e592afd82127ba727dada2d741ae1 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sun, 5 Feb 2023 20:28:26 -0500 Subject: [PATCH 4/9] . --- .vimrc.bundles | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index d997746..f55c265 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -76,10 +76,10 @@ Plug 'scrooloose/nerdtree' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' + " The bottom buffer display + Plug 'bling/vim-bufferline' endif - " The bottom buffer display - Plug 'bling/vim-bufferline' " only work with nvim > 0.5 " For other versions, just loading the plugin may " cause error From aa309dcc208413ee9f15baec402f7c0eee0a49f3 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sun, 5 Feb 2023 20:33:02 -0500 Subject: [PATCH 5/9] . --- .vimrc.bundles | 5 +- .vimrc.lua | 214 ++++++++++++++++++++++++++----------------------- 2 files changed, 119 insertions(+), 100 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index f55c265..2d5d901 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -101,6 +101,9 @@ if g:vim_version >= 0.8 Plug 'nvim-tree/nvim-tree.lua' endif + if g:vim_version < 0.8 + Plug 'scrooloose/nerdtree' + endif endif call plug#end() @@ -205,7 +208,7 @@ endif " } " NerdTree { - if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/nerdtree")) + if (g:vim_type == 'vim' || g:vim_version < 0.8) && isdirectory(expand(plugin_dir . "/nerdtree")) let g:NERDShutUp=1 " work around for nerdtree bug: https://github.com/preservim/nerdtree/issues/1321 diff --git a/.vimrc.lua b/.vimrc.lua index b5ff333..9cad90c 100644 --- a/.vimrc.lua +++ b/.vimrc.lua @@ -1,111 +1,127 @@ +vim_version = vim.version() +vim_version_minor = vim_version['minor'] -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, - }, -} +-- debug +-- print(vim.inspect(version)) -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' +if vim_version_minor >= 7 then + + 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, }, - }, - 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 --- +end --- disable netrw at the very start of your init.lua (strongly advised) -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 +if vim_version_minor >= 5 then --- 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 = "", action = "toggle_file_info" }, + 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' }, }, - }, - 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" }, + 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 = {} + -- }, + } + +end + +if vim_version_minor >= 8 then + -- 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 = "", 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 + -- + -- nvim-tree configuration end + -- +end From 7f438a79a68790eddc56752fa39f9df319e346ad Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Mon, 6 Feb 2023 02:02:22 -0500 Subject: [PATCH 6/9] . --- .vimrc | 42 ++++++++++---------------- .vimrc.bundles | 55 ++++++++++++++++++---------------- .vimrc.lua | 80 +++++++++++++++++++++++++++++++------------------- 3 files changed, 96 insertions(+), 81 deletions(-) diff --git a/.vimrc b/.vimrc index c9372c1..f3072b0 100644 --- a/.vimrc +++ b/.vimrc @@ -87,7 +87,7 @@ 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(if not working, probably a plugin is changing the value) "highlight clear SignColumn " SignColumn should match background "highlight clear LineNr " Current line number row will have same background color in relative mode @@ -157,21 +157,21 @@ noremap k gk " Stupid shift key fixes - if !exists('g:spf13_no_keyfixes') - if has("user_commands") - command! -bang -nargs=* -complete=file E e - command! -bang -nargs=* -complete=file W w - command! -bang -nargs=* -complete=file Wq wq - command! -bang -nargs=* -complete=file WQ wq - command! -bang Wa wa - command! -bang WA wa - command! -bang Q q - command! -bang QA qa - command! -bang Qa qa - endif + " if !exists('g:spf13_no_keyfixes') + " if has("user_commands") + " command! -bang -nargs=* -complete=file E e + " command! -bang -nargs=* -complete=file W w + " command! -bang -nargs=* -complete=file Wq wq + " command! -bang -nargs=* -complete=file WQ wq + " command! -bang Wa wa + " command! -bang WA wa + " command! -bang Q q + " command! -bang QA qa + " command! -bang Qa qa + " endif - cmap Tabe tabe - endif + " cmap Tabe tabe + " endif " Yank from the cursor to the end of the line, to be consistent with C and D. nnoremap Y y$ @@ -213,17 +213,7 @@ map zh zH " Easier formatting - nnoremap q gwip - -" Plugins { - - " AutoCloseTag { - " Make it so AutoCloseTag works for xml and xhtml files as well - au FileType xhtml,xml ru ftplugin/html/autoclosetag.vim - nmap ac ToggleAutoCloseMappings - " } - -" } + " nnoremap q gwip " Functions { diff --git a/.vimrc.bundles b/.vimrc.bundles index 2d5d901..e95978c 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -96,6 +96,9 @@ endif if g:vim_version >= 0.7 Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + + " comment out this plugin if the machine doesn't have required + " font install Plug 'nvim-tree/nvim-web-devicons' endif if g:vim_version >= 0.8 @@ -131,10 +134,6 @@ if g:vim_type == 'nvim' if g:vim_version >= 0.7 " nvim-treesitter/nvim-treesitter { - if filereadable(expand(g:dotfile_path . '.vimrc.lua')) - execute('source ' . g:dotfile_path . '/.vimrc.lua') - endif - " } endif endif @@ -187,11 +186,13 @@ endif let g:bufferline_modified = '+' " scrolling with fixed current buffer position - let g:bufferline_rotate = 1 + let g:bufferline_rotate = 0 let g:bufferline_active_buffer_left = '' let g:bufferline_active_buffer_right = '' let g:bufferline_fixed_index = -1 + let g:bufferline_inactive_highlight = 'StatusLineNC' + let g:bufferline_active_highlight = 'StatusLine' " } @@ -231,10 +232,6 @@ endif " nvim-tree.lua { if g:vim_type == 'nvim' && isdirectory(expand(plugin_dir . "/nvim-tree.lua")) - - nnoremap e :NvimTreeFindFileToggle - nnoremap r :NvimTreeRefresh - " Hide vim bottom statusline " autocmd FileType NvimTree setlocal noshowmode noruler laststatus=0 noshowcmd set noshowmode noruler laststatus=0 noshowcmd @@ -592,34 +589,42 @@ endif " { " Toggle dark/light theme - noremap bg :call ToggleBG() + noremap bg :call ToggleBG() " Toggle transparent background - noremap tb :call ToggleTransparent() + noremap tb :call ToggleTransparent() " Buffer navigation - nnoremap q :bprevious - nnoremap e :bnext + nnoremap q :bprevious + nnoremap e :bnext " leader s change all occurence - nnoremap s :%s/\<\>/ + nnoremap s :%s/\<\>/ " leader num change tab - nnoremap 1 :b1 - nnoremap 2 :b2 - nnoremap 3 :b3 - nnoremap 4 :b4 - nnoremap 5 :b5 - nnoremap 6 :b6 - nnoremap 7 :b7 - nnoremap 8 :b8 - nnoremap 9 :b9 + " only for vim or nvim without lualine + if g:vim_type == 'vim' || (g:vim_type == 'nvim' && g:vim_version < 0.5) + nnoremap 1 :b1 + nnoremap 2 :b2 + nnoremap 3 :b3 + nnoremap 4 :b4 + nnoremap 5 :b5 + nnoremap 6 :b6 + nnoremap 7 :b7 + nnoremap 8 :b8 + nnoremap 9 :b9 + end " split window comform with other window management shortcuts - nnoremap % :vsplit - nnoremap " :split + nnoremap % :vsplit + nnoremap " :split " } " +" Lua configuration + if g:vim_type == 'nvim' && filereadable(expand(g:dotfile_path . '.vimrc.lua')) + execute('source ' . g:dotfile_path . '/.vimrc.lua') + endif +" " Useful_Info{ " show mapping info " :verbose map ,cf diff --git a/.vimrc.lua b/.vimrc.lua index 9cad90c..b61d9c0 100644 --- a/.vimrc.lua +++ b/.vimrc.lua @@ -4,6 +4,21 @@ vim_version_minor = vim_version['minor'] -- debug -- print(vim.inspect(version)) +if vim_version_minor >= 5 then + + 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 + if vim_version_minor >= 7 then require('nvim-treesitter.configs').setup { @@ -21,14 +36,30 @@ end if vim_version_minor >= 5 then + for i=1,9 do + vim.api.nvim_set_keymap('n', ''..i, ':LualineBuffersJump '..i..'', { noremap = true, silent = true }) + -- :nnoremap 1 :LualineBuffersJump 1 + end + + local disabled_filetypes_data = {} + if vim_version_minor < 7 then + -- globalstatus only work for nvim >= 0.7 + disabled_filetypes_data = { -- Filetypes to disable lualine for. + statusline = {}, -- only ignores the ft for statusline. + winbar = {}, -- only ignores the ft for winbar. + 'NvimTree' + } + end + 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' - }, + -- theme = 'ayu', -- lualine theme + always_divide_middle = false, -- When set to true, left sections i.e. 'a','b' and 'c' + -- can't take over the entire statusline even + -- if neither of 'x', 'y' or 'z' are present. + globalstatus = true, + disabled_filetypes = disabled_filetypes_data, }, sections = { lualine_a = {'mode'}, @@ -36,43 +67,30 @@ if vim_version_minor >= 5 then lualine_c = { { 'buffers', - mode = 4, + mode = 2, filetype_names = { TelescopePrompt = 'Telescope', dashboard = 'Dashboard', packer = 'Packer', fzf = 'FZF', alpha = 'Alpha', - NvimTree = 'NvimTree' + NvimTree = '' + }, + max_length = vim.o.columns * 2 / 3, -- Maximum width of buffers component, + -- it can also be a function that returns + -- the value of `max_length` dynamically. + symbols = { + modified = ' ●', -- Text to show when the buffer is modified + alternate_file = '', -- Text to show to identify the alternate file + directory = '', -- Text to show when the buffer is a directory }, } }, -- lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_x = {'encoding'}, - lualine_y = {}, + lualine_x = {}, + lualine_y = {'encoding'}, 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 = {} - -- }, } end @@ -121,6 +139,8 @@ if vim_version_minor >= 8 then }, }) + vim.api.nvim_set_keymap('n', 'e', ':NvimTreeFindFileToggle', { noremap = true, silent = true }) + -- -- nvim-tree configuration end -- From a69366fa46cc5c556aed213bb5d148736761737b Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Mon, 6 Feb 2023 03:51:47 -0500 Subject: [PATCH 7/9] . --- .vimrc.bundles | 52 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index e95978c..c024a85 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -68,7 +68,7 @@ Plug 'wellle/tmux-complete.vim' Plug 'NoahTheDuke/vim-just' - Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp'] } + Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp', 'vim'] } Plug 'lambdalisue/readablefold.vim' " only work with vim @@ -77,7 +77,7 @@ Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " The bottom buffer display - Plug 'bling/vim-bufferline' + Plug 'Donaldttt/vim-bufferline' endif " only work with nvim > 0.5 @@ -216,8 +216,15 @@ endif let g:NERDTreeMinimalMenu=1 "nnoremap :NERDTreeToggle - nnoremap e :NERDTreeToggle - "nmap e :NERDTreeFind + " nnoremap e :NERDTreeToggle + function! NERDTreeFindToggle() + if &filetype == 'nerdtree' + :NERDTreeToggle + else + :NERDTreeFind + endif + endfunction + nnoremap e :call NERDTreeFindToggle() "let NERDTreeShowBookmarks=1 "let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$'] @@ -226,6 +233,9 @@ endif let NERDTreeMouseMode = 2 let NERDTreeShowHidden = 1 let NERDTreeKeepTreeInNewTab = 1 + + " Exit Vim if NERDTree is the only window remaining in the only tab. + autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif endif " } @@ -252,6 +262,8 @@ endif let g:airline_section_y = '' let g:airline_section_x = '' let g:airline_section_warning = '' + let g:airline_exclude_filetypes = ['nerdtree'] " see source for current list + let g:airline#extensions#nerdtree_statusline = 0 "let g:airline#extensions#tabline#left_sep = '' "let g:airline#extensions#tabline#left_alt_sep = '|' @@ -323,6 +335,8 @@ endif if filereadable(expand(config_dir . "/.exp-coc-config")) exec "source " . config_dir . "/.exp-coc-config" endif + " warning that coc work best for vim >= 8.3 + let g:coc_disable_startup_warning = 1 endif " } @@ -356,7 +370,8 @@ endif " what to use for dark theme let g:dark_theme = 'default' - let g:airline_dark_theme = "deus" + " let g:airline_dark_theme = "violet" + let g:airline_dark_theme = "angr" " what to use for light theme let g:light_theme = 'default' @@ -604,15 +619,24 @@ endif " leader num change tab " only for vim or nvim without lualine if g:vim_type == 'vim' || (g:vim_type == 'nvim' && g:vim_version < 0.5) - nnoremap 1 :b1 - nnoremap 2 :b2 - nnoremap 3 :b3 - nnoremap 4 :b4 - nnoremap 5 :b5 - nnoremap 6 :b6 - nnoremap 7 :b7 - nnoremap 8 :b8 - nnoremap 9 :b9 + " nnoremap 1 :b1 + " nnoremap 2 :b2 + " nnoremap 3 :b3 + " nnoremap 4 :b4 + " nnoremap 5 :b5 + " nnoremap 6 :b6 + " nnoremap 7 :b7 + " nnoremap 8 :b8 + " nnoremap 9 :b9 + nnoremap 1 :call bufferline#jump(1) + nnoremap 2 :call bufferline#jump(2) + nnoremap 3 :call bufferline#jump(3) + nnoremap 4 :call bufferline#jump(4) + nnoremap 5 :call bufferline#jump(5) + nnoremap 6 :call bufferline#jump(6) + nnoremap 7 :call bufferline#jump(7) + nnoremap 8 :call bufferline#jump(8) + nnoremap 9 :call bufferline#jump(9) end " split window comform with other window management shortcuts From 5651b5639a20db98566f7f00adb1e7299788f142 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Mon, 6 Feb 2023 03:55:13 -0500 Subject: [PATCH 8/9] . --- .vimrc.bundles | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index c024a85..fd9b632 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -218,7 +218,8 @@ endif "nnoremap :NERDTreeToggle " nnoremap e :NERDTreeToggle function! NERDTreeFindToggle() - if &filetype == 'nerdtree' + let my_filetype = &filetype + if my_filetype == 'nerdtree' || my_filetype == '' :NERDTreeToggle else :NERDTreeFind From 43b7f2f21251c28b3d527fb3460960537d7f7edf Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Mon, 6 Feb 2023 05:19:15 -0500 Subject: [PATCH 9/9] . --- .vimrc.bundles | 107 ++++++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index fd9b632..748bee8 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -74,10 +74,12 @@ " only work with vim if g:vim_type == 'vim' Plug 'scrooloose/nerdtree' + " Plug 'tribela/vim-transparent' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " The bottom buffer display Plug 'Donaldttt/vim-bufferline' + " Plug 'itchyny/lightline.vim' endif " only work with nvim > 0.5 @@ -245,7 +247,7 @@ endif " Hide vim bottom statusline " autocmd FileType NvimTree setlocal noshowmode noruler laststatus=0 noshowcmd - set noshowmode noruler laststatus=0 noshowcmd + " set noshowmode noruler laststatus=0 noshowcmd " autocmd BufRead,BufNewFile NvimTree set laststatus=0 " This will work instead endif " } @@ -254,23 +256,34 @@ endif " nvim-lualine/lualine.nvim { " } "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 { if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/vim-airline")) " Set configuration options for the statusline plugin vim-airline. " Use the powerline theme and optionally enable powerline symbols. let g:airline_section_b = '' - let g:airline_section_z = '' - let g:airline_section_y = '' let g:airline_section_x = '' + let g:airline_section_y = '' + "let g:airline_section_z = '' let g:airline_section_warning = '' let g:airline_exclude_filetypes = ['nerdtree'] " see source for current list let g:airline#extensions#nerdtree_statusline = 0 - "let g:airline#extensions#tabline#left_sep = '' - "let g:airline#extensions#tabline#left_alt_sep = '|' - - "let g:airline_left_sep='>' - "let g:airline_right_sep='<' - "let g:airline_skip_empty_sections = 1 "let g:airline#extensions#bufferline#overwrite_variables = 0 let g:airline_mode_map = { \ '__' : '-', @@ -444,48 +457,52 @@ endif function! EnableTransparent() if g:vim_type == 'nvim' && g:vim_version > 0.5 :TransparentEnable - elseif g:dark_or_white_theme == 'dark' - let g:PaperColor_Theme_Options = { - \ 'theme': { - \ 'default.dark': { - \ 'transparent_background': 1 - \ } - \ } - \ } - execute("colorscheme " . g:dark_theme) - elseif g:dark_or_white_theme == 'light' - let g:PaperColor_Theme_Options = { - \ 'theme': { - \ 'default.light': { - \ 'transparent_background': 1 - \ } - \ } - \ } - execute("colorscheme " . g:light_theme) + else + if g:dark_or_white_theme == 'dark' + let g:PaperColor_Theme_Options = { + \ 'theme': { + \ 'default.dark': { + \ 'transparent_background': 1 + \ } + \ } + \ } + execute("colorscheme " . g:dark_theme) + elseif g:dark_or_white_theme == 'light' + let g:PaperColor_Theme_Options = { + \ 'theme': { + \ 'default.light': { + \ 'transparent_background': 1 + \ } + \ } + \ } + execute("colorscheme " . g:light_theme) + endif endif endfunction function! DisableTransparent() if g:vim_type == 'nvim' && g:vim_version > 0.5 :TransparentDisable - elseif g:dark_or_white_theme == 'dark' - let g:PaperColor_Theme_Options = { - \ 'theme': { - \ 'default.dark': { - \ 'transparent_background': 0 - \ } - \ } - \ } - execute("colorscheme " . g:dark_theme) - elseif g:dark_or_white_theme == 'light' - let g:PaperColor_Theme_Options = { - \ 'theme': { - \ 'default.light': { - \ 'transparent_background': 0 - \ } - \ } - \ } - execute("colorscheme " . g:light_theme) + else + if g:dark_or_white_theme == 'dark' + let g:PaperColor_Theme_Options = { + \ 'theme': { + \ 'default.dark': { + \ 'transparent_background': 0 + \ } + \ } + \ } + execute("colorscheme " . g:dark_theme) + elseif g:dark_or_white_theme == 'light' + let g:PaperColor_Theme_Options = { + \ 'theme': { + \ 'default.light': { + \ 'transparent_background': 0 + \ } + \ } + \ } + execute("colorscheme " . g:light_theme) + endif endif endfunction