dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 0fb5c8034907ac299a990ebbcb46b9479bbf1262
parent 7d9cb8e3aa8ba38e96c63ba06782508b00b3ae50
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sat,  4 Aug 2018 09:14:39 -0400

Vimrc: Improve handling of new LICENSE files

Diffstat:
A.vim/ftdetect/LICENSE.vim | 1+
A.vim/ftplugin/LICENSE.vim | 1+
M.vim/vimrc | 22+++++++++++++---------
3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/.vim/ftdetect/LICENSE.vim b/.vim/ftdetect/LICENSE.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead LICENSE set filetype=LICENSE diff --git a/.vim/ftplugin/LICENSE.vim b/.vim/ftplugin/LICENSE.vim @@ -0,0 +1 @@ +setlocal comments= diff --git a/.vim/vimrc b/.vim/vimrc @@ -126,24 +126,28 @@ function! MySkeleton() let l:skel = readfile(l:skelfiles[l:selection - 1]) let l:comments = split(&comments, ',') let l:idx = 0 + let l:firstcomment = '' + let l:comment = '' + let l:endspace = '' + let l:lastcomment = '' + let l:space = '' for l:token in l:comments if l:token =~ '^s' let l:firstcomment = substitute(l:token, '^s.\+:', '', '') let l:comment = substitute(l:comments[l:idx + 1], '^m.\+:', '', '') - let l:endspace = repeat(' ', len(l:firstcomment) - len(l:comment)) - let l:comment = (l:token =~ '^sr') ? - \ repeat(' ', len(l:firstcomment) - - \ len(l:comment)) . l:comment - \ : l:comment + if l:token =~ '^sr' + let l:offset = len(l:firstcomment) - len(l:comment) + let l:comment = repeat(' ', l:offset) . l:comment + let l:endspace = repeat(' ', l:offset) + endif let l:lastcomment = substitute(l:comments[l:idx + 2], '^e.\+:', '', '') let l:space = (l:comments[l:idx + 1] =~ '^mb') ? ' ' : '' elseif l:token =~ '^b\?:' let l:comment = substitute(l:token, '^b\?:', '', '') - let l:firstcomment = substitute(l:token, '^b\?:', '', '') - let l:lastcomment = substitute(l:token, '^b\?:', '', '') + let l:firstcomment = l:comment + let l:lastcomment = l:comment let l:rightalign = v:false let l:space = (l:token =~ '^b') ? ' ' : '' - let l:endspace = '' endif break endfor @@ -318,7 +322,7 @@ augroup myvimrc autocmd QuickFixCmdPost l* nested lwindow autocmd QuickFixCmdPre [^l]* nested silent! cclose autocmd QuickFixCmdPre l* nested silent! lclose - autocmd BufNewFile Makefile,*.py,*.cpp,*.java call MySkeleton() + autocmd BufNewFile Makefile,*.py,*.cpp,*.java,LICENSE call MySkeleton() autocmd VimEnter * let w:active_window = 1 | call MyItalicize() | call MyDiffOpt() autocmd WinEnter * let w:active_window = 1 autocmd WinLeave * unlet! w:active_window