From 79dfc83485bfb3a5d171513bcf581749bbe02cf7 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 3 Jul 2018 17:07:38 +1200 Subject: Add mked(1df) and mkvi(1df) --- .gitignore | 2 ++ Makefile | 2 ++ README.md | 3 +++ bin/mked.sh | 6 ++++++ bin/mkvi.sh | 6 ++++++ man/man1/mked.1df | 16 ++++++++++++++++ man/man1/mkvi.1df | 16 ++++++++++++++++ 7 files changed, 51 insertions(+) create mode 100644 bin/mked.sh create mode 100644 bin/mkvi.sh create mode 100644 man/man1/mked.1df create mode 100644 man/man1/mkvi.1df diff --git a/.gitignore b/.gitignore index f809b6f8..98ac8372 100644 --- a/.gitignore +++ b/.gitignore @@ -66,8 +66,10 @@ bin/mim.sh bin/mim.m4 bin/min bin/mkcp +bin/mked bin/mkmv bin/mktd +bin/mkvi bin/mode bin/motd bin/murl diff --git a/Makefile b/Makefile index 03f2740b..c64d5ce3 100644 --- a/Makefile +++ b/Makefile @@ -145,8 +145,10 @@ BINS = bin/ap \ bin/mim \ bin/min \ bin/mkcp \ + bin/mked \ bin/mkmv \ bin/mktd \ + bin/mkvi \ bin/mode \ bin/motd \ bin/murl \ diff --git a/README.md b/README.md index 85342e14..9792a162 100644 --- a/README.md +++ b/README.md @@ -489,6 +489,9 @@ Installed by the `install-bin` target: pipeline. * `ped(1df)` runs `pst(1df)` with `$EDITOR` or `ed(1)`. * `pvi(1df)` runs `pvi(1df)` with `$VISUAL` or `vi(1)`. +* Two editor wrapper tools: + * `mked(1df)` creates paths to all its arguments before invoking `$EDITOR`. + * `mkvi(1df)` creates paths to all its arguments before invoking `$VISUAL`. * `ap(1df)` reads arguments for a given command from the standard input, prompting if appropriate. * `apf(1df)` inserts arguments to a command with ones read from a file, diff --git a/bin/mked.sh b/bin/mked.sh new file mode 100644 index 00000000..4e280205 --- /dev/null +++ b/bin/mked.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Create paths to all files before invoking editor +for file ; do + mkdir -p -- "${file%/*}" || exit +done +exec "$EDITOR" "$@" diff --git a/bin/mkvi.sh b/bin/mkvi.sh new file mode 100644 index 00000000..244b89f8 --- /dev/null +++ b/bin/mkvi.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Create paths to all files before invoking editor +for file ; do + mkdir -p -- "${file%/*}" || exit +done +exec "$VISUAL" "$@" diff --git a/man/man1/mked.1df b/man/man1/mked.1df new file mode 100644 index 00000000..202ba386 --- /dev/null +++ b/man/man1/mked.1df @@ -0,0 +1,16 @@ +.TH MKVI 1df "July 2018" "Manual page for mked" +.SH NAME +.B mked +\- create paths to all argument files before invoking $EDITOR +.SH SYNOPSIS +.B mked +file0 dir1/file1 dir2/subdir/file2 +.SH DESCRIPTION +.B mked +iterates through its arguments and creates the full paths to each of them +before running $EDITOR with the same arguments. If the directory creation +fails, the script stops before invoking the editor. +.SH SEE ALSO +mked(1) +.SH AUTHOR +Tom Ryder diff --git a/man/man1/mkvi.1df b/man/man1/mkvi.1df new file mode 100644 index 00000000..f0f215d4 --- /dev/null +++ b/man/man1/mkvi.1df @@ -0,0 +1,16 @@ +.TH MKVI 1df "July 2018" "Manual page for mkvi" +.SH NAME +.B mkvi +\- create paths to all argument files before invoking $VISUAL +.SH SYNOPSIS +.B mkvi +file0 dir1/file1 dir2/subdir/file2 +.SH DESCRIPTION +.B mkvi +iterates through its arguments and creates the full paths to each of them +before running $VISUAL with the same arguments. If the directory creation +fails, the script stops before invoking the editor. +.SH SEE ALSO +mked(1) +.SH AUTHOR +Tom Ryder -- cgit v1.2.3 From e34e82a35e04c4bb457ab8b81382a13759d0c31d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 3 Jul 2018 17:09:09 +1200 Subject: Use full names of 'cscope...' Vim options --- vim/system/centos.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vim/system/centos.vim b/vim/system/centos.vim index 26289bf8..0c5854d4 100644 --- a/vim/system/centos.vim +++ b/vim/system/centos.vim @@ -9,7 +9,10 @@ if has('cmdline_info') set ruler& endif if has('cscope') - set csprg& cst& csto& csverb& + set cscopeprg& + set cscopetag& + set cscopetagorder& + set cscopeverbose& silent! cs kill endif if has('gui') -- cgit v1.2.3 From af3569d8a74c744770e77f2b2b8d7956c5d6f8c0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 3 Jul 2018 17:30:38 +1200 Subject: Add _v/_V Vim maps for Perl version bumps --- vim/after/ftplugin/perl.vim | 9 +++++++++ vim/autoload/perl.vim | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 vim/autoload/perl.vim diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index e9747aa3..37cd1c08 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -25,3 +25,12 @@ let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap c' \ . '|nunmap l' \ . '|nunmap t' + +" Bump version numbers +nnoremap v + \ :call perl#BumpVersionMinor() +nnoremap V + \ :call perl#BumpVersionMajor() +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap v' + \ . '|nunmap V' diff --git a/vim/autoload/perl.vim b/vim/autoload/perl.vim new file mode 100644 index 00000000..ca9b2990 --- /dev/null +++ b/vim/autoload/perl.vim @@ -0,0 +1,28 @@ +" Quick-and-dirty version number bumper +function! perl#BumpVersion(major) abort + let l:view = winsaveview() + let l:search = @/ + let l:li = search('\C^our \$VERSION\s*=') + if !l:li + echomsg 'No version number declaration found' + return + endif + if a:major + silent execute "normal! /[0-9]\\" + echomsg 'Major version bumped: '.getline('.') + else + silent execute "normal! $?[0-9]\\" + echomsg 'Minor version bumped: '.getline('.') + endif + let @/ = l:search + call winrestview(l:view) +endfunction + +" Explanatory wrappers +function! perl#BumpVersionMinor() abort + call perl#BumpVersion(0) +endfunction + +function! perl#BumpVersionMajor() abort + call perl#BumpVersion(1) +endfunction -- cgit v1.2.3 From b8f2d8948c2fe0abd7644664b117760d63888e99 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 4 Jul 2018 01:18:13 +1200 Subject: Rewrite Perl version-number bump Vim funcs --- vim/autoload/perl.vim | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/vim/autoload/perl.vim b/vim/autoload/perl.vim index ca9b2990..5349eb49 100644 --- a/vim/autoload/perl.vim +++ b/vim/autoload/perl.vim @@ -1,20 +1,32 @@ -" Quick-and-dirty version number bumper +" Version number specifier format +let g:perl#verpat = '\m\C^' + \ . '\(our\s\+\$VERSION\s*=\D*\)' + \ . '\(\d\+\)\.\(\d\+\)' + \ . '\(.*\)' + +" Version number bumper function! perl#BumpVersion(major) abort let l:view = winsaveview() - let l:search = @/ - let l:li = search('\C^our \$VERSION\s*=') + let l:li = search(g:perl#verpat) if !l:li echomsg 'No version number declaration found' return endif + let l:matches = matchlist(getline(l:li), g:perl#verpat) + let [l:lvalue, l:major, l:minor, l:rest] + \ = matchlist(getline(l:li), g:perl#verpat)[1:4] + if a:major + let l:major = perl#Incf(l:major) + else + let l:minor = perl#Incf(l:minor) + endif + let l:version = l:major.'.'.l:minor + call setline(l:li, l:lvalue.l:version.l:rest) if a:major - silent execute "normal! /[0-9]\\" - echomsg 'Major version bumped: '.getline('.') + echomsg 'Bumped major $VERSION: '.l:version else - silent execute "normal! $?[0-9]\\" - echomsg 'Minor version bumped: '.getline('.') + echomsg 'Bumped minor $VERSION: '.l:version endif - let @/ = l:search call winrestview(l:view) endfunction @@ -22,7 +34,12 @@ endfunction function! perl#BumpVersionMinor() abort call perl#BumpVersion(0) endfunction - function! perl#BumpVersionMajor() abort call perl#BumpVersion(1) endfunction + +" Helper function to format a number without decreasing its digit count +function! perl#Incf(num) abort + let l:inc = a:num + 1 + return repeat('0', strlen(a:num) - strlen(l:inc)).l:inc +endfunction -- cgit v1.2.3 From 7fc7add7cff85337ba0d486715ef9f77b221176a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 4 Jul 2018 01:20:21 +1200 Subject: Bump VERSION to 1.20.0 --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 04165f64..244e4c17 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v1.19.0 -Tue Jul 3 01:53:55 UTC 2018 +tejr dotfiles v1.20.0 +Tue Jul 3 13:20:13 UTC 2018 -- cgit v1.2.3