dotfiles

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

commit 7d9cb8e3aa8ba38e96c63ba06782508b00b3ae50
parent c4e9d7008ce21d17b058b538824c3e1154f18206
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Fri,  3 Aug 2018 20:05:16 -0400

Vimrc MySkeleton improvements

1. Use three-part comments if available
2. Fix &comments for Java files

Diffstat:
M.vim/after/ftplugin/java.vim | 4++++
M.vim/skel/mit.skel | 2--
M.vim/skel/reserved.skel | 2--
M.vim/vimrc | 22++++++++++++++++++++--
4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/.vim/after/ftplugin/java.vim b/.vim/after/ftplugin/java.vim @@ -8,3 +8,7 @@ setlocal sts=2 sw=2 setlocal tw=120 compiler javac + +execute InitializeClasspath() | execute BuildJavaMakeprg() + +let &comments='sr:/*,mb:*,ex:*/,b://' diff --git a/.vim/skel/mit.skel b/.vim/skel/mit.skel @@ -1,4 +1,3 @@ - The MIT License (MIT) Copyright (c) {{ year }} Daniel Moch @@ -20,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/.vim/skel/reserved.skel b/.vim/skel/reserved.skel @@ -1,3 +1 @@ - Copyright (c) {{ year }}, Daniel Moch. All rights reserved. - diff --git a/.vim/vimrc b/.vim/vimrc @@ -125,22 +125,40 @@ function! MySkeleton() endif let l:skel = readfile(l:skelfiles[l:selection - 1]) let l:comments = split(&comments, ',') + let l:idx = 0 for l:token in l:comments - if l:token =~ '^b\?:' + 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 + 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:rightalign = v:false + let l:space = (l:token =~ '^b') ? ' ' : '' + let l:endspace = '' endif + break endfor let l:idx = 0 for l:line in l:skel if l:line =~ "^$" let l:line = l:comment else - let l:line = l:comment .' '. l:line + let l:line = l:comment . l:space . l:line endif let l:line = substitute(l:line, '{{ year }}', "\\=strftime('%Y')", '') let l:skel[l:idx] = l:line let l:idx += 1 endfor + let l:skel = [l:firstcomment] + l:skel + [l:endspace . l:lastcomment] let l:lines = join(l:skel, "\n") silent execute '0put =printf(\"%s\", l:lines)'