From 43959c4f9bcc328e51c8ba061c916a41484d8dea Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 10 Mar 2020 22:39:12 +0200 Subject: [PATCH] [nvim] fix filetype preferences for indentation --- nvim/{ => after}/ftplugin/asm.vim | 0 nvim/{ => after}/ftplugin/css.vim | 0 nvim/after/ftplugin/make.vim | 1 + nvim/{ => after}/ftplugin/markdown.vim | 0 nvim/{ => after}/ftplugin/python.vim | 0 nvim/{ => after}/ftplugin/scss.vim | 0 nvim/{ => after}/ftplugin/text.vim | 0 nvim/plugin/editing.vim | 11 +++++++---- nvim/plugin/files.vim | 2 +- 9 files changed, 9 insertions(+), 5 deletions(-) rename nvim/{ => after}/ftplugin/asm.vim (100%) rename nvim/{ => after}/ftplugin/css.vim (100%) create mode 100644 nvim/after/ftplugin/make.vim rename nvim/{ => after}/ftplugin/markdown.vim (100%) rename nvim/{ => after}/ftplugin/python.vim (100%) rename nvim/{ => after}/ftplugin/scss.vim (100%) rename nvim/{ => after}/ftplugin/text.vim (100%) diff --git a/nvim/ftplugin/asm.vim b/nvim/after/ftplugin/asm.vim similarity index 100% rename from nvim/ftplugin/asm.vim rename to nvim/after/ftplugin/asm.vim diff --git a/nvim/ftplugin/css.vim b/nvim/after/ftplugin/css.vim similarity index 100% rename from nvim/ftplugin/css.vim rename to nvim/after/ftplugin/css.vim diff --git a/nvim/after/ftplugin/make.vim b/nvim/after/ftplugin/make.vim new file mode 100644 index 0000000..b3d732f --- /dev/null +++ b/nvim/after/ftplugin/make.vim @@ -0,0 +1 @@ +IndentTabs 2 diff --git a/nvim/ftplugin/markdown.vim b/nvim/after/ftplugin/markdown.vim similarity index 100% rename from nvim/ftplugin/markdown.vim rename to nvim/after/ftplugin/markdown.vim diff --git a/nvim/ftplugin/python.vim b/nvim/after/ftplugin/python.vim similarity index 100% rename from nvim/ftplugin/python.vim rename to nvim/after/ftplugin/python.vim diff --git a/nvim/ftplugin/scss.vim b/nvim/after/ftplugin/scss.vim similarity index 100% rename from nvim/ftplugin/scss.vim rename to nvim/after/ftplugin/scss.vim diff --git a/nvim/ftplugin/text.vim b/nvim/after/ftplugin/text.vim similarity index 100% rename from nvim/ftplugin/text.vim rename to nvim/after/ftplugin/text.vim diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index df84744..35ee2af 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -31,13 +31,16 @@ set commentstring=//%s let g:indentLine_showFirstIndentLevel = 1 let g:indentLine_fileTypeExclude = ['text', 'help', 'tutor', 'man'] - let g:detectindent_preferred_indent = 2 - let g:detectindent_preferred_expandtab = 1 - " let g:detectindent_verbosity = 0 + function s:DetectIndent() + if !empty(&bt) | return | endif + let g:detectindent_preferred_indent = &l:shiftwidth + let g:detectindent_preferred_expandtab = &l:expandtab + DetectIndent + endfunction augroup vimrc-detect-indent autocmd! - autocmd FileType * if empty(&bt) | DetectIndent | endif + autocmd BufReadPost * call s:DetectIndent() augroup END " }}} diff --git a/nvim/plugin/files.vim b/nvim/plugin/files.vim index 7464f88..1daaf62 100644 --- a/nvim/plugin/files.vim +++ b/nvim/plugin/files.vim @@ -4,7 +4,7 @@ set fileformats=unix,dos,mac set wildignore+=.git,.svn,.hg,.DS_Store,*~ " arguably one of the most useful mappings -nnoremap &buftype is# '' ? ":writewall\" : "\" +nnoremap empty(&buftype) ? ":writewall\" : "\" " ripgrep (rg) {{{