Sunday, June 18, 2023

Re: Change cursor shape in command-line mode

On Sat, 17 Jun 2023 21:05:58 +0100
Bram Moolenaar <Bram@moolenaar.net> wrote:
> 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")
>

Works perfectly. I thought of using autocommands but didn't know about
"echoraw()". The helpdoc says to use it carefully because it may mess
up the console, but I'll see to it when it happens.

Thank you.

--
Enan

--
--
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/20230618215412.0000493f%40gmail.com.

No comments:

Post a Comment