set undofile
" auto added comment leader, detail for :h formatoptions
-set formatoptions+=/
+set formatoptions+=/ro
set tags=tags~;,tags~
"setting gf (go file) path
Plug 'Yggdroot/indentLine'
Plug 'christoomey/vim-tmux-navigator'
Plug 'vim-airline/vim-airline'
- "Plug 'vim-airline/vim-airline-themes'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'airblade/vim-gitgutter'
Plug 'kdheepak/lazygit.nvim'
- "Plug 'ycm-core/YouCompleteMe'
- "Plug 'rhysd/vim-clang-format'
-
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'nvim-treesitter/nvim-treesitter'
- "Plug 'mfussenegger/nvim-dap'
- "Plug 'puremourning/vimspector'
"""
"" avante and its dependents
nnoremap <leader>t :TagbarToggle<CR>
endif
-"----------------------
-" YouCompleteMe setting
-"----------------------
-if has_key(plugs, 'YouCompleteMe')
- let g:ycm_global_ycm_extra_conf = '~/.config/nvim/ycm_extra_conf.py'
- let g:ycm_confirm_extra_conf = 0
- let g:ycm_enable_diagnostic_signs = 0
- let g:ycm_always_populate_location_list = 1
- "let g:ycm_show_diagnostics_ui = 0
- let g:ycm_add_preview_to_completeopt = 1
- let g:ycm_autoclose_preview_window_after_completion = 1
- let g:ycm_auto_hover = 'no'
-
- nnoremap <silent> <leader>gd :YcmCompleter GoTo<CR>
- nnoremap <silent> <leader>gr :YcmCompleter GoToReferences<CR>
-endif
-
"----------------------
" coc.vim setting
"----------------------
if has_key(plugs, 'nvim-treesitter')
lua require('plugin-config/nvim-treesitter')
- set foldmethod=expr
+ "set foldmethod=expr
+ set foldmethod=indent
set foldexpr=nvim_treesitter#foldexpr()
set foldlevel=99
endif
nnoremap <silent> <Leader>fi :set foldmethod=indent<CR>
nnoremap <silent> <Leader>fd :set foldmethod=manual<CR>ggVGzD
+" 禁用 <C-a>
+nnoremap <C-a> <Nop>
+xnoremap <C-a> <Nop>
+
"HighLight trailing whitespace"
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
-require'nvim-treesitter.configs'.setup {
- --[[
- ]]
- -- A list of parser names, or "all" (the five listed parsers should always be installed)
- ensure_installed = {
- "c", "cpp", "python", "lua", "bash",
- "cmake", "make",
- "json", "yaml",
- "vim", "vimdoc",
- "query", "regex", "comment", "markdown",
- },
-
- -- Install parsers synchronously (only applied to `ensure_installed`)
- sync_install = false,
+require'nvim-treesitter'.setup {
+ -- A list of parser names, or "all"
+ ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
- auto_install = false,
-
- -- List of parsers to ignore installing (or "all")
- ignore_install = { "javascript" },
-
- ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
- -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
+ auto_install = true,
highlight = {
enable = true,
- -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
- -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
- -- the name of the parser)
- -- list of language that will be disabled
- disable = { "c", "rust" },
- -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
+ -- to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
+ local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-
- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
- -- Using this option may slow down your editor, and you may see some duplicate highlights.
- -- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
-
- -- Incremental selection based on the named nodes from the grammar.
- incremental_selection = {
- enable = true,
- keymaps = {
- init_selection = '<CR>',
- node_incremental = '<CR>',
- node_decremental = '<BS>',
- scope_incremental = '<TAB>',
- }
- },
-
- -- Indentation based on treesitter for the = operator. NOTE: This is an experimental feature.
- indent = {
- enable = false
- }
}