Files
vim-swift-mirror/autoindent.vim
2025-02-07 10:59:24 -08:00

24 lines
529 B
VimL

if empty($OUTPUT_FILE)
echom "Error: Environment variable OUTPUT_FILE is not set."
cquit! 1
endif
set nocompatible
set runtimepath^=$PWD
filetype plugin indent on
syntax on
augroup swiftIndent
autocmd!
autocmd BufRead,BufNewFile *.swift setlocal shiftwidth=4 expandtab
augroup END
" Apply autoindent, save and quit.
function! s:RemoveWhitespaceAndReindent()
silent %s/^\s\+//
normal gg=G
execute 'write ' . fnameescape($OUTPUT_FILE)
quit!
endfunction
autocmd BufReadPost * call s:RemoveWhitespaceAndReindent()