How To Install Neovim On Windows 10
Alter log
- 2022-01-29: Add deprecation detect
- 2021-01-17: Install nvim via tar ball instead of appimage
- 2020-12-01: Add detailed guide on installing Neovim on Linux
TL;DR: My complete nvim configuration is hither. Follow the guide there on how to use information technology. Most of the config beneath besides applies to Windows and Mac. For how to configure Neovim on Windows, you lot may also be interested in this post.
2022-01-29: Note that this post is written more three years ago. Some of the plugins mentioned here may non be maintained or may non be the all-time fit for Neovim, or fifty-fifty not needed, east.g., highlighted yank is builtin in Neovim since May 2020. I have shared some of the plugin changes in this mail service.
Vim is a pop lawmaking editor on Unix/Linux systems, and it is often compared with Emacs, another great code editor amongst programmers. The debate almost which ane is the best editor never cease. Vim is powerful, but information technology has its own shortcomings every bit an old editor1. Over the years, Vim'southward code base has grown increasing larger, which makes it hard for maintenance and for adding new features chop-chop. It has simply one core developer, Bram Moolenaar. Although Vim has a lot of contributors, nearly all patches are merged past Bram2. To overcome the shortcomings of Vim, preserve its advantages (i.eastward., compatible with Vim) and make the evolution of Vim faster, the Neovim project is created.
In this post, I will give a detailed guide on how to install Neovim and configure it as an IDE-similar environs for Python evolution (in the rest of this post, I will use Neovim and Nvim interchangeably).
Install Nvim
Neovim has pre-built binary parcel for Linux, you can download it from the Neovim GitHub release page:
mkdir -p $Habitation/tools/ && cd $Abode/tools/ wget https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz tar zxvf nvim-linux64.tar.gz The executable file is located in $Home/tools/nvim-linux/bin/nvim.
Now, we need to add the bin directory to the system PATH. Open .bash_profile and add together the following line:
consign PATH = $HOME/tools/nvim-linux64/bin:$PATH Salve the file and source it to make the change accept effect.
At present, Neovim has been installed on your organization successfully. You tin can open neovim on terminal with nvim command.
Nvim configuration file
Neovim employ a different configuration file from Vim. Yous need to create a file named init.vim under the directory $HOME/.config/nvim (if this directory does not exist, merely create i)3. All configurations can be put into this file.
Nearly of the configuration options for Neovim are the same with Vim. Yous tin copy your vim configurations if y'all have used Vim before.
Install and employ a plugin manager
One of master reasons for the powerfulness of Vim comes from the diverse plugins written for it. With these plugins, you tin reach all sorts of crazy things which are hard to accomplish with plain Vim. If you have installed a lot of plugins manually, you will find it difficult to manage them. Like Vim, Neovim does not have a congenital-in plugin managing director. We demand to install one ourselves.
There are 2 plugin managers in wide use among Nvim users. Ane is dein and the other is vim-plug. Vim-plug has a larger user base and seems more pop. Finally, I decided to requite vim-plug a try.
Install vim-plug
- Install vim-plug itself:
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim After installing vim-plug, you lot may need to restart Nvim.
- Edit
init.vimand add the configuration for vim-plug. I show an example configuration below (modified from the vim-plug GitHub page):
telephone call plug#begin ( '~/.local/share/nvim/plugged' ) Plug 'davidhalter/jedi-vim' phone call plug#end () Note that all the plugin installation command must be put within the ii call command above. I will non repeat that later.
How to use vim-plug
You can execute post-obit control in Nvim command manner:
- Install plugins:
:PlugInstall - Update plugins:
:PlugUpdate - Remove plugins:
:PlugClean(Commencement, comment the plugin install command ininit.vim. Open Nvim and use:PlugCleanto uninstall plugins) - Check the plugin status:
:PlugStatus - Upgrade vim-plug itself:
:PlugUpgrade
Disable a plugin merely temporarily
If you desire to disable certain plugin for a while simply do not want to delete it, you can endeavor two methods:
-
Annotate out the plugin and reopen Nvim.
-
According to discussions hither, to disable plugin
foo/bar, y'all can use the post-obit settings:
Plug 'foo/bar' , { 'on': [] } Plugin install and settings
Auto-completion plugin deoplete
deoplete is an motorcar-completion plugin designed for Neovim:
Deoplete is the abbreviation of "night powered neo-completion". It provides an extensible and asynchronous completion framework for neovim/Vim8.
Strictly speaking, information technology is an auto-completion engine. In order to enable auto-completion for a sure programming linguistic communication, you need to install the corresponding source.
Deoplete is easy to install. Apply the following settings inside the vim-plug calls:
Plug 'Shougo/deoplete.nvim' , { 'do': ':UpdateRemotePlugins' } The minimum setting for deoplete is as follows:
let g:deoplete#enable_at_startup = one For more options and their meanings, cheque :h deoplete-options inside Nvim.
Install plugin deoplete-jedi
As I accept said, deoplete supports motorcar-completion for various languages via dissimilar sources. In order to do auto-completion for Python, we demand to install deoplete-jedi. In the following, I listing the steps to install deoplete-jedi.
Step one: Install dependency packages
Kickoff we need to install pynvim,
Nosotros likewise need to install jedi. If y'all happen to use the latest version of Anaconda, jedi is already installed. Otherwise, yous tin install jedi via pip:
Step two: Install and set up deoplete-jedi
First, we demand to install deoplete-jedi using vim-plug:
Plug 'zchee/deoplete-jedi' Later on that, if nothing wrong happens, you can utilize auto-completion now! Open a Python source file with Nvim and kickoff editing, you lot will run across the auto-completion pop-up menu like what is shown in the following image:
How to use deoplete
- How to navigate betwixt the items in the car-completion list?
According to discussions here, you can navigate through the automobile-completion list with <Ctrl-Due north> and <Ctrl-P>.
- How to automatically close the method preview window?
When we navigate through the auto-completion listing, a small window will appear on top of current window and gives hints near the parameters of electric current selected method. Only this window volition not disappear afterwards machine-completion is done. According to discussions here, we can use the post-obit setting to close the preview window automatically:
autocmd InsertLeave , CompleteDone * if pumvisible () == 0 | pclose | endif - How can I open up the preview window below the current window?
By default, preview windows will open up on top of electric current window. You tin change this behaviour by adding set splitbelow in the configuration file. For more info, see here.
- How tin I navigate through the auto-completion list with Tab?
Add the following setting in the Nvim configuration file:
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>" Status bar plugin: vim-airline
The default condition bar of Nvim is simple and tin not provide much useful information like Sublime Text or other modern code editors. Nevertheless, the status bar tin can exist customized to achieve wonderful furnishings. An excellent plugin is called vim-airline, which tin achieve the same functionalities equally Sublime Text status bar. It is piece of cake to install:
Plug 'vim-airline/vim-airline' Use :PlugInstall to install this plugin and restart Nvim. You should be able to run across the new condition bar with more data displayed.
Switch vim-airlinetheme
Vim-airline provides a lot of themes for you to customize your status bar. Check here to see what different theme looks like. Vim-airline has put the various themes in some other plugin chosen vim-airlinetheme. To change the theme, we need to install this plugin:
Plug 'vim-airline/vim-airline-themes' So, in the Nvim configuration file, add together the post-obit settings:
permit 1000:airline_theme = '<theme>' " <theme> is a valid theme name Automatic quote and bracket completion
When input quote and bracket, we frequently wish to input them as pairs. Nvim does not support this feature. Auto-pairs tin achieve this and much more. Simply install it:
Plug 'jiangmiao/auto-pairs' How to use
Allow's have manipulating double quotes as an example. In insert model, press ", information technology will automatically become 2 double quotes. At the same time, the cursor is placed between the ii double quotes, waiting for input. When y'all end inputting text between the quotes, you may desire to identify the cursor afterward the right quote and continue inserting text. Here comes the magic office: only press " one more than fourth dimension, and the cursor will be placed right backside the right quote.
Different programming languages have different specifications for annotate. Information technology would exist smashing to change the comment style for the current file based on its file type. nerdcommenter is one such plugin. Install it with vim-plug:
Plug 'scrooloose/nerdcommenter' To comment out a single line, employ <leader>cc (leader is a prefix key in Nvim, the default leader key is backslash \); to uncomment a line, employ <leader>cu. To comment or uncomment several lines, add a repeating number to respective control, just like what you do in patently Vim. For more than usages, check nerdcommenter's documentation.
lawmaking auto-format plugin
Neoformat can be used to format your source code. Install it with vim-plug:
For Python code, yous demand to install a Python lawmaking formatter to work together with neoformat. We will choose yapf. Showtime, we install this formatter with pip:
Then, y'all tin can format Python code with yapf formatter using neoformat.
How to format lawmaking?
In command mode, input Neoformat, neoformat will car-format your source code.
If neoformat can not discover your file type or you haven't installed any formatter. You lot can add the following command to your Nvim configuration to let neoformat do some bones format for the file:
" Enable alignment permit g:neoformat_basic_format_align = 1 " Enable tab to space conversion let chiliad:neoformat_basic_format_retab = 1 " Enable trimmming of trailing whitespace let g:neoformat_basic_format_trim = 1 At that place is another format plugin vim-autoformat which you can attempt.
Lawmaking jump (become-to) plugin
We often need to jump to the definition of grade and method to cheque their implementation details. We tin can utilise jedi-vim to achieve this. Really, jedi-vim can also do code motorcar-completion. Since nosotros have installed deoplete and deoplete-jedi, nosotros can disable code completion and simply use the code jump function of jedi-vim. Install jedi-vim with vim-plug:
Plug 'davidhalter/jedi-vim' Use the following uncomplicated configuration:
" disable autocompletion, because we use deoplete for completion let yard:jedi#completions_enabled = 0 " open the become-to function in split up, not another buffer permit thou:jedi#use_splits_not_buffers = "right" How to use jedi-vim
Move the cursor to the class or method yous want to check, then press the diverse supported shortcut provided by jedi-vim:
-
<leader>d: go to definition -
Chiliad: cheque documentation of class or method -
<leader>north: show the usage of a name in current file -
<leader>r: rename a proper name
File managing and exploration plugin
Those who have been working with GUI code editors are familiar with the sidebar on the left side of the code editor, which provides an overview of files and folders in current projection. How do we attain similar functions in Nvim? You can employ nerdtree. First, install it using vim-plug:
Plug 'scrooloose/nerdtree' How to use nerdtree?
- How to open file navigation window?
In command fashion, input :NERDTree to open the directory your current file resides.
- How practice I open a file in the file explorer?
Place the cursor in the file you want to open up and press o to open this file in the correct window.
- How do I switch between file window and nerdtree file navigation window?
This is the aforementioned every bit how you lot switch windows in Vim. Press ctrl and press w two times quickly to switch window. You lot tin can as well press <Ctrl-w> and so press L.
- How exercise I go out or close file explorer window?
Press q while your cursor is this window? Or use NERDTreeClose control in command mode.
For more customization, refer to this post.
Code checker plugin
Neomake is a tool for code syntax check and build automation for Nvim. Install it with vim-plug:
Neomake's syntax bank check for various languages relies on various linters. After installation, yous need to install linters according to your programming languages. The linter for different languages are listed here.
For Python, nosotros tin can utilize pylint as linter. Install pylint with pip or conda:
conda install pylint # pip install pylint Afterwards installing pylint, we demand to fix it in init.vim every bit the Python code checker:
let g:neomake_python_enabled_makers = ['pylint'] Code checking
In command style, use Neomake command to start syntax check. We can as well enable automatic lawmaking bank check. Just add the post-obit setting in Nvim configuration file:
call neomake#configure#automake('nrwi', 500) Pylint checks extensively on your code, which makes it a bit slow. Another code linter you lot tin try is flake8, which is faster.
Multiple cursor editing plugin
If you lot accept used Sublime Text before, yous must exist impressed by Sublime Text's ability to edit multiple position in the lawmaking simultaneously. This part is great when you desire to refactor your code. Y'all can reach similar function with the help of vim-multiple-cursors. Install information technology with:
Plug 'terryma/vim-multiple-cursors' How to use
In normal mode, move the cursor to a variable yous want to rename, printing <Ctrl-N> and this variable volition be highlighted. Keep press <Ctrl-Due north>, the next occurrence of this variable will exist highlighted. If yous desire to skip a certain occurrence (for instance, a string may incorporate a sub-string which is the same as the variable), just press <Ctrl-X> subsequently this position has been highlighted. Continue selecting the occurrence of this variable until all its occurrence has been selected.
Now, printing c (in Nvim, c means to alter ) and enter insert mode. Input a new proper noun and relieve.
But, I should say that this plugin is not perfect. When you have a lot of occurrences of the variable in the file, the refactor of variable name is boring.
There are some discussions about Neovim'south native support for multiple cursors. But information technology seems that this part is nonetheless not finished as of today. You tin find relevant discussions in the post-obit links:
- https://github.com/neovim/neovim/bug/3845
- https://github.com/neovim/neovim/issues/211
- https://github.com/neovim/neovim/problems/7257
- https://github.com/onivim/oni/problems/184
Highlight your yank area
In Nvim, if y'all yank (i.east., re-create) a block of text, you do not get a visual hint nearly exactly what you take copied. Unless you are very familiar with Nvim, you may have copied less or more than what you want to copy, which is annoying. With the help of vim-highlightedyank, you can at present highlight the text region which you have yanked. Handy little characteristic, isn't it?
You can install it with vim-plug:
Plug 'machakann/vim-highlightedyank' Almost of the time, y'all do not need any farther settings after installing this plugin. But, for some colorschemes, you will not be able to see the highlight colors. To fix this issue, add together the post-obit setting to Nvim configuration:
hi HighlightedyankRegion cterm = opposite gui = reverse If you feel that the highlight elapsing time is too short, yous can increase the highlight duration (measured in ms):
" set highlight duration fourth dimension to 1000 ms, i.e., 1 2nd let k:highlightedyank_highlight_duration = 1000 Code folding plugin
For big code base of operations, it is helpful to fold some part to go a better idea of the structure of the lawmaking. SimplyFold is nice plugin for code folding. Install information technology with vim-plug:
Plug 'tmhedberg/SimpylFold' You practise not need farther settings. It works out of the box.
simple usage
There are some shortcuts to dispense lawmaking folding:
-
zo: Open up fold in electric current cursor position -
zO: Open up fold and sub-fold in current cursor position recursively -
zc: Close the fold in electric current cursor position -
zC: Shut the fold and sub-fold in current cursor position recursively
Theme install and configuration
Before we begin
Neovim has several congenital-in colorschemes or themes. You may non like them and want improve themes. It is piece of cake to install a theme. But it is piffling tricky to make the theme display correctly equally what the theme homepage shows. A lot of themes will not display well if you employ an SSH client which has poor back up for truthful colors. For Windows system, after trying several SSH clients, I notice that ZOC works best. For Mac, yous can employ the open source tool iTerm2. To find more SSH clients which support true colors, visit this page.
Install themes
Gruvbox is a popular Vim colorscheme. Install it with vim-plug:
Then use :PlugInstall to install it just similar you lot install other plugins.
In Nvim configuration file, activate this theme with the following setting:
Information technology has two modes, i.e., dark and lite, which tin be switched using the post-obit settings:
set background = night " utilise dark mode " ready background=low-cal " uncomment to use calorie-free way Restart Nvim and you volition activate the new theme. It looks like the following on my Mac:
Other themes
There are other themes you lot may want to try:
- 1 night
- monokai
- jellybeans
- NeoSolarized
How do I change the font?
Unlike Sublime Text, you tin non set which font to utilise in Nvim'southward configuration. Instead, Nvim will utilise the font you cull for your terminal emulator. And then yous demand to set up your favorite font in the terminal. Some expert programming fonts are:
- Hack
- FiraCode
- Source Lawmaking Pro
Check nerd fonts for more programming fonts.
How to find more interesting plugins?
There is a website called vimawesome, which collects information nearly various Vim plugins. Y'all can find helpful plugins on this website.
Since most Vim plugins are published on GitHub, you lot tin likewise search with vim and other keywords on GitHub to find relevant plugins. For instance, search vim colorschem or vim theme to find themes designed for Vim.
Builtin terminal
Neovim has support for terminal emulator so that you tin can directly run a shell inside Neovim. Information technology is handy for temporary shell operations.
To open the terminal, use :final or :vnew term://fustigate or new term://bash. After entering the terminal, you are in normal mode. Press i to start typing final control.
To leave insert mode in last emulator, press <Ctrl+\><Ctrl+North>.
To go out terminal emulator and close the window, use exit.
The difference betwixt Nvim and Vim
Back up for bracketed paste style
Neovim has back up for bracketed paste mode. The paste option in Vim is obsolete. Use :h paste and you will the following documentation:
This option is obsolete; bracketed-paste-mode is built-in.
Neovim is all nocompatible
In Nvim normal way, utilize :h comatible, and you will see that:
Nvim is always "nocompatible"
For more differences between Nvim and Vim, see here.
Trouble shooting
In this part, I introduce some issues found when using Nvim and how to set up these issue.
Nvim colorscheme does not await right inside Tmux
If your concluding supports true colour, first install the latest version of tmux4, add together the following config to ~/.tmux.conf (extracted from here)
set -g default-last "screen-256color" set up -ga final-overrides ",xterm-256color*:Tc" Then the colour should be fine. Otherwise, in the Nvim config file init.vim, use the post-obit setting instead:
Also, there are some discussions here.
How exercise I go a log file when starting Neovim
Use nvim -VNUMnvim.log. NUM is used to indicate verbose level, for example:
The in a higher place command creates a log file nvim.log with verbose level ten.
More than reference here. Run across also nvim --aid.
OK, that is end of this long post. You lot can find my consummate Nvim configurations here. Happy Vimming!
-
Vim was commencement released in 1991. Its predecessor is 6, born in 1978. ↩︎
-
Developers would send a patch to Bram. Bram will review it and then merge it on GitHub if he thinks the patch is okay. ↩︎
-
For Windows, the config directory is different. Open neovim and run command
:echo stdpath('config')to find the exact directory. ↩︎ -
Check here on how to build the latest version of tmux from source. ↩︎
Source: https://jdhao.github.io/2018/12/24/centos_nvim_install_use_guide_en/
Posted by: bowershavocapiente.blogspot.com

0 Response to "How To Install Neovim On Windows 10"
Post a Comment