mirror of https://github.com/neovim/neovim.git
feat(normal)!: remove the default g? normal mode command
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
parent
72bae3d2b7
commit
a4f65b5435
|
@ -333,16 +333,6 @@ gu{motion} Make {motion} text lowercase.
|
|||
gugu *gugu* *guu*
|
||||
guu Make current line lowercase.
|
||||
|
||||
*g?* *rot13*
|
||||
g?{motion} Rot13 encode {motion} text.
|
||||
|
||||
*v_g?*
|
||||
{Visual}g? Rot13 encode the highlighted text (for {Visual} see
|
||||
|Visual-mode|).
|
||||
|
||||
g?g? *g?g?* *g??*
|
||||
g?? Rot13 encode current line.
|
||||
|
||||
To turn one line into title caps, make every first letter of a word
|
||||
uppercase: >
|
||||
:s/\v<(.)(\w*)/\u\1\L\2/g
|
||||
|
|
|
@ -722,9 +722,6 @@ tag char note action in Normal mode ~
|
|||
character under the cursor
|
||||
|g;| g; 1 go to N older position in change list
|
||||
|g<| g< display previous command output
|
||||
|g?| g? 2 Rot13 encoding operator
|
||||
|g?g?| g?? 2 Rot13 encode current line
|
||||
|g?g?| g?g? 2 Rot13 encode current line
|
||||
|gD| gD 1 go to definition of word under the cursor
|
||||
in current file
|
||||
|gE| gE 1 go backwards to the end of the previous
|
||||
|
|
|
@ -47,7 +47,6 @@ or change text. The following operators are available:
|
|||
|=| = filter through 'equalprg' or C-indenting if empty
|
||||
|gq| gq text formatting
|
||||
|gw| gw text formatting with no cursor movement
|
||||
|g?| g? ROT13 encoding
|
||||
|>| > shift right
|
||||
|<| < shift left
|
||||
|zf| zf define a fold
|
||||
|
|
|
@ -142,6 +142,8 @@ The following changes may require adaptations in user config or plugins.
|
|||
|
||||
• Removed the |gs| normal command.
|
||||
|
||||
• Removed the |g?| normal command.
|
||||
|
||||
==============================================================================
|
||||
BREAKING CHANGES IN HEAD *news-breaking-dev*
|
||||
|
||||
|
|
|
@ -413,10 +413,6 @@ In Insert or Command-line mode:
|
|||
lowercase
|
||||
|gU| gU{motion} make the text that is moved over with {motion}
|
||||
uppercase
|
||||
|v_g?| {visual}g? perform rot13 encoding on highlighted text
|
||||
|g?| g?{motion} perform rot13 encoding on the text that is moved over
|
||||
with {motion}
|
||||
|
||||
|CTRL-A| N CTRL-A add N to the number at or after the cursor
|
||||
|CTRL-X| N CTRL-X subtract N from the number at or after the cursor
|
||||
|
||||
|
|
|
@ -677,6 +677,7 @@ Highlight groups:
|
|||
<
|
||||
Normal commands:
|
||||
*gs*
|
||||
*g?* *g??* *g?g?* *v_g?*
|
||||
|
||||
Options:
|
||||
*'aleph'* *'al'*
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
: (uint8_t)(x) - 'a')
|
||||
#define CHAR_ORD_LOW(x) ((uint8_t)(x) - 'a')
|
||||
#define CHAR_ORD_UP(x) ((uint8_t)(x) - 'A')
|
||||
#define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a))
|
||||
|
||||
#define NUL '\000'
|
||||
#define BELL '\007'
|
||||
|
|
|
@ -3921,14 +3921,6 @@ static void nv_search(cmdarg_T *cap)
|
|||
oparg_T *oap = cap->oap;
|
||||
pos_T save_cursor = curwin->w_cursor;
|
||||
|
||||
if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13) {
|
||||
// Translate "g??" to "g?g?"
|
||||
cap->cmdchar = 'g';
|
||||
cap->nchar = '?';
|
||||
nv_operator(cap);
|
||||
return;
|
||||
}
|
||||
|
||||
// When using 'incsearch' the cursor may be moved to set a different search
|
||||
// start position.
|
||||
cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0, true);
|
||||
|
@ -5559,7 +5551,6 @@ static void nv_g_cmd(cmdarg_T *cap)
|
|||
// "g~" Toggle the case of the text.
|
||||
// "gu" Change text to lower case.
|
||||
// "gU" Change text to upper case.
|
||||
// "g?" rot13 encoding
|
||||
// "g@" call 'operatorfunc'
|
||||
case 'q':
|
||||
case 'w':
|
||||
|
@ -5568,7 +5559,6 @@ static void nv_g_cmd(cmdarg_T *cap)
|
|||
case '~':
|
||||
case 'u':
|
||||
case 'U':
|
||||
case '?':
|
||||
case '@':
|
||||
nv_operator(cap);
|
||||
break;
|
||||
|
|
|
@ -114,7 +114,6 @@ static char opchars[][3] = {
|
|||
{ 'g', 'u', OPF_CHANGE }, // OP_LOWER
|
||||
{ 'J', NUL, OPF_LINES | OPF_CHANGE }, // DO_JOIN
|
||||
{ 'g', 'J', OPF_LINES | OPF_CHANGE }, // DO_JOIN_NS
|
||||
{ 'g', '?', OPF_CHANGE }, // OP_ROT13
|
||||
{ 'r', NUL, OPF_CHANGE }, // OP_REPLACE
|
||||
{ 'I', NUL, OPF_CHANGE }, // OP_INSERT
|
||||
{ 'A', NUL, OPF_CHANGE }, // OP_APPEND
|
||||
|
@ -2131,7 +2130,6 @@ static int swapchars(int op_type, pos_T *pos, int length)
|
|||
/// @param op_type
|
||||
/// == OP_UPPER: make uppercase,
|
||||
/// == OP_LOWER: make lowercase,
|
||||
/// == OP_ROT13: do rot13 encoding,
|
||||
/// else swap case of character at 'pos'
|
||||
///
|
||||
/// @return true when something actually changed.
|
||||
|
@ -2140,11 +2138,6 @@ bool swapchar(int op_type, pos_T *pos)
|
|||
{
|
||||
const int c = gchar_pos(pos);
|
||||
|
||||
// Only do rot13 encoding for ASCII characters.
|
||||
if (c >= 0x80 && op_type == OP_ROT13) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ~ is OP_NOP, g~ is OP_TILDE, gU is OP_UPPER
|
||||
if ((op_type == OP_UPPER || op_type == OP_NOP || op_type == OP_TILDE) && c == 0xdf) {
|
||||
pos_T sp = curwin->w_cursor;
|
||||
|
@ -2158,18 +2151,10 @@ bool swapchar(int op_type, pos_T *pos)
|
|||
}
|
||||
|
||||
int nc = c;
|
||||
if (mb_islower(c)) {
|
||||
if (op_type == OP_ROT13) {
|
||||
nc = ROT13(c, 'a');
|
||||
} else if (op_type != OP_LOWER) {
|
||||
nc = mb_toupper(c);
|
||||
}
|
||||
} else if (mb_isupper(c)) {
|
||||
if (op_type == OP_ROT13) {
|
||||
nc = ROT13(c, 'A');
|
||||
} else if (op_type != OP_UPPER) {
|
||||
nc = mb_tolower(c);
|
||||
}
|
||||
if (mb_islower(c) && op_type != OP_LOWER) {
|
||||
nc = mb_toupper(c);
|
||||
} else if (mb_isupper(c) && op_type != OP_UPPER) {
|
||||
nc = mb_tolower(c);
|
||||
}
|
||||
if (nc != c) {
|
||||
if (c >= 0x80 || nc >= 0x80) {
|
||||
|
@ -6213,7 +6198,6 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
|||
case OP_TILDE:
|
||||
case OP_UPPER:
|
||||
case OP_LOWER:
|
||||
case OP_ROT13:
|
||||
if (empty_region_error) {
|
||||
vim_beep(BO_OPER);
|
||||
CancelRedo();
|
||||
|
|
|
@ -80,7 +80,7 @@ enum {
|
|||
OP_LOWER = 12, ///< "gu" make lower case operator
|
||||
OP_JOIN = 13, ///< "J" join operator, only for Visual mode
|
||||
OP_JOIN_NS = 14, ///< "gJ" join operator, only for Visual mode
|
||||
OP_ROT13 = 15, ///< "g?" rot-13 encoding
|
||||
// UNUSED = 15, ///< Previously used by OP_ROT13
|
||||
OP_REPLACE = 16, ///< "r" replace chars, only for Visual mode
|
||||
OP_INSERT = 17, ///< "I" Insert column, only for Visual mode
|
||||
OP_APPEND = 18, ///< "A" Append column, only for Visual mode
|
||||
|
|
|
@ -1908,6 +1908,7 @@ endfunc
|
|||
|
||||
func Test_normal24_rot13()
|
||||
" Testing for g?? g?g?
|
||||
throw 'Skipped: Nvim has removed g?'
|
||||
new
|
||||
call append(0, 'abcdefghijklmnopqrstuvwxyzäüö')
|
||||
1
|
||||
|
|
Loading…
Reference in New Issue