aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-04 01:20:39 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-04 01:20:39 +1200
commit63f8c62db0166e52bd34c6130556b1a768b485f5 (patch)
tree7f235392b429ddf80f158b95a67acc57fd42a762
parentMerge branch 'release/v1.19.0' (diff)
parentBump VERSION to 1.20.0 (diff)
downloaddotfiles-63f8c62db0166e52bd34c6130556b1a768b485f5.tar.gz
dotfiles-63f8c62db0166e52bd34c6130556b1a768b485f5.zip
Merge branch 'release/v1.20.0'v1.20.0
* release/v1.20.0: Bump VERSION to 1.20.0 Rewrite Perl version-number bump Vim funcs Add _v/_V Vim maps for Perl version bumps Use full names of 'cscope...' Vim options Add mked(1df) and mkvi(1df)
-rw-r--r--.gitignore2
-rw-r--r--Makefile2
-rw-r--r--README.md3
-rw-r--r--VERSION4
-rw-r--r--bin/mked.sh6
-rw-r--r--bin/mkvi.sh6
-rw-r--r--man/man1/mked.1df16
-rw-r--r--man/man1/mkvi.1df16
-rw-r--r--vim/after/ftplugin/perl.vim9
-rw-r--r--vim/autoload/perl.vim45
-rw-r--r--vim/system/centos.vim5
11 files changed, 111 insertions, 3 deletions
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/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
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 <tom@sanctum.geek.nz>
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 <tom@sanctum.geek.nz>
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 <buffer> <LocalLeader>c'
\ . '|nunmap <buffer> <LocalLeader>l'
\ . '|nunmap <buffer> <LocalLeader>t'
+
+" Bump version numbers
+nnoremap <buffer> <LocalLeader>v
+ \ :<C-U>call perl#BumpVersionMinor()<CR>
+nnoremap <buffer> <LocalLeader>V
+ \ :<C-U>call perl#BumpVersionMajor()<CR>
+let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|nunmap <buffer> <LocalLeader>v'
+ \ . '|nunmap <buffer> <LocalLeader>V'
diff --git a/vim/autoload/perl.vim b/vim/autoload/perl.vim
new file mode 100644
index 00000000..5349eb49
--- /dev/null
+++ b/vim/autoload/perl.vim
@@ -0,0 +1,45 @@
+" 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: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
+ echomsg 'Bumped major $VERSION: '.l:version
+ else
+ echomsg 'Bumped minor $VERSION: '.l:version
+ endif
+ 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
+
+" 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
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')