Installing vim in order to enable python and python3

Hello everyone,

Before I’m going to the main subject, I apologize in advance if my english is not perfect, since I’m from the baguette land I will happily give you a croissant.

I have seen a week ago that the vim bundle wasn’t compiled with +clipboard and since I’m currently a student (beginner to the marvelous linux world) which use vim almost everyday it was somewhat uncomfortable. So I wanted to build vim from source, which I did. After that I’ve installed YouCompleteMe a vim plugin which is a code completion plugin.

Error

The problem is when I launch vim in the terminal, I’ve got this error:
Capture d’écran de 2020-04-20 22-19-38

I’m not sure if this error is throw because python/dyn and python3/dyn.

What I’ve done

sudo swupd bundle-add deprecated-python2
sudo swupd bundle-add python3-basic

I’ve also did this ./configuration for vim:

sudo ./configure --with-features=huge \
                            --enable-pythoninterp=yes \
                            --with-python-config-dir=/usr/lib/python2.7/config \
                            --enable-python3interp=yes \
                            --with-python3-config-dir=/usr/lib/python3.8/config-3.8-x86_64-linux-gnu

and make && make install naturally.

I’ve also check vim with vim --version | grep python. This gave me the following result :

  • +python/dyn
  • +python3/dyn
1 Like

You can open an new issue on GitHub to request the clipboard support.

Also, it seems like you didn’t install ycm properly.

1 Like

See:

Actually I did some research. If you installed neovim, the clipboard feature is enabled (by default).

And I found this post helpful.

For example you can have set clipboard+=unnamedplus, then you can yank text into clipboard by pressing "+y.

Alternatively if you have

" Copy to clipboard
vnoremap  <leader>y  "+y
nnoremap  <leader>Y  "+yg_
nnoremap  <leader>y  "+y

" Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>p "+p
vnoremap <leader>P "+P

You can for example, select text in visual mode, hit leader (defaults to \) , then y to copy to clipboard.

3 Likes

Thanks for you reply @doct0rHu. I’ve not installed neovim but does is it make vim support +clipboard ?

Also thank @btwarden for your reply, before I made this topic, I checked the topic Vim/nvim configuration file which you send me, but I was confused about the use of gvim (actuallly I’ve never used gvim) I was only using vim from terminal.

I’m going to reinstall YCM and save the copy/paste configuration for .vimrc.

1 Like

neovim is a replacement for vim. It just supports clipboard by default.

2 Likes

Running gvim (vim with graphical support) with the -v flag makes it behave just like plain vim (which we compile without any graphical support, including +clipboard, to keep it from depending on large external libs like X11), except it has +clipboard compiled in.

3 Likes

I do not like to use neovim, since neovim does not support sending json to async jobs by default (I know this is arbitrary for most but I am a vim plugin developer).

If you compile vim from source you can get +clipboard and +python3 to work. see: [ How To ] Vim with Clipboard Support - #3 by Aleksei_Levykh

If you add --enable-python3interp=yes to the ./config command it will compile with python

checking Python is 3.0 or better... yep
checking Python's abiflags... 
checking Python's install prefix... /usr
checking Python's execution prefix... /usr
checking Python's configuration directory... /usr/lib/python3.8/config-3.8-x86_64-linux-gnu
checking Python3's dll name... libpython3.8.a
2 Likes

Hi,

So, l’ve removed my source compiled vim and I’ve reinstalled the vim bundle.

I’ve did an alias for gvim vim = gvim -v.

And now when I launch vim I’ve got +clipboard, and I’ve reinstalled YCM, which work perfectly with the vim distribued bundle.

So I can say that my problem has been resolved, thank you again guys for your replies!

2 Likes