1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Martin
dbb8190a93
Merge 4d289d16b3f619e12b62b8971db6818c420e39eb into ce1e13e2c9782dc4c11478092744e49e3459b77a 2024-07-15 21:06:33 +02:00
jdhao
ce1e13e2c9 use plugin nvim-autopairs for autopair
delimitMate is not updated for a long time.
2024-07-14 05:17:49 +08:00
martin
4d289d16b3 update nvim-ufo 2024-01-24 22:50:18 +08:00
martin
90a0645d42 add nvim-ufo for folding 2024-01-19 15:44:08 +08:00
7 changed files with 38 additions and 17 deletions

View File

@ -64,7 +64,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
+ Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim). + Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim).
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF). + Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary). + Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
+ Faster matching pair insertion and jump via [delimitMate](https://github.com/Raimondi/delimitMate). + Faster matching pair insertion and jump via [nvim-autopairs](https://github.com/windwp/nvim-autopairs).
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich). + Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
+ Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim). + Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim).
+ Powerful snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips). + Powerful snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips).

View File

@ -34,6 +34,3 @@ function s:create_term_buf(_type, size) abort
endif endif
execute 'resize ' . a:size execute 'resize ' . a:size
endfunction endfunction
" For delimitMate
let b:delimitMate_matchpairs = "(:),[:],{:}"

View File

@ -1,6 +1,2 @@
" let the initial folding state be that all folds are closed. " let the initial folding state be that all folds are closed.
set foldlevel=0 setlocal foldlevel=0
" Use nvim-treesitter for folding
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()

View File

@ -4,9 +4,6 @@ set formatoptions-=r
nnoremap <buffer><silent> <F9> :luafile %<CR> nnoremap <buffer><silent> <F9> :luafile %<CR>
" For delimitMate
let b:delimitMate_matchpairs = "(:),[:],{:}"
" Use nvim-treesitter for folding " Use nvim-treesitter for folding
set foldmethod=expr set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr() set foldexpr=nvim_treesitter#foldexpr()

View File

@ -13,9 +13,6 @@ set softtabstop=4 " number of spaces in tab when editing
set shiftwidth=4 " number of spaces to use for autoindent set shiftwidth=4 " number of spaces to use for autoindent
set expandtab " expand tab to spaces so that tabs are spaces set expandtab " expand tab to spaces so that tabs are spaces
" For delimitMate
let b:delimitMate_matchpairs = "(:),[:],{:}"
" Use nvim-treesitter for folding " Use nvim-treesitter for folding
set foldmethod=expr set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr() set foldexpr=nvim_treesitter#foldexpr()

22
lua/config/ufo.lua Normal file
View File

@ -0,0 +1,22 @@
local keymap = vim.keymap
-- disable foldcolumn, see https://github.com/kevinhwang91/nvim-ufo/issues/4
vim.o.foldcolumn = '0'
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true -- Don't set nofoldenable in ftplugin
-- treesitter as a main provider instead
-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return {'treesitter', 'indent'}
end
})
local ufo = require('ufo')
keymap.set('n', 'zR', ufo.openAllFolds, { desc = 'Open all folds' })
keymap.set('n', 'zM', ufo.closeAllFolds, { desc = 'Close all folds' })
keymap.set('n', 'zr', ufo.openFoldsExceptKinds, { desc = 'Fold less' })
keymap.set('n', 'zm', ufo.closeFoldsWith, { desc = 'Fold more' })

View File

@ -50,7 +50,7 @@ local plugin_specs = {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
enabled = function() enabled = function()
if vim.g.is_mac then if vim.g.is_mac or vim.g.is_linux then
return true return true
end end
return false return false
@ -221,7 +221,11 @@ local plugin_specs = {
}, event = "InsertEnter" }, }, event = "InsertEnter" },
-- Automatic insertion and deletion of a pair of characters -- Automatic insertion and deletion of a pair of characters
{ "Raimondi/delimitMate", event = "InsertEnter" }, {
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
},
-- Comment plugin -- Comment plugin
{ "tpope/vim-commentary", event = "VeryLazy" }, { "tpope/vim-commentary", event = "VeryLazy" },
@ -488,6 +492,14 @@ local plugin_specs = {
require("config.fidget-nvim") require("config.fidget-nvim")
end, end,
}, },
{
'kevinhwang91/nvim-ufo',
dependencies = {'kevinhwang91/promise-async'},
event = { "VeryLazy" },
config = function()
require("config.ufo")
end
}
} }
-- configuration for lazy itself. -- configuration for lazy itself.