diff options
author | tdro <tdro@users.noreply.github.com> | 2025-05-03 00:00:00 +0000 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2025-05-03 00:00:00 +0000 |
commit | fd33a47eaad7ae8f4a95873cec42856a0aa77a47 (patch) | |
tree | 05c7e55b76cc6547a55b13b87d85c0a239155e66 | |
parent | dfe70eb0b3604ced0d6e1c5f3d5b63c6037a7312 (diff) | |
download | dotfiles-fd33a47eaad7ae8f4a95873cec42856a0aa77a47.tar.gz dotfiles-fd33a47eaad7ae8f4a95873cec42856a0aa77a47.tar.bz2 dotfiles-fd33a47eaad7ae8f4a95873cec42856a0aa77a47.zip |
.config/latexindent: Handle package.sty
Avoid mixing tabs and spaces
-rw-r--r-- | .config/latexindent/settings.yaml | 2 | ||||
-rw-r--r-- | .config/vim/vimrc | 2 | ||||
-rwxr-xr-x | .local/bin/wrappers/latexindent | 10 |
3 files changed, 11 insertions, 3 deletions
diff --git a/.config/latexindent/settings.yaml b/.config/latexindent/settings.yaml index 079eef6..e27720b 100644 --- a/.config/latexindent/settings.yaml +++ b/.config/latexindent/settings.yaml @@ -4,7 +4,7 @@ onlyOneBackUp: 1 # Number of backup files in /tmp/ backupExtension: .backup.tex # File ending for /tmp/???.backup.tex -defaultIndent: "\t" # Default indentation +defaultIndent: ' ' # Default indentation modifyLineBreaks: preserveBlankLines: 1 diff --git a/.config/vim/vimrc b/.config/vim/vimrc index 60da595..7f787a5 100644 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -364,6 +364,7 @@ augroup AutoCommands autocmd FileType nix set formatprg=nix-formatprg autocmd FileType php set formatprg=php-formatprg autocmd FileType elixir set formatprg=mix\ format\ - + autocmd FileType tex set formatprg=latexindent\ - autocmd FileType c set formatprg=clang-format\ - autocmd FileType python set formatprg=black\ --quiet\ - autocmd FileType lisp,scheme set formatprg=emacs-batch-indent\ scheme @@ -375,7 +376,6 @@ augroup AutoCommands autocmd FileType html set formatprg=prettier\ --ignore-path\ --parser\ html\ --stdin-filepath\ % autocmd FileType ruby set formatprg=rubocop\ --autocorrect\ --stderr\ --stdin\ %\ 2>\ \/dev\/null autocmd FileType markdown set formatprg=prettier\ --ignore-path\ --parser\ markdown\ --stdin-filepath\ % - autocmd FileType tex set formatprg=latexindent\ --yaml\ 'modifyLineBreaks:oneSentencePerLine:textWrapSentences:0'\ - " Guess filetype from extension when missing autocmd BufRead,BufNewFile * if &filetype == '' | let &filetype = expand('%:e') | endif diff --git a/.local/bin/wrappers/latexindent b/.local/bin/wrappers/latexindent index 4f11b6e..7c7b5ae 100755 --- a/.local/bin/wrappers/latexindent +++ b/.local/bin/wrappers/latexindent @@ -1,6 +1,14 @@ #!/bin/sh -eu + +prefix= + +for final; do :; done; + +[ "${final##*.}" = "sty" ] && prefix='--yaml noAdditionalIndentGlobal:optionalArguments:0,noAdditionalIndentGlobal:mandatoryArguments:0' +[ "${final##*.}" = "-" ] && prefix='--yaml modifyLineBreaks:oneSentencePerLine:textWrapSentences:0' + $(which latexindent --all | grep --invert-match "local/bin" | head -n 1) \ --modifylinebreaks \ --cruft=/tmp \ --local="$HOME/.config/latexindent/settings.yaml" \ - "$@" 2> /dev/null; + $prefix "$@" 2> /dev/null; |