diff --git a/DEMO.md b/DEMO.md index 763cec2..530d481 100644 --- a/DEMO.md +++ b/DEMO.md @@ -70,8 +70,8 @@ mysql: "user:pass":r00t:pa55 ``` -Using blockwise-visual mode or negative field index ---------------------------------------------------- +Using blockwise-visual mode or negative N-th parameter +------------------------------------------------------ ```ruby options = { :caching => nil, diff --git a/EXAMPLES.md b/EXAMPLES.md index 2acf99a..d21ec32 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -166,8 +166,8 @@ my_object ``` -Using blockwise-visual mode or negative field index ---------------------------------------------------- +Using blockwise-visual mode or negative N-th parameter +------------------------------------------------------ You can try either: - select text around `=>` in blockwise-visual mode (`CTRL-V`) and `=` diff --git a/README.md b/README.md index 7cce8bc..480680b 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ variant `:EasyAlign!`) for visual mode. | Mode | Command | | ------------------------- | ------------------------------------------------ | | Interactive mode | `:EasyAlign[!] [OPTIONS]` | -| Using predefined rules | `:EasyAlign[!] [FIELD#] DELIMITER_KEY [OPTIONS]` | -| Using regular expressions | `:EasyAlign[!] [FIELD#] /REGEXP/ [OPTIONS]` | +| Using predefined rules | `:EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]` | +| Using regular expressions | `:EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]` | ### Concept of _alignment rule_ @@ -83,8 +83,8 @@ vnoremap :EasyAlign With the mapping, you can align selected lines of text with only a few keystrokes. 1. `` key to start interactive EasyAlign command -1. Optional Enter keys to select alignment mode (left, right, or center) -1. Optional field index (default: 1) +1. Optional: Enter keys to select alignment mode (left, right, or center) +1. Optional: N-th delimiter (default: 1) - `1` Around the 1st occurrences of delimiters - `2` Around the 2nd occurrences of delimiters - ... @@ -176,10 +176,10 @@ Instead of going into the interactive mode, you can type in arguments to ```vim " Using predefined alignment rules -:EasyAlign[!] [FIELD#] DELIMITER_KEY [OPTIONS] +:EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS] " Using arbitrary regular expressions -:EasyAlign[!] [FIELD#] /REGEXP/ [OPTIONS] +:EasyAlign[!] [N-th] /REGEXP/ [OPTIONS] ``` For example, when aligning the following lines around colons and semi-colons, @@ -247,7 +247,7 @@ my_hash = { :a => 1, ``` However, in this case, we don't really need blockwise visual mode -since the same can be easily done using the negative field index: `-=` +since the same can be easily done using the negative N-th parameter: `-=` Alignment options ----------------- @@ -508,7 +508,7 @@ let g:easy_align_bang_interactive_modes = ['c', 'r'] ### Alignments over multiple occurrences of delimiters -As stated above, "field index" is used to target specific occurrences of +As stated above, "N-th" parameter is used to target specific occurrences of the delimiter when it appears multiple times in each line. To recap: diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index 6418f5a..c0a5a66 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -364,12 +364,12 @@ function! s:do_align(modes, all_tokens, all_delims, fl, ll, fc, lc, pattern, nth " Calculate the maximum number of tokens for a line within the range call s:max(max, { 'tokens': len(tokens) }) - if a:nth > 0 " Positive field number + if a:nth > 0 " Positive N-th if len(tokens) < a:nth continue endif let nth = a:nth - 1 " make it 0-based - else " -0 or Negative field number + else " -0 or Negative N-th if a:nth == 0 && mode !=? 'l' let nth = len(tokens) - 1 else @@ -752,7 +752,7 @@ function! s:align(bang, first_line, last_line, expr) elseif n == '-' | let nth = -1 elseif empty(n) | let nth = 1 elseif n == '0' || ( n != '-0' && n != string(str2nr(n)) ) - call s:exit('Invalid field number: '. n) + call s:exit('Invalid N-th parameter: '. n) else let nth = n endif diff --git a/doc/easy_align.txt b/doc/easy_align.txt index 428fb02..6910424 100644 --- a/doc/easy_align.txt +++ b/doc/easy_align.txt @@ -16,11 +16,11 @@ EasyAlign *:EasyAlign* *:EasyAlign!* vim-easy-align defines `:EasyAlign` command in the visual mode. (:EasyAlign! is the right-align version.) -| Mode | Command | -| ------------------------- | ---------------------------------------------- | -| Interactive mode | :EasyAlign[!] [OPTIONS] | -| Using predefined rules | :EasyAlign[!] [FIELD#] DELIMITER_KEY [OPTIONS] | -| Using regular expressions | :EasyAlign[!] [FIELD#] /REGEXP/ [OPTIONS] | +| Mode | Command | +| ------------------------- | -------------------------------------------- | +| Interactive mode | :EasyAlign[!] [OPTIONS] | +| Using predefined rules | :EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS] | +| Using regular expressions | :EasyAlign[!] [N-th] /REGEXP/ [OPTIONS] | Interactive mode @@ -35,8 +35,8 @@ your `.vimrc`. With this mapping, you can align selected lines of text with a few keystrokes. 1. key to start interactive EasyAlign command -2. Optional Enter keys to select alignment mode (left, right, or center) -3. Optional field index (default: 1) +2. Optional: Enter keys to select alignment mode (left, right, or center) +3. Optional: N-th delimiter (default: 1) 1 Around the 1st occurrences of delimiters 2 Around the 2nd occurrences of delimiters * Around all occurrences of delimiters @@ -106,10 +106,10 @@ Instead of going into the interactive mode, you can type in arguments to `:EasyAlign` command. " Using predefined alignment rules - :EasyAlign[!] [FIELD#] DELIMITER_KEY [OPTIONS] + :EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS] " Using arbitrary regular expressions - :EasyAlign[!] [FIELD#] /REGEXP/ [OPTIONS] + :EasyAlign[!] [N-th] /REGEXP/ [OPTIONS] For example, when aligning the following lines around colons and semi-colons, @@ -175,7 +175,7 @@ Available options are as follows. | | | (right, left, center) | | indentation | string | 'k' | | | | (keep, shallow, deep, none) | -| mode_sequence | string | (Depends on field index and | +| mode_sequence | string | (Depends on N-th param and | | | | selected alignment mode) | There are 4 ways to set alignment options (from lowest precedence to highest): @@ -407,7 +407,7 @@ settings as follows. Alignments over multiple occurrences of delimiters ------------------------------------------------------------------------- -As stated above, "field index" is used to target specific occurrences of +As stated above, "N-th" parameter is used to target specific occurrences of the delimiter when it appears multiple times in each line. To recap: