You are not logged in.

#1 2021-05-08 16:08:57

syoshida
Member
Registered: 2021-05-08
Posts: 4

[SOLVED] Vi wrong cursor position when :set nu

In installing Arch Linux (without X and .exrc),

root@archiso ~ # pacstrap /mnt base linux linux-firmware vi
root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab
root@archiso ~ # arch-chroot /mnt
[root@arshiso /]# vi
:set nu

I see the cursor is at wrong (left) position. Vi package version is 1:070224-4
Is it a bug or only my pc?

Last edited by syoshida (2021-05-09 23:21:27)

Offline

#2 2021-05-08 20:17:14

syoshida
Member
Registered: 2021-05-08
Posts: 4

Re: [SOLVED] Vi wrong cursor position when :set nu

Sorry, I used google only Japanese mode at first. Now I found 2 posts.

https://askubuntu.com/questions/1306835 … ith-set-nu
https://vi.stackexchange.com/questions/ … rs-are-set

Maybe same person. He ask the same question as me. But no information of environment.

Offline

#3 2021-05-09 12:20:49

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: [SOLVED] Vi wrong cursor position when :set nu

Same question came up in german Arch Linux forum some time ago, so it is not only you. We came to the conclusion that this is an upstream bug or feature.

Offline

#4 2021-05-09 14:30:13

syoshida
Member
Registered: 2021-05-08
Posts: 4

Re: [SOLVED] Vi wrong cursor position when :set nu

Thank you. I found problem is in Arch vi package.
I downloaded upstream vi from http://ex-vi.sourceforge.net/ into Ubuntu 21.04 pc and edited Makefile

INSTALL = /bin/install

And

$ make
$ sudo make install

But

$ /usr/local/bin/vi
xterm-256color: Unknown terminal type
Visual needs addressible cursor or upline capability

Then I read https://stackoverflow.com/questions/185 … capability and

$ TERMCAP="vt102|$TERM|dec vt102:"'\
    :do=^J:co#80:li#24:cl=50\E[;H\E[2J:\
    :le=^H:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
    :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
    :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
    :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
    :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
    :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:vt#3:\
    :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:vs=\E[?7l:ve=\E[?7h:\
    :mi:al=\E[L:dc=\E[P:dl=\E[M:ei=\E[4l:im=\E[4h:'
$ export TERMCAP
$ /usr/local/bin/vi

Finally the cursor was displayed at true position when :set nu.

Offline

#5 2021-05-09 16:08:25

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,391

Re: [SOLVED] Vi wrong cursor position when :set nu

File a bug report then. Or use this PKGBUILD, which stems from the heiloom-ex-vi-git package in AUR.

  
pkgname=vi
pkgver=4.1.3.r41.d47dc5a
pkgrel=1
epoch=2
pkgdesc="The traditional Vi"
arch=('i686' 'x86_64')
url="https://github.com/n-t-roff/heirloom-ex-vi/commits/master"
license=('custom:BSD')
makedepends=('git')
source=("$pkgname::git+https://github.com/n-t-roff/heirloom-ex-vi.git#commit=d47dc5ab1c66dc603b7de92ed17692e00d42d95f")
md5sums=('SKIP')

pkgver() {
  cd "$srcdir/$pkgname"
  printf "%s.r%s.%s" "$(git describe --tags | sed -E 's/([^-]*-g)/r\1/;s/-/./g')" \
                     "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/$pkgname"
  ./configure
  make
}

package() {
  cd "$srcdir/$pkgname"
  make DESTDIR="$pkgdir/" PREFIX="/usr/" install
  install -Dm644 README $pkgdir/usr/share/doc/${pkgname%-*}/README
  install -m 644 README.md $pkgdir/usr/share/doc/${pkgname%-*}/README.md
  install -Dm644 LICENSE $pkgdir/usr/share/licenses/${pkgname%-*}/LICENSE
}

Offline

#6 2021-05-09 23:17:24

syoshida
Member
Registered: 2021-05-08
Posts: 4

Re: [SOLVED] Vi wrong cursor position when :set nu

Thank you. I did bug report. https://bugs.archlinux.org/task/70770

Last edited by syoshida (2021-05-09 23:24:44)

Offline

Board footer

Powered by FluxBB