[vim/vim] Improve Chapter 2 of the Tutor (PR #18105)

20 views
Skip to first unread message

Christian Brabandt

unread,
Aug 24, 2025, 1:42:15 PM (11 days ago) Aug 24
to vim/vim, Subscribed

Add a section on Text Objects and special registers like clipboard and blackhole.

fixes: #17808


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/18105

Commit Summary

  • 8854463 runtime(tutor): Add a section on text objects
  • b0809c9 runtime(tutor): add clipboard and blackhole register usage to tutorial 2

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105@github.com>

Damien Lejay

unread,
Aug 24, 2025, 4:45:53 PM (11 days ago) Aug 24
to vim/vim, Subscribed

@dlejay commented on this pull request.


In runtime/tutor/tutor2:

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-		      Lesson 2.1.4: THE BEAUTY OF MARKS
+		     Lesson 2.1.4: SPECIAL REGISTERS
+
+ ** Use system clipboard and blackhole registers for advanced editing **
+
+ Note: The use of the clipboard depends on your exact Vim version and
+       system environment and may not be available (especially on Linux)
+
+  1. Clipboard registers  +  and  *  :
+     - "+y  - Yank to system clipboard (e.g. "+yy for current line)
+     - "+p  - Paste from system clipboard
+     - "* is primary clipboard on X11 (middle-click), "+ is clipboard (Ctrl-C/V)
+
+---> Try: "+yy then paste into another application with Ctrl-V

Better avoid talking about Ctrl-C/V since they will not work on macOS.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/review/3149499672@github.com>

Damien Lejay

unread,
Aug 24, 2025, 4:48:04 PM (11 days ago) Aug 24
to vim/vim, Subscribed

@dlejay commented on this pull request.


In runtime/tutor/tutor2:

>  
+---> Practice: "_diw on this word to delete it without affecting yank history

Which word is “this word” ?
Also, there needs to be more practice → the person following the tutorial needs to be give more instructions to see that indeed _diw did not affect the yank history.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/review/3149500199@github.com>

Damien Lejay

unread,
Aug 24, 2025, 4:50:28 PM (11 days ago) Aug 24
to vim/vim, Subscribed
dlejay left a comment (vim/vim#18105)

Thanks ! For the TextObject section, I’d suggest trying to invert the proportions of theory vs practice if possible ; the Vimtutor is practice first.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/c3218369013@github.com>

Phạm Bình An

unread,
Aug 25, 2025, 5:30:20 AM (11 days ago) Aug 25
to vim/vim, Subscribed

@brianhuster commented on this pull request.


In runtime/tutor/tutor2:

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-		      Lesson 2.1.4: THE BEAUTY OF MARKS
+		     Lesson 2.1.4: SPECIAL REGISTERS
+
+ ** Use system clipboard and blackhole registers for advanced editing **
+
+ Note: The use of the clipboard depends on your exact Vim version and
+       system environment and may not be available (especially on Linux)

What about telling users a way to check this? E.g :echo has("clipboard")


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/review/3150625128@github.com>

Gary Johnson

unread,
Aug 25, 2025, 10:48:30 AM (10 days ago) Aug 25
to reply+ACY5DGEZKE5G46YXVX...@reply.github.com, vim...@googlegroups.com
On 2025-08-25, Phạm Bình An (Vim Github Repository) wrote:
> @brianhuster commented on this pull request.
>
> -------------------------------------------------------------------------------
>
> In runtime/tutor/tutor2:
>
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> - Lesson 2.1.4: THE BEAUTY OF MARKS
> + Lesson 2.1.4: SPECIAL REGISTERS
> +
> + ** Use system clipboard and blackhole registers for advanced editing **
> +
> + Note: The use of the clipboard depends on your exact Vim version and
> + system environment and may not be available (especially on Linux)

That statement suggests to me that there is some problem with Vim's
clipboard implementation or with Linux. Also, "may not be
available" suggests that the problem is not fixable. I have been
using Vim in a terminal and gvim on Linux for many years and the
clipboard works quite well. The problems I have seen others have
with it have been due to their inexperience or due to various Linux
distributions' packaging of Vim without the clipboard or X enabled.
That's on the distributions, not Vim, and that statement should say
that.

Maybe something like this instead:

Be aware that some Linux distributions include the tiny version
of Vim as their default vim and gvim programs, which does not
have the clipboard enabled. Even the "full-featured" vim
package of some Linux distributions often does not have X or the
clipboard feature enabled. Those problems can be avoided by
installing the GUI Vim package, which usually has X and the
clipboard enabled for vim as well as gvim.

Regards,
Gary

vim-dev ML

unread,
Aug 25, 2025, 10:49:05 AM (10 days ago) Aug 25
to vim/vim, vim-dev ML, Your activity
vim-ml left a comment (vim/vim#18105)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/c3220601126@github.com>

Christian Brabandt

unread,
Aug 25, 2025, 5:57:20 PM (10 days ago) Aug 25
to vim/vim, vim-dev ML, Comment
chrisbra left a comment (vim/vim#18105)

I was trying to avoid a complex description, that may not even always be correct. E.g. it does not explain why the clipboard odes not work when using Vim on a non-X11/Wayland UI. Or when ssh into a server.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/c3221864274@github.com>

Christian Brabandt

unread,
Aug 25, 2025, 5:58:43 PM (10 days ago) Aug 25
to vim/vim, vim-dev ML, Comment

@chrisbra commented on this pull request.


In runtime/tutor/tutor2:

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-		      Lesson 2.1.4: THE BEAUTY OF MARKS
+		     Lesson 2.1.4: SPECIAL REGISTERS
+
+ ** Use system clipboard and blackhole registers for advanced editing **
+
+ Note: The use of the clipboard depends on your exact Vim version and
+       system environment and may not be available (especially on Linux)
+
+  1. Clipboard registers  +  and  *  :
+     - "+y  - Yank to system clipboard (e.g. "+yy for current line)
+     - "+p  - Paste from system clipboard
+     - "* is primary clipboard on X11 (middle-click), "+ is clipboard (Ctrl-C/V)
+
+---> Try: "+yy then paste into another application with Ctrl-V

they don't? And what do you use there, I suppose Cmd-C/V ?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/review/3153152471@github.com>

Christian Brabandt

unread,
Aug 25, 2025, 5:59:41 PM (10 days ago) Aug 25
to vim/vim, vim-dev ML, Comment

@chrisbra commented on this pull request.


In runtime/tutor/tutor2:

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-		      Lesson 2.1.4: THE BEAUTY OF MARKS
+		     Lesson 2.1.4: SPECIAL REGISTERS
+
+ ** Use system clipboard and blackhole registers for advanced editing **
+
+ Note: The use of the clipboard depends on your exact Vim version and
+       system environment and may not be available (especially on Linux)

probably we should rather use echo has('clipboard_working') instead then?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/review/3153154705@github.com>

Phạm Bình An

unread,
Aug 25, 2025, 9:17:19 PM (10 days ago) Aug 25
to vim/vim, vim-dev ML, Comment

@brianhuster commented on this pull request.


In runtime/tutor/tutor2:

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-		      Lesson 2.1.4: THE BEAUTY OF MARKS
+		     Lesson 2.1.4: SPECIAL REGISTERS
+
+ ** Use system clipboard and blackhole registers for advanced editing **
+
+ Note: The use of the clipboard depends on your exact Vim version and
+       system environment and may not be available (especially on Linux)

Yes


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/review/3153495116@github.com>

Phạm Bình An

unread,
Aug 25, 2025, 9:53:32 PM (10 days ago) Aug 25
to vim/vim, vim-dev ML, Comment
brianhuster left a comment (vim/vim#18105)

The problems I have seen others have
with it have been due to their inexperience or due to various Linux
distributions' packaging of Vim without the clipboard or X enabled.
That's on the distributions, not Vim, and that statement should say
that.

Note that not just Linux distributions, even the official Vim appimage release also has a version without X11 clipboard support. So saying "that's on the distributions" is not very true


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/c3222276898@github.com>

zeertzjq

unread,
Aug 25, 2025, 10:35:24 PM (10 days ago) Aug 25
to vim/vim, vim-dev ML, Comment
zeertzjq left a comment (vim/vim#18105)

Simply enabling X11 or Wayland in Vim isn't enough either, as using clipboard also requires X11 or Wayland to be actually running. One may run Vim on a server (via SSH) with no X11 or Wayland available.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/c3222357941@github.com>

Gary Johnson

unread,
Aug 26, 2025, 1:03:24 AM (10 days ago) Aug 26
to reply+ACY5DGDZ475E63IVFN...@reply.github.com, vim...@googlegroups.com
On 2025-08-25, Christian Brabandt (Vim Github Repository) wrote:
> ●chrisbra left a comment (vim/vim#18105)
>
> I was trying to avoid a complex description, that may not even always be
> correct. E.g. it does not explain why the clipboard odes not work when using
> Vim on a non-X11/Wayland UI. Or when ssh into a server.

I agree that my alternative is long, and still incomplete. However,
telling the user that the clipboard availability depends on vague
terms such as "Vim version" and "system environment" and "may not be
available" without explaining exactly what those mean leaves the
user with little understanding of the problem and with no idea how
to determine which problem they have and how to fix it.

Experienced users can figure this out, but this is in the tutorial,
so the explanation should be aimed at users who are new to Vim and
probably new to Linux.

If this is the wrong place for a detailed explanation, perhaps one
could be elsewhere and referenced here.

Regards,
Gary

vim-dev ML

unread,
Aug 26, 2025, 1:04:02 AM (10 days ago) Aug 26
to vim/vim, vim-dev ML, Your activity
vim-ml left a comment (vim/vim#18105)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/c3222631594@github.com>

Damien Lejay

unread,
Aug 26, 2025, 5:28:27 AM (10 days ago) Aug 26
to vim/vim, vim-dev ML, Comment

@dlejay commented on this pull request.


In runtime/tutor/tutor2:

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-		      Lesson 2.1.4: THE BEAUTY OF MARKS
+		     Lesson 2.1.4: SPECIAL REGISTERS
+
+ ** Use system clipboard and blackhole registers for advanced editing **
+
+ Note: The use of the clipboard depends on your exact Vim version and
+       system environment and may not be available (especially on Linux)
+
+  1. Clipboard registers  +  and  *  :
+     - "+y  - Yank to system clipboard (e.g. "+yy for current line)
+     - "+p  - Paste from system clipboard
+     - "* is primary clipboard on X11 (middle-click), "+ is clipboard (Ctrl-C/V)
+
+---> Try: "+yy then paste into another application with Ctrl-V

macOS has a UX consistent with UNIX : Ctrl-c sends an interrupt, exactly like in Vim itself.

Copy is ⌘-c.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <vim/vim/pull/18105/review/3154771213@github.com>

Christian Brabandt

unread,
Aug 26, 2025, 8:04:34 AM (10 days ago) Aug 26
to vim/vim, vim-dev ML, Comment

@chrisbra commented on this pull request.


In runtime/tutor/tutor2:

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-		      Lesson 2.1.4: THE BEAUTY OF MARKS
+		     Lesson 2.1.4: SPECIAL REGISTERS
+
+ ** Use system clipboard and blackhole registers for advanced editing **
+
+ Note: The use of the clipboard depends on your exact Vim version and
+       system environment and may not be available (especially on Linux)

that just doesn't work on tiny Vims :)


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/review/3155329500@github.com>

Christian Brabandt

unread,
Aug 26, 2025, 8:06:21 AM (10 days ago) Aug 26
to vim/vim, vim-dev ML, Comment
chrisbra left a comment (vim/vim#18105)

Note that not just Linux distributions, even the official Vim appimage release also has a version without X11 clipboard support.

That is not a very convincing argument, considering that I wrote it :)

So saying "that's on the distributions, not Vim" is not very true

It is, you just need to be able to always install Wayland/X11 libraries/dependencies, which of course nobody wants.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/c3223904773@github.com>

Christian Brabandt

unread,
Aug 26, 2025, 8:21:35 AM (10 days ago) Aug 26
to vim/vim, vim-dev ML, Push

@chrisbra pushed 1 commit.

  • 7495e7f runtime(tutor): feedback, move textobjects to the top


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/before/b0809c93a21b17bd816b8ac7718bc3fa79f0a61a/after/7495e7fe9477b15d84850ddd0eb83b47fd1af4ad@github.com>

Christian Brabandt

unread,
Aug 26, 2025, 8:22:36 AM (10 days ago) Aug 26
to vim/vim, vim-dev ML, Comment
chrisbra left a comment (vim/vim#18105)

okay I reordered the content slightly (I noticed the clipboard register used text objects, so those need to be introduced earlier) and updated the docs on when clipboard feature is available.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/c3223954602@github.com>

Christian Brabandt

unread,
Aug 26, 2025, 10:28:29 AM (9 days ago) Aug 26
to vim/vim, vim-dev ML, Push

@chrisbra pushed 1 commit.

  • 021bc61 runtime(tutor): feedback, move textobjects to the top

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/before/7495e7fe9477b15d84850ddd0eb83b47fd1af4ad/after/021bc619d2b0e91ce6c733bc3170a537fe1597c4@github.com>

Christian Brabandt

unread,
Aug 27, 2025, 12:46:25 PM (8 days ago) Aug 27
to vim/vim, vim-dev ML, Push

@chrisbra pushed 1 commit.

  • af9157c runtime(tutor): Add a section on text objects and special registers to Chapter 2

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/before/021bc619d2b0e91ce6c733bc3170a537fe1597c4/after/af9157cdd9402400ce5c3049801054a4da2b6f36@github.com>

Christian Brabandt

unread,
Aug 27, 2025, 12:48:47 PM (8 days ago) Aug 27
to vim/vim, vim-dev ML, Push

@chrisbra pushed 1 commit.

  • 07a45dc runtime(tutor): Add a section on text objects and special registers to Chapter 2

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18105/before/af9157cdd9402400ce5c3049801054a4da2b6f36/after/07a45dc1613053f42321155c6b65b70b72c009a6@github.com>

Christian Brabandt

unread,
Aug 27, 2025, 3:29:53 PM (8 days ago) Aug 27
to vim/vim, vim-dev ML, Comment

Closed #18105 via b87f133.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/18105/issue_event/19376170142@github.com>

Reply all
Reply to author
Forward
0 new messages