this post was submitted on 30 Jan 2025
22 points (100.0% liked)

Linux

49393 readers
1589 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Edit 4: I think I've fixed the issue. I uninstalled vim, deleted ~/.viminfo and /etc/vimrc, then reinstalled vim. I jumped around a file a bit, went in and out of edit mode, and type a bunch of ~ and it didn't jump the text around at all. Still not sure what I did, but it appears this variation of turning it on and off again worked.

I'm hoping someone can help me with this.

I was holding my laptop while I had a vile open in vim, and I slipped, mashing a bunch of keys on the keyboard by mistake.

After doing this, I can't type the ~ character anymore. Anytime I try to type it, it jumps the text to the last line, putting the last line at the top of the editing screen so that's the only line of text showing.

I thought maybe I had set an option that would show up in ~/.vimrc, but there's no ~/.vimrc file. There is a /etc/vimrc file, and a ~/.viminfo file.

I've searched and had no luck finding out what I did to cause this behavior. I also tried looking through the vim manpage and couldn't find any info there either.

Edit 3: I just installed neovim and in neovim it acts as expected when I type the ~. Something I did notice is that in vim, I now have a blinking block cursor in insert mode as well as in visual mode, while in neovim, it's a block cursor in visual mode and a vertical bar cursor in insert mode. I think this was the normal behavior in vim prior to whatever the heck I did.

Hoping someone knows what the heck I did. Thank you!

Edit: clarified what happens when I try to type ~

Edit 2: added details of the .vimrc and .viminfo files

top 12 comments
sorted by: hot top controversial new old
[–] unlawfulbooger@lemmy.blahaj.zone 7 points 16 hours ago* (last edited 16 hours ago) (1 children)

Try starting vim without config, I think that’s

vim -u NONE

Does it still occur then?

If not, it’s a config issue in /etc/vimrc and/or ~/.vimrc (or maybe ~/.config/vim/vimrc or something?)

If it does, it has to be something else.

[–] harsh3466@lemmy.ml 3 points 15 hours ago

I tried opening it without config and it acted even weirder, but that still helped me get towards my solution which is in the update in the post. Short of it is I uninstalled and removed .viminfo and /etc/vimrc then reinstalled

[–] huf@hexbear.net 4 points 16 hours ago (1 children)

vim will load some other rc file if it cant find your ~/.vimrc. check what it has loaded with :scriptnames

also, try starting vim in a brand new terminal with vim -u NONE and check if it's still happening.

[–] harsh3466@lemmy.ml 4 points 15 hours ago (1 children)

I think I fixed it with a variation of turning it off and on again. I deleted vim, deleted ~/.viminfo and deleted /etc/vimrc, then reinstalled. So far it's working as expected.

[–] huf@hexbear.net 1 points 15 hours ago
[–] irotsoma@lemmy.blahaj.zone 2 points 17 hours ago* (last edited 17 hours ago) (1 children)

Did your keyboard mapping get changed? Try running this to check the current locale:

localectl status

Other settings are generally dependent on the distro you're using.

[–] harsh3466@lemmy.ml 1 points 17 hours ago* (last edited 17 hours ago) (1 children)

I checked the locale and it is correct. I'm on Arch, and I just installed neovim to compare the cursor and typing behaviors, and in neovim it acts as expected when I type the ~.

I did notice that in vim, I now have a blinking block cursor in insert mode as well as in visual mode, while in neovim, it's a block cursor in visual mode and a vertical bar cursor in insert mode. This was the normal behavior in vim prior to whatever the heck I did.

Edit: grammar

[–] irotsoma@lemmy.blahaj.zone 1 points 15 hours ago

Yeah, probably best bet is to uninstall and purge settings. Depending on the district you're using and it's package manager, you it may be as simple as apt purge vim. And just to be sure remove all vimrc files from all user home folders including root.

[–] catloaf@lemm.ee 1 points 18 hours ago (1 children)

I'd guess if you set some option, it's in ~/.vimrc now.

[–] harsh3466@lemmy.ml 1 points 18 hours ago (1 children)

That's what I thought too, but there's no .vimrc. That was the first thing I checked. I should have included that.

[–] catloaf@lemm.ee 3 points 18 hours ago (1 children)

Hmm. Does it do it in other editors? My next guess is that it's a laptop keyboard thing, like with the Fn key.

I can't imagine you completely remapped a key or created a shortcut just by mashing keys. I'm not even sure where that config would live.

[–] harsh3466@lemmy.ml 1 points 17 hours ago

I just installed neovim and in neovim it acts as expected when I type the ~. Something I did notice is that in vim, I now have a blinking block cursor in insert mode as well as in visual mode, while in neovim, it's a block cursor in visual mode and a vertical bar cursor in insert mode. This was the normal behavior in vim prior to whatever the heck I did.