Shell header template
Automatically populate filename, creation date and modification date in shell header. Also add the ability to update header on old scripts
This commit is contained in:
8
.vimrc
8
.vimrc
@@ -340,10 +340,10 @@ autocmd bufWritePost,filewritepost *.md execute "normal `a"
|
||||
|
||||
autocmd BufNewFile *.sh so $HOME/.vim/templates/sh
|
||||
autocmd BufNewFile *.sh %s/FILE:.*/\='FILE: '.expand('%:t:r')/e
|
||||
autocmd BufNewFile *.sh exe "g/CREATED:.*/s//CREATED: " .strftime("%c")
|
||||
autocmd BufNewFile *.sh exe "g/CREATED:.*/s//CREATED: " .strftime("%Y-%m-%d")
|
||||
autocmd BufNewFile *.sh exe "normal Go"
|
||||
autocmd BufWritePre,filewritepre *.sh execute "normal ma"
|
||||
autocmd BufWritePre,filewritepre *.sh exe "g/UPDATED:.*/s//UPDATED: " .strftime("%c")
|
||||
autocmd BufWritePre,filewritepre *.sh exe "g/UPDATED:.*/s//UPDATED: " .strftime("%Y-%m-%d %H:%M")
|
||||
autocmd bufWritePost,filewritepost *.sh execute "normal `a"
|
||||
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
@@ -357,13 +357,13 @@ nnoremap ,ban :-1read $HOME/.vim/templates/banner<CR>jA
|
||||
nnoremap ,begend :-1read $HOME/.vim/templates/begend<CR>jA
|
||||
|
||||
" section shell script header
|
||||
"nnoremap ,sh :-1read $HOME/.vim/templates/sh<CR>jA
|
||||
nnoremap ,sh :0read $HOME/.vim/templates/sh<CR> <bar> :1<CR>dd <bar> :%s/filename/\=expand('%:t')/g<CR>
|
||||
|
||||
" section readinglist header
|
||||
nnoremap ,rl :0read $HOME/.vim/templates/readinglist<CR> <bar> :1<CR>dd $
|
||||
|
||||
" section markdown file header
|
||||
nnoremap ,md :0read $HOME/.vim/templates/md<CR> <bar> :1<CR>dd <bar> :%s/filename/\=expand('%:t:r')/g<CR>
|
||||
nnoremap ,md :0read $HOME/.vim/templates/md<CR> <bar> :1<CR>dd <bar> :4%s/filename/\=expand('%:t:r')/g<CR>
|
||||
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> NetrwTreeListing readonly fix (https://vi.stackexchange.com/a/13012)
|
||||
|
||||
Reference in New Issue
Block a user