vim: indentation

This commit is contained in:
Michael Grote 2023-08-31 08:21:53 +02:00
parent 7c196c4427
commit 06b166602b

15
.vimrc
View file

@ -45,6 +45,12 @@ call vundle#end()
let mapleader = "," let mapleader = ","
" ### allgemeine Optionen " ### allgemeine Optionen
" indentation
" https://vim.fandom.com/wiki/Indenting_source_code
set expandtab
set shiftwidth=2
set softtabstop=2
" ### Suche " ### Suche
" While typing a search command, show immediately where the so far typed pattern matches. " While typing a search command, show immediately where the so far typed pattern matches.
set incsearch set incsearch
@ -194,7 +200,7 @@ nnoremap <Leader>sc :ShellCheck!<CR>
" format paragraphs as markdown table " format paragraphs as markdown table
nnoremap <Leader>mm Vap:EasyAlign *\|<cr><esc> nnoremap <Leader>mm Vap:EasyAlign *\|<cr><esc>
nnoremap <F7> Vap:EasyAlign *\|<cr><esc> nnoremap <F7> Vap:EasyAlign *\|<cr><esc>
"
" lasse Y wie C oder D funktionieren " lasse Y wie C oder D funktionieren
nmap Y y$ nmap Y y$
@ -264,6 +270,13 @@ nnoremap <F9> :call Whitespaces_all()<CR>
" entferne trailing whitespaces beim speichern " entferne trailing whitespaces beim speichern
autocmd BufWritePre * :call Whitespaces_trailing() autocmd BufWritePre * :call Whitespaces_trailing()
" fix indentation/auto formatting
function! Fix_indentation()
if filetype ==# 'yaml' || filetype ==# 'bash'
autocmd BufWritePre * :normal gg=G
endif
endfunction
" Exit Vim if NERDTree is the only window remaining in the only tab. " Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" NERDTree - show hidden files " NERDTree - show hidden files