From a1e28c44113207313b8fe598f6d99d9424724f00 Mon Sep 17 00:00:00 2001 From: Jacob Niehus Date: Sat, 1 Aug 2015 20:15:15 -0700 Subject: [PATCH] Change indent comparison to !~ with explanation Truth table: x x != 0 x !~ 0 0 0 0 1 1 1 '==' 0 1 --- plugin/exchange.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/exchange.vim b/plugin/exchange.vim index 762b189..044cd74 100644 --- a/plugin/exchange.vim +++ b/plugin/exchange.vim @@ -8,7 +8,8 @@ function! s:exchange(x, y, reverse, expand) let selection = &selection set selection=inclusive - let indent = s:get_setting('exchange_indent', 1) != 0 && a:x.type ==# 'V' && a:y.type ==# 'V' + " Compare using =~ because "'==' != 0" returns 0 + let indent = s:get_setting('exchange_indent', 1) !~ 0 && a:x.type ==# 'V' && a:y.type ==# 'V' if indent let xindent = matchstr(getline(nextnonblank(a:y.start.line)), '^\s*')