94

From my .vimrc, getting:

line   16:
E319: Sorry, the command is not available in this version: filetype on
line   17:
E319: Sorry, the command is not available in this version: filetype plugin on
line   18:
E319: Sorry, the command is not available in this version: filetype indent on
line   21:
E319: Sorry, the command is not available in this version: syntax on
line   45:
E319: Sorry, the command is not available in this version: match ExtraWhitespace /\s\+$/
line   46:
E319: Sorry, the command is not available in this version: autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
line   47:
E319: Sorry, the command is not available in this version: autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
line   48:
E319: Sorry, the command is not available in this version: autocmd InsertLeave * match ExtraWhitespace /\s\+$/
line   49:
E319: Sorry, the command is not available in this version: autocmd BufWinLeave * call clearmatches()

I can remove the lines, but I would rather know what I am really missing or need upgrading that is causing this as this file worked for me before.

  • 1
    I'm using debian, not ubuntu, so this may not apply. On debian jessie, the skinny vim-tiny package is installed by default, which does not include the vim-runtime package. I fixed my E319's by installing the more bloated vim package, which has vim-runtime as a dependency. – NovaDenizen Jun 07 '16 at 15:16
  • 1
    I got here because of the same problem. Based on the correct answer, I found out vim wasn't installed, but vi was. After installing vim everything worked. – Jelmer Nov 02 '16 at 22:19
  • In my case :version doesn't say anything about GUI and installing -gui-commmon or -runtime doesn't fix the problem, it was on ~/.vimrc. – Pablo Bianchi Feb 05 '18 at 15:59

7 Answers7

130

Try from within vim ...

:version

and if your get ...

Small version without GUI.

You are missing package vim-gui-common. It is probably also advisable to install vim-runtime. Commands to install:

sudo apt-get install vim-gui-common
sudo apt-get install vim-runtime

Another cause might be that alternatives is pointing to the wrong one:

update-alternatives --display vim

to show what is used and ...

update-alternatives --config vim

to change to another vim. It could be that /usr/bin/vim.gnome is used and you need /usr/bin/vim


edit: Michael Durrant fixed it with #1 in case anyone wonders.

Rinzwind
  • 310,127
  • +1 on the answer, thanks, fixed for me too (on a puphpet.com-provisioned VM running Ubuntu 12.04 LTS 64bit): the commands mentioned in the answer above: 1) sudo apt-get install vim-gui-common then 2) sudo apt-get install vim-runtime fixed it for me - i.e. no more E319: Sorry, the command is not available in this version: errors. In fact, 1) was the fix, really when issuing command 2) I got messages saying things were already up to date: ...vim-runtime is already the newest version. vim-runtime set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 59 not upgraded. – therobyouknow Jul 07 '14 at 12:52
  • 3
    If you don't want the GUI, you can just sudo apt-get install vim-nox (and then :version will report Huge version without GUI.) – ysth Mar 30 '16 at 16:04
  • vim-gui-common worked for me and fixed the up/down arrow issue when editing. – user217019 Aug 16 '20 at 19:53
29

You probably don't have the full version of VIM installed. To check, try executing vim or:

readlink -f `which vi`

For example, Ubuntu 16.04 LTS only came with /usr/bin/vim.tiny

Install the full VIM:

sudo apt update
sudo apt install vim

Now you should have /usr/bin/vim.basic, and the .vimrc commands should succeed.

wisbucky
  • 2,772
  • 32
  • 17
  • 1
    This worked for me on Linux Mint while the top answer did not. – adrianmcli Sep 06 '17 at 01:47
  • Thank you for this. vim-gui-common wants to install a bunch of useless cruft that would eat another 143MB of disk space -- which is important when I'm trying to build a <1GB live image. – Doktor J Jun 08 '20 at 23:31
  • This worked for me on a headless raspberry pi. I think this is a simpler solution than the accepted answer and the original question does not reference a GUI installation. – Dave C May 13 '21 at 16:55
8

If this started after you've updated to 16.04, it might be b/c of the change to python 3 as the default interpreter as @luka5z pointed out.

To resolve, I updated to the latest clang-format.py file from https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.py

and edited .vimrc lines from:

" Add hook for clang-format
map <C-K> ggVG :pyf /usr/local/bin/clang-format.py<cr>
imap <C-K> <c-o>:pyf /usr/local/bin/clang-format.py<cr>

to:

" Add hook for clang-format
map <C-K> ggVG :py3f /usr/local/bin/clang-format.py<cr>
imap <C-K> <c-o>:py3f /usr/local/bin/clang-format.py<cr>
Daniel
  • 201
6

If you got the error by running other command like crontab -e, the reason is you need to select vim as your editor. Default nano will be used. So just run select-editor, and select vim, then the problem will be solved.

3

In my case the problem was that I had a file ~/.selected_editor with content:

# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/vim.basic"

I rerun select-editor command and selected /usr/bin/vim.basic option - this changed the editor used by external programs.

gawi
  • 173
  • 3
  • 8
2

For me I had to install vim.nox-py2:

aptitude install vim-nox-py2

and use update-alternatives to activate it:

update-alternatives --config vim

select the number corresponding to vim.nox-py2.

Davim
  • 61
  • To be noted that this is for 16.04. Vim on Ubuntu used to have only python2 enabled, now it's python3-enabled and python2 ones in a separate package. – muru Mar 27 '16 at 16:00
  • 3
    Python3 is default interpreter for Ubuntu 16.04. If this message appears as a result of using py command, replace it by Python 3 equivalent py3. – luka5z Sep 01 '16 at 12:46
  • @luka5z your comment is the most usefull thing I found o this page! – e4c5 Dec 12 '16 at 05:55
0

Check if you have the normal VIM version using vim --version as described in more detail here. I happened to open the files using vi which was the cause in my case. Opening with vim instead fixed the issue.

silent_monk
  • 31
  • 1
  • 7