0
uname  -a
Linux MiWiFi-R3-srv 4.19.0-0.bpo.9-amd64 #1 SMP Debian 4.19.118-2~bpo9+1 (2020-05-20) x86_64 GNU/Linux

sudo dpkg -l vim
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                  Version                 Architecture            Description
+++-=====================================-=======================-=======================-===============================================================================
un  vim                                   <none>                  <none>                  (no description available)

Try to remove it:

sudo apt remove vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'vim' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

When to type vim in console:

enter image description here

sudo  dpkg -S $(readlink -f $(which vim))
dpkg-query: no path found matching pattern /usr/local/bin/vim
ls -l /usr/local/bin/vim
-rwxr-xr-x 1 root staff 2946336 Jul 17 20:34 /usr/local/bin/vim
showkey
  • 79
  • 23
  • 67
  • 128
  • What's the output of `dpkg -S $(readlink -f $(which vim))`? Also, what operating system are you using? I am assuming it is some sort of Debian-based Linux since you mention `dpkg`, but please [edit] your question and tell us exactly what your OS is. – terdon Jul 17 '20 at 12:54
  • Linux MiWiFi-R3-srv 4.19.0-0.bpo.9-amd64 #1 SMP Debian 4.19.118-2~bpo9+1 (2020-05-20) x86_64 GNU/Linux – showkey Jul 17 '20 at 13:16
  • Does your `readlink` support the `-f` flag? Is `/usr/local/bin/vim` a symlink? What is the output of `ls -l /usr/local/bin/vim`? – terdon Jul 17 '20 at 14:43

3 Answers3

1

Odds are the package name is not vim. It could be vim-tiny, vim-gnome, or god knows what.

To find it out, following search for only installed packages using apt, issue

apt list --installed vim*

Uninstall the vim packages listed there. For example, I get a line

vim-gtk3/stable,now 2:8.1.0875-5 amd64  [installiert]

So I would uninstall it with

apt remove vim-gtk3

Another simple way to find it out is to use tab-completion, if availabe. If you simply type

apt remove vim

and press tab twice, you would get a list of the packages installed that begin with vim keyword.

Quasímodo
  • 18,625
  • 3
  • 35
  • 72
1

There are either one of two things:

The package that is installed isn't vim and is actually vim-tiny, vim-athena, vim-gtk, vim-gtk3, or something else. To find out if this is the case, use the following command:

dpkg-query -l | grep vim

It could also be that the vim on your system has been compiled from source and wouldn't be found by apt or dpkg. You can verify this with:

whereis vim

That will show any vim binaries located anywhere on the system including any not located in /usr/bin that may have been compiled in different locations such as /opt or /usr/local.

You can also just use a wildcard:

If you are using apt 1.9 or newer:

apt remove '~nvim.*'

If you are using apt 1.8 or older:

apt remove vim* 
Nasir Riley
  • 10,665
  • 2
  • 18
  • 27
0
dpkg-query -l | grep vim
ii  vim-common                                2:8.0.0197-4+deb9u3                 all          Vi IMproved - Common files
ii  vim-gtk                                   2:8.0.0197-4+deb9u3                 amd64        Vi IMproved - enhanced vi editor - with GTK2 GUI
ii  vim-gui-common                            2:8.0.0197-4+deb9u3                 all          Vi IMproved - Common GUI files
ii  vim-runtime                               2:8.0.0197-4+deb9u3                 all          Vi IMproved - Runtime files
ii  vim-tiny                                  2:8.0.0197-4+deb9u3                 amd64        Vi IMproved - enhanced vi editor - compact version

It is time to remove :

sudo apt remove  vim-common
showkey
  • 79
  • 23
  • 67
  • 128