diff --git a/after/ftplugin/json.vim b/after/ftplugin/json.vim new file mode 100644 index 0000000..90db3ec --- /dev/null +++ b/after/ftplugin/json.vim @@ -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() diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua index 92759d3..ee07b83 100644 --- a/lua/config/treesitter.lua +++ b/lua/config/treesitter.lua @@ -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 diff --git a/plugin/command.vim b/plugin/command.vim index 5ed7b73..68b11f4 100644 --- a/plugin/command.vim +++ b/plugin/command.vim @@ -45,3 +45,6 @@ function! s:md_to_pdf() abort echoerr "Error running command" endif endfunction + +" json format +command! -range JSONFormat ,!python -m json.tool