Compare commits

..

2 Commits

Author SHA1 Message Date
6d2fbc2ac5 Add cmake surround for generator expressions 2019-04-04 17:24:32 +01:00
72fe59ffaa Only invoke last change substitution in help files
Previously the `autocmd` to replace the date on the first line if `Last
change: ` was present resulted in the cursor being moved in non `help`
filetypes due to the substitution failing. Now the substitution is only
attempted if the current file is a `help` file.
2019-04-04 16:53:46 +01:00
3 changed files with 14 additions and 2 deletions

View File

@ -7,5 +7,9 @@ setlocal foldmethod=syntax
setlocal commentstring=#%s
" Custon surround for creating a CMake variable from a text object.
" "ys{motion}v" makes a variable out of "<text-obj>" - > "${<text-obj>}"
" "ys{motion}v" makes a variable out of "text-obj" -> "${text-obj}"
let b:surround_{char2nr("v")} = "${\r}"
" Custom surround for createing a CMake generator expression from a test object.
" "ys{motion}g" makes a generator expression out of "text-obj" -> "$<text-obj>"
let b:surround_{char2nr("g")} = "$<\r>"

View File

@ -78,3 +78,11 @@ function! do#debug(...)
endfor
exec l:command
endfunction
function! do#last_change()
if &filetype ==# 'help'
" vint: next-line -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
1s/Last change: \zs.*$/\=strftime('%Y %b %d')/e
norm!``
endif
endfunction

View File

@ -9,7 +9,7 @@ augroup benieAugroup
au FileType * call matchadd('Todo', '^\(<<<<<<<\||||||||\|=======\|>>>>>>>\)\s\ze.*$')
" Update `Last change: <date>` on write then jump back previous position
au BufWritePost *.txt 1s/Last change: \zs.*$/\=strftime('%Y %b %d')/e|norm!``
au BufWritePost *.txt silent! call do#last_change()
" Read template into buffer then send line 1 to the black hold register
au BufNewFile todo.md read ~/.vim/templates/skeleton.todo.md | 1delete _