[nvim] fix filetype preferences for indentation

This commit is contained in:
Dmytro Meleshko 2020-03-10 22:39:12 +02:00
parent 1bca05325f
commit 43959c4f9b
9 changed files with 9 additions and 5 deletions

View file

@ -0,0 +1 @@
IndentTabs 2

View file

@ -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
" }}}

View file

@ -4,7 +4,7 @@ set fileformats=unix,dos,mac
set wildignore+=.git,.svn,.hg,.DS_Store,*~
" arguably one of the most useful mappings
nnoremap <silent><expr> <CR> &buftype is# '' ? ":write<bar>wall\<CR>" : "\<CR>"
nnoremap <silent><expr> <CR> empty(&buftype) ? ":write<bar>wall\<CR>" : "\<CR>"
" ripgrep (rg) {{{