Vim/Neovim and Copilot: Part 1 install Vim 9.0 +

part 1 (vim): How to upgrade vim to a higher version without using sudo?

Jimmy (xiaoke) Shen
4 min readFeb 28, 2024

Introduction

Are you a Vim user pondering the integration of Copilot into your workflow? It’s worth considering. Embracing AI-driven coding could significantly enhance your productivity.

How to get started?

To embark on this journey, you’ll need about $10 per month. That’s just a few cups of coffee to fuel your AI helper along the way. You can find the option from your github profile.

Setup for vim by click Neovim link

It will direct you to here

Looks we need vim version 9.0.

Upgrade your vim to a higher version WITHOUT use root (sudo)

If you are using Neovim, check here.

If you have sudo, should be much easier, in this article, we focus on not having sudo case.

Check curr vim version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 18 2020 14:06:17)
Included patches: 1-1689
Extra patches: 8.0.0056

Upgrade vim to 9.0+

download vim source code and go to src folder, run [2]

./configure - prefix=$HOME/.local - enable-multibyte - enable-pythoninterp - with-features=huge - enable-fail-if-missing && make && make install

You may have the following issue:

checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
You need to install a terminal library; for example ncurses.
On Linux that would be the libncurses-dev package.
Or specify the name of the library with --with-tlib.

In order to fix, you can download ncurses from the latest version, or you can check the version by yourself from https://ftp.gnu.org/pub/gnu/ncurses/ [1]


wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.4.tar.gz
tar -xf ncurses-6.4.tar.gz

mkdir -p ~/usr/local
cd <path_to_ncurses>
./configure - prefix=$HOME/usr/local
make
make install

Install vim again by going to vim src folder: make install -j20, 20 is the number of CPU core you have, feel free to adjust it.

LDFLAGS=-L$HOME/usr/local/lib ./configure --prefix=$HOME/.local --enable-multibyte --enable-pythoninterp --with-features=huge --enable-fail-if-missing && make && make install -j20

Last step

export PATH=$PATH:$HOME/usr/local/bin

Then it should work if you can see following

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Feb 28 2024 16:48:19)
Included patches: 1-140
Compiled by ad621@ip-10-246-62-173
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
+balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term +gettext +num64 +textobjects
+browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand -perl +title
+channel +ipv6 +persistent_undo +toolbar
+cindent +job +popupwin +user_commands
+clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap +python +viminfo
+cmdline_info +libcall -python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap -ruby +wildignore
+cursorbind -lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con_gui +mksession +smartindent +writebackup
+diff +modify_fname -sodium +X11
+digraphs +mouse -sound +xattr
+dnd +mouseshape +spell -xfontset
-ebcdic +mouse_dec +startuptime +xim
+emacs_tags -mouse_gpm +statusline -xpm
+eval -mouse_jsbterm -sun_workshop +xsmp_interact
+ex_extra +mouse_netterm +syntax +xterm_clipboard
+extra_search +mouse_sgr +tag_binary -xterm_save
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/home/ad621/.local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/home/ad621/usr/local/lib -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lrt -ldl -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions

Reference

[1] https://askubuntu.com/questions/158344/no-terminal-library-found-when-compiling-vim

[2]https://superuser.com/questions/162560/how-to-install-vim-on-linux-when-i-dont-have-root-permissions

--

--

Jimmy (xiaoke) Shen
Jimmy (xiaoke) Shen

No responses yet