Make <Down> set both left and right margin to zero

(Undocumented) <Up> will clear *UP* left_margin, right_margin, and stick_to_left
This commit is contained in:
Junegunn Choi
2013-10-03 16:06:23 +09:00
parent e4f86274e3
commit 3304f4e95a
3 changed files with 7 additions and 1 deletions

View File

@@ -158,6 +158,7 @@ keys listed below. The meaning of each option will be described in
| `CTRL-O` | `mode_sequence` | Input string of `/[lrc]+\*{0,2}/` | | `CTRL-O` | `mode_sequence` | Input string of `/[lrc]+\*{0,2}/` |
| `<Left>` | `stick_to_left` | `{ 'stick_to_left': 1, 'left_margin': 0 }` | | `<Left>` | `stick_to_left` | `{ 'stick_to_left': 1, 'left_margin': 0 }` |
| `<Right>` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` | | `<Right>` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` |
| `<Down>` | `*_margin` | `{ 'left_margin': 0, 'right_margin': 0 }` |
--- ---

View File

@@ -629,9 +629,13 @@ function! s:interactive(modes, vis, opts, delims)
elseif c == "\<Right>" elseif c == "\<Right>"
let opts['stl'] = 0 let opts['stl'] = 0
let opts['lm'] = 1 let opts['lm'] = 1
elseif c == "\<Up>" || c == "\<Down>" elseif c == "\<Down>"
let opts['lm'] = 0
let opts['rm'] = 0
elseif c == "\<Up>"
silent! call remove(opts, 'stl') silent! call remove(opts, 'stl')
silent! call remove(opts, 'lm') silent! call remove(opts, 'lm')
silent! call remove(opts, 'rm')
elseif ch == "\<C-O>" elseif ch == "\<C-O>"
let modes = tolower(s:input("Mode sequence: ", get(opts, 'm', mode), a:vis)) let modes = tolower(s:input("Mode sequence: ", get(opts, 'm', mode), a:vis))
if match(modes, '^[lrc]\+\*\{0,2}$') != -1 if match(modes, '^[lrc]\+\*\{0,2}$') != -1

View File

@@ -97,6 +97,7 @@ described in the following sections.
| CTRL-O | mode_sequence | Input string of /[lrc]+\*{0,2}/ | | CTRL-O | mode_sequence | Input string of /[lrc]+\*{0,2}/ |
| <Left> | stick_to_left | { 'stick_to_left': 1, 'left_margin': 0 } | | <Left> | stick_to_left | { 'stick_to_left': 1, 'left_margin': 0 } |
| <Right> | stick_to_left | { 'stick_to_left': 0, 'left_margin': 1 } | | <Right> | stick_to_left | { 'stick_to_left': 0, 'left_margin': 1 } |
| <Down> | *_margin | { 'left_margin': 0, 'right_margin': 0 } |
Non-interactive mode Non-interactive mode