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

Add folding support for JSON files

This commit is contained in:
jdhao 2023-06-13 22:24:31 +02:00
parent 6c873a32da
commit ee38046ebc
3 changed files with 10 additions and 1 deletions

6
after/ftplugin/json.vim Normal file
View File

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

View File

@ -1,5 +1,5 @@
require("nvim-treesitter.configs").setup {
ensure_installed = { "python", "cpp", "lua", "vim" },
ensure_installed = { "python", "cpp", "lua", "vim", "json" },
ignore_install = {}, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension

View File

@ -45,3 +45,6 @@ function! s:md_to_pdf() abort
echoerr "Error running command"
endif
endfunction
" json format
command! -range JSONFormat <line1>,<line2>!python -m json.tool