From 26ee24272153b33255e19ca586c67c8d7d56036d Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 17 Jan 2020 20:33:06 +0200 Subject: [PATCH] [nvim] add indent detection --- nvim/init.vim | 2 +- nvim/plugin/editing.vim | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/nvim/init.vim b/nvim/init.vim index 1c9bf26..e2e3313 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -36,10 +36,10 @@ Plug 'junegunn/vim-plug' Plug 'Yggdroot/indentLine' Plug 'henrik/vim-indexed-search' Plug 'andymass/vim-matchup' - " Plug 'tommcdo/vim-exchange' Plug 'inkarkat/vim-ingo-library' " required by LineJuggler Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } Plug 'reedes/vim-pencil' + Plug 'ciaranm/detectindent' " }}} " Text objects {{{ diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index 369f3f8..590a550 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -6,6 +6,7 @@ set virtualedit=onemore set foldmethod=marker +" use line C-style comments instead of block ones (/* ... */) set commentstring=//%s @@ -30,6 +31,15 @@ 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 + + augroup vimrc-detect-indent + autocmd! + autocmd FileType * if empty(&bt) | DetectIndent | endif + augroup END + " }}}