Saturday, June 17, 2023

Re: Change cursor shape in command-line mode

Enan Ajmain wrote:

> Vim allows changing cursor shapes according to the current mode: insert,
> replace, or normal. Vim does this using terminal escape sequences.
> Details are in ':h termcap-cursor-shape'.
>
> I was wondering if I could change the cursor shape in command-line mode.
> I'm fairly certain it's not possible, but I thought it wouldn't hurt to
> ask.

You should be able to make this work with the CmdlineEnter and
CmdlineLeave autocommand events. You can use echoraw() to output the
terminal codes. As a starting point, this appears to work:

au CmdlineEnter * call echoraw("\<Esc>]12;red\x7")
au CmdlineLeave * call echoraw("\<Esc>]12;blue\x7")

--
What is the difference between a professional and an amateur?
The ark was built by an amateur; professionals gave us the Titanic.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230617200558.5C0901C0948%40moolenaar.net.

No comments: