Xinqi Bao's Git

update bashrc for cargo env
[dotfiles.git] / .config / nvim / init.vim
index 927f94b..acece76 100644 (file)
@@ -8,10 +8,10 @@ set t_ut=""
 "set term=xterm-256color
 
 "In order to display chinese in GBK
 "set term=xterm-256color
 
 "In order to display chinese in GBK
-let &termencoding=&encoding
+"let &termencoding=&encoding
 set fileencodings=utf-8,gbk
 set fileformat=unix
 set fileencodings=utf-8,gbk
 set fileformat=unix
-set foldmethod=manual
+set foldmethod=indent
 set encoding=utf-8 "required for ycm
 
 set tabstop=4
 set encoding=utf-8 "required for ycm
 
 set tabstop=4
@@ -47,6 +47,9 @@ set nowritebackup
 set undodir=~/.cache/nvim/undodir
 set undofile
 
 set undodir=~/.cache/nvim/undodir
 set undofile
 
+" auto added comment leader, detail for :h formatoptions
+set formatoptions+=/
+
 set tags=tags~;,tags~
 "setting gf (go file) path
 "change kernel version to your version, for kernel development
 set tags=tags~;,tags~
 "setting gf (go file) path
 "change kernel version to your version, for kernel development
@@ -90,11 +93,32 @@ call plug#begin()
     "Plug 'ycm-core/YouCompleteMe'
     "Plug 'rhysd/vim-clang-format'
 
     "Plug 'ycm-core/YouCompleteMe'
     "Plug 'rhysd/vim-clang-format'
 
-    Plug 'neoclide/coc.nvim'
+    Plug 'neoclide/coc.nvim', {'branch': 'release'}
 
     Plug 'nvim-treesitter/nvim-treesitter'
     "Plug 'mfussenegger/nvim-dap'
     "Plug 'puremourning/vimspector'
 
     Plug 'nvim-treesitter/nvim-treesitter'
     "Plug 'mfussenegger/nvim-dap'
     "Plug 'puremourning/vimspector'
+
+    """
+    "" avante and its dependents
+    " Deps
+    Plug 'nvim-lua/plenary.nvim'
+    Plug 'MunifTanjim/nui.nvim'
+    Plug 'MeanderingProgrammer/render-markdown.nvim'
+
+    " Optional deps
+    Plug 'hrsh7th/nvim-cmp'
+    Plug 'nvim-tree/nvim-web-devicons' "or Plug 'echasnovski/mini.icons'
+    Plug 'HakonHarnes/img-clip.nvim'
+    Plug 'zbirenbaum/copilot.lua'
+    Plug 'stevearc/dressing.nvim' " for enhanced input UI
+    Plug 'folke/snacks.nvim' " for modern input UI
+
+    " Yay, pass source=true if you want to build from source
+    Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': 'make' }
+    ""
+    ""
+
 call plug#end()
 
 "----------------------
 call plug#end()
 
 "----------------------
@@ -215,11 +239,14 @@ if has_key(plugs, "coc.nvim")
                 \'coc-marketplace',
                 \'coc-highlight',
                 \'coc-clangd',
                 \'coc-marketplace',
                 \'coc-highlight',
                 \'coc-clangd',
-                \'coc-jedi',
-                \'coc-vimlsp',
+                \'coc-pyright',
+                \'coc-lua',
                 \'coc-sh',
                 \'coc-sh',
+                \'coc-cmake',
+                \'coc-xmake',
                 \'coc-json',
                 \'coc-json',
-                \'coc-yaml'
+                \'coc-yaml',
+                \'coc-vimlsp',
                 \]
 endif
 
                 \]
 endif
 
@@ -234,6 +261,12 @@ if has_key(plugs, 'nvim-treesitter')
     set foldlevel=99
 endif
 
     set foldlevel=99
 endif
 
+"----------------------
+" avante.nvim setting
+"----------------------
+if has_key(plugs, 'avante.nvim')
+    lua require('plugin-config/avante')
+endif
 
 nnoremap J :tabprevious<CR>
 nnoremap K :tabnext<CR>
 
 nnoremap J :tabprevious<CR>
 nnoremap K :tabnext<CR>
@@ -250,6 +283,9 @@ nnoremap <silent> <Leader>- :resize -5<CR>
 nnoremap <silent> <Leader>v+ :vertical resize +5<CR>
 nnoremap <silent> <Leader>v- :vertical resize -5<CR>
 
 nnoremap <silent> <Leader>v+ :vertical resize +5<CR>
 nnoremap <silent> <Leader>v- :vertical resize -5<CR>
 
+" shortcut for folding
+nnoremap <silent> <Leader>fi :set foldmethod=indent<CR>
+nnoremap <silent> <Leader>fd :set foldmethod=manual<CR>ggVGzD
 
 "HighLight trailing whitespace"
 highlight ExtraWhitespace ctermbg=red guibg=red
 
 "HighLight trailing whitespace"
 highlight ExtraWhitespace ctermbg=red guibg=red