Left arrow key will also set left_margin to zero

- Right arrow key will set left_margin to one
- Up and Down arrow will clear the values of stick_to_left and left_margin
This commit is contained in:
Junegunn Choi
2013-09-14 17:30:37 +09:00
parent 11e0623959
commit 40a06e3d36
3 changed files with 18 additions and 13 deletions

View File

@@ -160,8 +160,8 @@ described in the following sections.
| `CTRL-U` | `ignore_unmatched` | 0, 1 | | `CTRL-U` | `ignore_unmatched` | 0, 1 |
| `CTRL-G` | `ignore_groups` | [], ['String'], ['Comment'], ['String', 'Comment'] | | `CTRL-G` | `ignore_groups` | [], ['String'], ['Comment'], ['String', 'Comment'] |
| `CTRL-O` | `mode_sequence` | Input string of `/[lrc]+\*{0,2}/` | | `CTRL-O` | `mode_sequence` | Input string of `/[lrc]+\*{0,2}/` |
| `<Left>` | `stick_to_left` | Set stick_to_left option | | `<Left>` | `stick_to_left` | Set stick_to_left and set left_margin to zero |
| `<Right>` | `stick_to_left` | Unset stick_to_left option | | `<Right>` | `stick_to_left` | Unset stick_to_left and set left_margin to one |
--- ---

View File

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

View File

@@ -87,7 +87,7 @@ special shortcut keys listed below. The meanings of the options will be
described in the following sections. described in the following sections.
| Key | Option | Values | | Key | Option | Values |
| ------- | ---------------- | ------------------------------------------ | | ------- | ---------------- | -------------------------------------------- |
| CTRL-I | indentation | shallow, deep, none, keep | | CTRL-I | indentation | shallow, deep, none, keep |
| CTRL-L | left_margin | Input number or string | | CTRL-L | left_margin | Input number or string |
| CTRL-R | right_margin | Input number or string | | CTRL-R | right_margin | Input number or string |
@@ -95,8 +95,8 @@ described in the following sections.
| CTRL-U | ignore_unmatched | 0, 1 | | CTRL-U | ignore_unmatched | 0, 1 |
| CTRL-G | ignore_groups | [], [String], [Comment], [String, Comment] | | CTRL-G | ignore_groups | [], [String], [Comment], [String, Comment] |
| CTRL-O | mode_sequence | Input string of /[lrc]+\*{0,2}/ | | CTRL-O | mode_sequence | Input string of /[lrc]+\*{0,2}/ |
| <Left> | stick_to_left | Set stick_to_left option | | <Left> | stick_to_left | Set stick_to_left and set left_margin to 0 |
| <Right> | stick_to_left | Unset stick_to_left option | | <Right> | stick_to_left | Unset stick_to_left and set left_margin to 1 |
Non-interactive mode Non-interactive mode