Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(normal)!: remove the gs, g? normal command #28489

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions runtime/doc/change.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions runtime/doc/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion runtime/doc/motion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions runtime/doc/news.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ The following changes may require adaptations in user config or plugins.
• |nvim_open_win()| now blocks all autocommands when `noautocmd` is set,
rather than just those from setting the `buffer` to display in the window.

• Removed the |gs| normal command.
dundargoc marked this conversation as resolved.
Show resolved Hide resolved

• Removed the |g?| normal command.

==============================================================================
BREAKING CHANGES IN HEAD *news-breaking-dev*

Expand Down
4 changes: 0 additions & 4 deletions runtime/doc/quickref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions runtime/doc/various.txt
Original file line number Diff line number Diff line change
Expand Up @@ -515,16 +515,15 @@ gO Show a filetype-specific, navigable "outline" of the

Currently works in |help| and |:Man| buffers.

[N]gs *gs* *:sl* *:sleep*
*:sl* *:sleep*
:[N]sl[eep] [N][m] Do nothing for [N] seconds, or [N] milliseconds if [m]
was given. "gs" always uses seconds.
was given.
Default is one second. >
:sleep "sleep for one second
:5sleep "sleep for five seconds
:sleep 100m "sleep for 100 milliseconds
10gs "sleep for ten seconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 525, which refers to gs, should go as well.

< Can be interrupted with CTRL-C.
"gs" stands for "goto sleep".
While sleeping the cursor is positioned in the text,
if at a visible position.
Queued messages are processed during the sleep.
Expand Down
3 changes: 3 additions & 0 deletions runtime/doc/vim_diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ Highlight groups:
\|setlocal winhighlight=StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC
\|else|setlocal winhighlight=|endif
<
Normal commands:
dundargoc marked this conversation as resolved.
Show resolved Hide resolved
*gs*
*g?* *g??* *g?g?* *v_g?*

Options:
*'aleph'* *'al'*
Expand Down
1 change: 0 additions & 1 deletion src/nvim/ascii_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
15 changes: 0 additions & 15 deletions src/nvim/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -5525,11 +5517,6 @@ static void nv_g_cmd(cmdarg_T *cap)
nv_gomark(cap);
break;

// "gs": Goto sleep.
case 's':
do_sleep(cap->count1 * 1000);
break;

// "ga": Display the ascii value of the character under the
// cursor. It is displayed in decimal, hex, and octal. -- webb
case 'a':
Expand Down Expand Up @@ -5564,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':
Expand All @@ -5573,7 +5559,6 @@ static void nv_g_cmd(cmdarg_T *cap)
case '~':
case 'u':
case 'U':
case '?':
case '@':
nv_operator(cap);
break;
Expand Down
24 changes: 4 additions & 20 deletions src/nvim/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
lewis6991 marked this conversation as resolved.
Show resolved Hide resolved
// 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
Expand Down
1 change: 1 addition & 0 deletions test/old/testdir/test_normal.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/old/testdir/test_sleep.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func! Test_sleep_bang()
call s:assert_takes_longer('sl 50m', 50)
call s:assert_takes_longer('sl! 50m', 50)
call s:assert_takes_longer('1sleep', 1000)
call s:assert_takes_longer('normal 1gs', 1000)
" call s:assert_takes_longer('normal 1gs', 1000)
endfunc

" vim: shiftwidth=2 sts=2 expandtab