aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-29 11:08:40 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-29 11:08:40 +1200
commit197bd52242010b7060b132456757ace5294775f2 (patch)
treeb50fa3b3b38bad218448a31fc4d1b18106d91495
parent3f73517e2dd1be08af6588b3d49cf470e0fb4acd (diff)
parentfbb318a6ab8c9494c76cbb009ec1447c3999b0eb (diff)
downloaddotfiles-1.63.0.tar.gz
Merge branch 'release/v1.63.0'v1.63.0
* release/v1.63.0: Bump VERSION Add mapping to contract multiple blank lines Convert a few stridx() to alternative forms
-rw-r--r--VERSION4
-rw-r--r--vim/after/ftplugin/mail.vim5
-rw-r--r--vim/autoload/mail.vim20
-rw-r--r--vim/autoload/quote.vim2
-rw-r--r--vim/filetype.vim2
-rw-r--r--vim/scripts.vim2
6 files changed, 30 insertions, 5 deletions
diff --git a/VERSION b/VERSION
index fceba156..e4ace7d4 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v1.62.0
-Mon Aug 27 05:18:35 UTC 2018
+tejr dotfiles v1.63.0
+Tue Aug 28 23:08:40 UTC 2018
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index 3aa3fec3..df0f043d 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -83,3 +83,8 @@ let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>['
\ . '|ounmap <buffer> <LocalLeader>]'
\ . '|xunmap <buffer> <LocalLeader>['
\ . '|xunmap <buffer> <LocalLeader>]'
+
+" Quick map to strip multiple blank lines in the entire buffer; this comes up
+" a lot when replying to stripped HTML mail
+nnoremap <buffer> <silent> <LocalLeader>x
+ \ :<C-U>call mail#ContractMultipleBlankLines()<CR>
diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim
index baff4bbf..0c3b7eb7 100644
--- a/vim/autoload/mail.vim
+++ b/vim/autoload/mail.vim
@@ -65,3 +65,23 @@ function! mail#NewBlank(count, up, visual) abort
endif
endfunction
+
+" Quick map to strip multiple blank lines in the entire buffer; this comes up
+" a lot when replying to stripped HTML mail. This should really be a command,
+" but I'll do that Later(TM).
+function! mail#ContractMultipleBlankLines() abort
+ let l:deletions = []
+ let l:blank = 0
+ for l:num in range(1, line('$'))
+ if strlen(getline(l:num)) > 0
+ let l:blank = 0
+ elseif l:blank
+ let l:deletions += [l:num]
+ else
+ let l:blank = 1
+ endif
+ endfor
+ for l:num in reverse(l:deletions)
+ execute l:num . 'delete'
+ endfor
+endfunction
diff --git a/vim/autoload/quote.vim b/vim/autoload/quote.vim
index 35df76a4..2343b12a 100644
--- a/vim/autoload/quote.vim
+++ b/vim/autoload/quote.vim
@@ -27,7 +27,7 @@ function! quote#QuoteOpfunc(type) abort
" Only add a space after the quote character if this line isn't already
" quoted with the same character
- let l:new = stridx(l:cur, l:char) == 0
+ let l:new = l:cur[0] == l:char
\ ? l:char.l:cur
\ : l:char.' '.l:cur
call setline(l:li, l:new)
diff --git a/vim/filetype.vim b/vim/filetype.vim
index 192a7283..541976f4 100644
--- a/vim/filetype.vim
+++ b/vim/filetype.vim
@@ -45,7 +45,7 @@ endfunction
" Check whether the first line was changed and looks like a shebang, and if
" so, re-run filetype detection
function! s:CheckShebang()
- if line('''[') == 1 && stridx(getline(1), '#!') == 0
+ if line('''[') == 1 && getline(1) =~# '^#!'
doautocmd filetypedetect BufRead
endif
endfunction
diff --git a/vim/scripts.vim b/vim/scripts.vim
index ae792ada..f79fa74c 100644
--- a/vim/scripts.vim
+++ b/vim/scripts.vim
@@ -6,7 +6,7 @@
let s:line = getline(1)
" If it's not a shebang, we're done
-if stridx(s:line, '#!') != 0
+if s:line !~# '^#!'
finish
endif