From 732ed6e01a17c1fb8b8b836a9995c244d688452e Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 19 Aug 2022 10:04:54 +0300 Subject: [PATCH] nix/prog/nvim: move folding augroup to lua --- nix/progs/nvim/config.vim | 8 -------- nix/progs/nvim/lua/basic.lua | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/nix/progs/nvim/config.vim b/nix/progs/nvim/config.vim index 006155b..9d2570c 100644 --- a/nix/progs/nvim/config.vim +++ b/nix/progs/nvim/config.vim @@ -1,9 +1 @@ lua require('basic') - -" Set up folding -aug folding - au! - au BufNewFile,BufRead *.js,*.jsx syntax on | setlocal foldmethod=syntax - au BufNewFile,BufRead *.ts,*.tsx syntax on | setlocal foldmethod=syntax -aug END - diff --git a/nix/progs/nvim/lua/basic.lua b/nix/progs/nvim/lua/basic.lua index 033fe24..4b99486 100644 --- a/nix/progs/nvim/lua/basic.lua +++ b/nix/progs/nvim/lua/basic.lua @@ -136,6 +136,21 @@ vim.api.nvim_create_autocmd(bufReadFile, { callback = function () vim.wo.spell = true end, }) +local folding_augroup = vim.api.nvim_create_augroup('folding', {}) +vim.api.nvim_create_augroup(bufReadFile, { + group = folding_augroup, + pattern = { + '*.js', + '*.jsx', + '*.ts', + '*.tsx', + }, + callback = function () + vim.cmd 'syntax on' + vim.wo.foldmethod = 'syntax' + end, +}) + ------------------------------------------------------------------------------- --