From 8af82218255fe32d697fc54af8848491f48ded6e Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Mon, 4 Apr 2022 00:17:46 +0300 Subject: [PATCH] refac(prog/nvim): enable folding for rust,js,ts --- programs/nvim/init.vim | 7 ------- programs/nvim/plugins/base-fold-opt.vim | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 programs/nvim/plugins/base-fold-opt.vim diff --git a/programs/nvim/init.vim b/programs/nvim/init.vim index 4fd119e..406577e 100644 --- a/programs/nvim/init.vim +++ b/programs/nvim/init.vim @@ -35,13 +35,6 @@ aug filetype_md aug END " }}} -" Vimscript file settings {{{ -aug filetype_vim - au! - au FileType vim setlocal foldmethod=marker foldcolumn=1 foldlevelstart=0 -aug END -" }}} - " Plugins {{{ call plug#begin() Plug 'junegunn/seoul256.vim' " theme diff --git a/programs/nvim/plugins/base-fold-opt.vim b/programs/nvim/plugins/base-fold-opt.vim new file mode 100644 index 0000000..0e95f52 --- /dev/null +++ b/programs/nvim/plugins/base-fold-opt.vim @@ -0,0 +1,22 @@ +aug config_fold + au! + au FileType * call ConfigFold() +aug END + +function! s:ConfigFold() + let l:ft = &g:filetype + + if l:ft ==# 'vim' + call SetlFold('marker', 0) + elseif l:ft ==# 'markdown' + return + else + call SetlFold('syntax', 99) + endif +endfunction + +function! s:SetlFold(method, lvl) + let &foldmethod = a:method + let &foldlevel = a:lvl + let &foldcolumn = 1 +endfunction