From ecb15a1227303ae50da16081c7049d37e01e7f70 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 3 Aug 2018 12:30:38 +1200 Subject: Add mapping to flag mail messages as unimportant --- vim/after/ftplugin/mail.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 74261d8c..34c524e1 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -33,3 +33,16 @@ let b:undo_ftplugin .= '|nunmap q' \ . '|nunmap Q' \ . '|nunmap QQ' \ . '|xunmap Q' + +" Flag a message as unimportant +function! s:FlagUnimportant() + call cursor(1, 1) + call search('^$') + - + call append(line('.'), 'X-Priority: 5') + call append(line('.'), 'Importance: Low') +endfunction +nnoremap + \ l + \ :call FlagUnimportant() +let b:undo_ftplugin .= '|nunmap l' -- cgit v1.2.3 From 7140d01a45aa4f725da6a21b854728195584d8ec Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 3 Aug 2018 20:10:54 +1200 Subject: Tidy mapping definition for \< --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 44ed6b02..a84e7630 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -307,8 +307,8 @@ nnoremap + :call vimrc#Anchor('1GgqG') " \. runs the configured make program into the location list nnoremap . :lmake! -" \< and \> adjusts indent of last edit; good for pasting -nnoremap < :'[,']< +" \< and \> adjust indent of last edit; good for pasting +nnoremap :'[,'] nnoremap > :'[,']> " \/ types :vimgrep for me ready to enter a search pattern -- cgit v1.2.3 From ff7c16351bd779cde93336c180f511ffd8905871 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 3 Aug 2018 20:26:24 +1200 Subject: Correct a comment --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index a84e7630..445e0bbb 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -266,7 +266,7 @@ nnoremap n :setlocal number! number? nnoremap N :set ruler! ruler? " \o opens a line below in paste mode nmap o (PasteOpenBelow) -" \o opens a line above in paste mode +" \O opens a line above in paste mode nmap O (PasteOpenAbove) " \p toggles paste mode nnoremap p :set paste! paste? -- cgit v1.2.3 From 6607ee111795f2922ae5e1f2b78f8f6c137c0400 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Aug 2018 00:39:33 +1200 Subject: Add Perl boilerplate generation mapping --- vim/after/ftplugin/perl.vim | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index 2a350805..a85685e3 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -13,11 +13,75 @@ let b:undo_ftplugin .= '|unlet b:current_compiler' setlocal matchpairs+=<:> let b:undo_ftplugin .= '|setlocal matchpairs<' +" Function to add boilerplate intelligently +function! s:Boilerplate() abort + + " Flag whether the buffer started blank + let l:blank = line2byte(line('$') + 1) <= 2 + + " This is a .pm file, guess its package name from path + if expand('%:e') ==# 'pm' + + let l:match = matchlist(expand('%:p'), '.*/lib/\(.\+\).pm$') + if len(l:match) + let l:package = substitute(l:match[1], '/', '::', 'g') + else + let l:package = expand('%:t:r') + endif + + " Otherwise, just use 'main' + else + let l:package = 'main' + endif + + " Lines always to add + let l:lines = [ + \ 'package '.l:package.';', + \ '', + \ 'use strict;', + \ 'use warnings;', + \ 'use utf8;', + \ '', + \ 'use 5.006;', + \ '', + \ 'our $VERSION = ''0.01'';', + \ '' + \ ] + + " Conditional lines depending on package + if l:package ==# 'main' + let l:lines = ['#!perl'] + l:lines + else + let l:lines = l:lines + ['', '1;'] + endif + + " Add all the lines in the array + for l:line in l:lines + call append(line('.') - 1, l:line) + endfor + + " If we started in a completely empty buffer, delete the current blank line + if l:blank + delete + endif + + " If we added a trailing '1' for a package, move the cursor up two lines + if l:package !=# 'main' + -2 + endif + +endfunction + " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_perl_maps') finish endif +" Add boilerplate intelligently +nnoremap b + \ :call Boilerplate() +let b:undo_ftplugin .= '|nunmap b' + " Mappings to choose compiler nnoremap c \ :compiler perl -- cgit v1.2.3 From 3d70b8dbeb2c7a5afa58938237c1ad3dae2ca070 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Aug 2018 02:04:48 +1200 Subject: Make Perl boilerplate mapping silent --- vim/after/ftplugin/perl.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim index a85685e3..777c3ad4 100644 --- a/vim/after/ftplugin/perl.vim +++ b/vim/after/ftplugin/perl.vim @@ -78,7 +78,7 @@ if exists('g:no_plugin_maps') || exists('g:no_perl_maps') endif " Add boilerplate intelligently -nnoremap b +nnoremap b \ :call Boilerplate() let b:undo_ftplugin .= '|nunmap b' -- cgit v1.2.3 From df0c59a66d574e75977c566e8ba180b5d05aad12 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 4 Aug 2018 13:13:50 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 57fe5e02..6fcbf78d 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v1.42.0 -Thu Aug 2 21:23:24 UTC 2018 +tejr dotfiles v1.43.0 +Sat Aug 4 01:13:45 UTC 2018 -- cgit v1.2.3