Sunday, October 14, 2018

Re: Cursor setup in plain linux console

On Sunday 14 October 2018 15:50,
Dave Woodfall <dave@dawoodfall.net> put forth the proposition:
> On Friday 12 October 2018 06:44,
> Dave Woodfall <dave@dawoodfall.net> put forth the proposition:
> > Does anyone have any settings for the cursor in the plain linux
> > console (with/without screen)?
> >
> > I ask because I've set a custom cursor in the console using a control
> > code: printf '\e[?3c', but vim always resets it back to the standard
> > thin underscore, which is very difficult to see.
> >
> > I can set the cursor by setting term to 'ansi' and issuing a similar
> > code to change the cursor to a block when vim starts, but I've not
> > managed yet to set any cursors for the following editing modes:
> >
> > &t_ti
> > &t_te
> > &t_SI
> > &t_SR
> > &t_EI
>
> I've been testing a lot more with various term settings and ansi
> works fine except that the console isn't restored after :quitting.
>
> It looks like my vim isn't using the altscreen with ansi. Is there a
> way of getting both to work together?
>
> I've tried setting t_ti and t_te to the codes that they show when
> altscreen is used, but it made no difference.

Found a solution finally.

I noted what t_ti and t_te were set to and both printed them in the
shell and used them in vim, then set TERM to ansi in the shell
beforehand. It didn't work properly when I set term=ansi in vim for
some reason.

Vim:

let &t_ti="\e[?1049h"
let &t_te="\e[?1049l"
silent ! printf '\eP\e[?6c\e\\'

vim() {
printf "\e[?1049h"
TERM=ansi /usr/bin/vim $@ +"normal zv"
printf "\e[?1049l"
printf "\eP\e[?3c\e\\"
}

The extra \eP prefix and \e\\ suffix is extra escaping for screen.

It's long winded solution, but it seems to work.

--
Dave

I still maintain the point that designing a monolithic kernel in 1991 is a
fundamental error. Be thankful you are not my student. You would not get a
high grade for such a design :-)
-- Andrew Tanenbaum to Linus Torvalds

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: