diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | man/man7/dotfiles.7df | 10 | ||||
-rw-r--r-- | vim/after/ftplugin/perl.vim | 17 | ||||
-rw-r--r-- | vim/autoload/perl.vim | 45 | ||||
m--------- | vim/bundle/perl_version_bump | 0 | ||||
-rw-r--r-- | vim/filetype.vim | 68 | ||||
-rw-r--r-- | vim/vimrc | 13 |
8 files changed, 65 insertions, 95 deletions
diff --git a/.gitmodules b/.gitmodules index 6f4c3e62..390e7400 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,6 +52,9 @@ [submodule "vim/bundle/markdown_autoformat"] path = vim/bundle/markdown_autoformat url = https://sanctum.geek.nz/code/vim-markdown-autoformat.git +[submodule "vim/bundle/perl_version_bump"] + path = vim/bundle/perl_version_bump + url = https://sanctum.geek.nz/code/vim-perl-version-bump.git # My Vim colorschemes [submodule "vim/bundle/juvenile"] @@ -1,2 +1,2 @@ -tejr dotfiles v1.20.0 -Tue Jul 3 13:20:13 UTC 2018 +tejr dotfiles v1.21.0 +Wed Jul 4 05:03:12 UTC 2018 diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index f8f6a453..7c4d410e 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -732,6 +732,16 @@ along a pipeline. \f[C]vi(1)\f[]. .RE .IP \[bu] 2 +Two editor wrapper tools: +.RS 2 +.IP \[bu] 2 +\f[C]mked(1df)\f[] creates paths to all its arguments before invoking +\f[C]$EDITOR\f[]. +.IP \[bu] 2 +\f[C]mkvi(1df)\f[] creates paths to all its arguments before invoking +\f[C]$VISUAL\f[]. +.RE +.IP \[bu] 2 \f[C]ap(1df)\f[] reads arguments for a given command from the standard input, prompting if appropriate. .IP \[bu] 2 diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index 37cd1c08..1a7df559 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -18,19 +18,22 @@ if exists('g:no_plugin_maps') || exists('g:no_perl_maps') endif " Set mappings -nmap <buffer> <LocalLeader>c :<C-U>call compiler#Make('perl')<CR> -nmap <buffer> <LocalLeader>l :<C-U>call compiler#Make('perlcritic')<CR> -nmap <buffer> <LocalLeader>t :<C-U>call filter#Stable('perltidy')<CR> +nnoremap <buffer> <LocalLeader>c + \ :<C-U>call compiler#Make('perl')<CR> +nnoremap <buffer> <LocalLeader>l + \ :<C-U>call compiler#Make('perlcritic')<CR> +nnoremap <buffer> <LocalLeader>t + \ :<C-U>call filter#Stable('perltidy')<CR> 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> +nmap <buffer> <LocalLeader>v + \ <Plug>PerlVersionBumpMinor +nmap <buffer> <LocalLeader>V + \ <Plug>PerlVersionBumpMajor 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 deleted file mode 100644 index 5349eb49..00000000 --- a/vim/autoload/perl.vim +++ /dev/null @@ -1,45 +0,0 @@ -" 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/bundle/perl_version_bump b/vim/bundle/perl_version_bump new file mode 160000 +Subproject 80c98e8b11832cf78f2fc3ee43599749be8ee6a diff --git a/vim/filetype.vim b/vim/filetype.vim index 66b26455..ad2545a0 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -106,11 +106,6 @@ augroup filetypedetect \,?*.patch \,?*.rej \ setfiletype diff - " GTK settings files - autocmd BufNewFile,BufRead - \ .gktrc*, - \,gktrc* - \ setfiletype gtkrc " INI files autocmd BufNewFile,BufRead \ ?*.ini @@ -162,6 +157,11 @@ augroup filetypedetect \,/etc/gshadow- \,/etc/gshadow.edit \ setfiletype group + " GTK settings files + autocmd BufNewFile,BufRead + \ .gktrc*, + \,gktrc* + \ setfiletype gtkrc " Vim help files autocmd BufNewFile,BufRead \ ~/.vim/doc/?*.txt @@ -250,12 +250,6 @@ augroup filetypedetect \,?*.[1-9] \,*/man[1-9]*/?*.[1-9]* \ setfiletype nroff - " pass(1) password files - autocmd BufNewFile,BufRead - \ /dev/shm/pass.?*/?*.txt - \,$TMPDIR/pass.?*/?*.txt - \,/tmp/pass.?*/?*.txt - \ setfiletype password " UNIX password and shadow files autocmd BufNewFile,BufRead \ /etc/passwd @@ -265,6 +259,12 @@ augroup filetypedetect \,/etc/shadow- \,/etc/shadow.edit \ setfiletype passwd + " pass(1) password files + autocmd BufNewFile,BufRead + \ /dev/shm/pass.?*/?*.txt + \,$TMPDIR/pass.?*/?*.txt + \,/tmp/pass.?*/?*.txt + \ setfiletype password " Perl 5 files autocmd BufNewFile,BufRead \ ?*.pl @@ -310,6 +310,18 @@ augroup filetypedetect autocmd BufNewFile,BufRead \ robots.txt \ setfiletype robots + " Ruby + autocmd BufNewFile,BufRead + \ ?*.rb + \ setfiletype ruby + " sed files + autocmd BufNewFile,BufRead + \ ?*.sed + \ setfiletype sed + " Services files + autocmd BufNewFile,BufRead + \ /etc/services + \ setfiletype services " Bash shell autocmd BufNewFile,BufRead \ ?*.bash @@ -349,40 +361,23 @@ augroup filetypedetect \,xinitrc \ let b:is_posix = 1 \|setfiletype sh - " sed files - autocmd BufNewFile,BufRead - \ ?*.sed - \ setfiletype sed - " Services files + " SQL autocmd BufNewFile,BufRead - \ /etc/services - \ setfiletype services + \ ?*.sql + \ setfiletype sql " OpenSSH configuration autocmd BufNewFile,BufRead \ ssh_config,*/.ssh/config \ setfiletype sshconfig - " OpenSSH server configuration - autocmd BufNewFile,BufRead - \ sshd_config - \ setfiletype sudoers " sudoers(5) autocmd BufNewFile,BufRead \ sudoers \,sudoers.tmp \ setfiletype sshdconfig - " tmux configuration files - autocmd BufNewFile,BufRead - \ .tmux.conf - \,tmux.conf - \ setfiletype tmux - " Ruby - autocmd BufNewFile,BufRead - \ ?*.rb - \ setfiletype ruby - " SQL + " OpenSSH server configuration autocmd BufNewFile,BufRead - \ ?*.sql - \ setfiletype sql + \ sshd_config + \ setfiletype sudoers " Subversion commit autocmd BufNewFile,BufRead \ svn-commit*.tmp @@ -404,6 +399,11 @@ augroup filetypedetect \ .tidyrc \,tidyrc \ setfiletype tidy + " tmux configuration files + autocmd BufNewFile,BufRead + \ .tmux.conf + \,tmux.conf + \ setfiletype tmux " Tab-separated (TSV) files autocmd BufNewFile,BufRead \ ?*.tsv @@ -213,13 +213,12 @@ nnoremap ]t :<C-U>tabnext<CR> nmap [<Space> <Plug>PutBlankLinesAbove nmap ]<Space> <Plug>PutBlankLinesBelow -" Normal mode leader mappings below; use <Bslash> rather than <Leader> on the -" non-plugin maps so that they work on vim-tiny +" Normal leader maps; use <Bslash> not <Leader> for vim-tiny " \a toggles 'formatoptions' 'a' flag using a plugin -nnoremap <Leader>a :<C-U>ToggleOptionFlagLocal formatoptions a<CR> +nnoremap <Bslash>a :<C-U>ToggleOptionFlagLocal formatoptions a<CR> " \b toggles copy-pasteable linebreak settings -nmap <Leader>b <Plug>CopyLinebreakToggle +nmap <Bslash>b <Plug>CopyLinebreakToggle " \c toggles 'cursorline' nnoremap <Bslash>c :<C-U>set cursorline! cursorline?<CR> " \C toggles 'cursorcolumn' @@ -249,9 +248,9 @@ nnoremap <Bslash>M :<C-U>map <buffer><CR> " \n toggles line numbers nnoremap <Bslash>n :<C-U>set number! number?<CR> " \o opens a line below in paste mode -nmap <Leader>o <Plug>PasteOpenBelow +nmap <Bslash>o <Plug>PasteOpenBelow " \o opens a line above in paste mode -nmap <Leader>O <Plug>PasteOpenAbove +nmap <Bslash>O <Plug>PasteOpenAbove " \p toggles paste mode nnoremap <Bslash>p :<C-U>set paste! paste?<CR> " \r reloads .vimrc @@ -269,7 +268,7 @@ nnoremap <Bslash>V :<C-U>let b: t: w:<CR> " \w toggles wrapping nnoremap <Bslash>w :<C-U>set wrap! wrap?<CR> " \x strips trailing whitespace via a custom plugin -nmap <Leader>x <Plug>StripTrailingWhitespace +nmap <Bslash>x <Plug>StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap <Bslash>z :<C-U>setlocal spelllang=en_nz<CR> |