惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
博客园 - 【当耐特】
量子位
有赞技术团队
有赞技术团队
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
C
Check Point Blog
B
Blog RSS Feed
M
MIT News - Artificial intelligence
H
Help Net Security
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
腾讯CDC

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
Neovim configuration on Windows 10
2018-11-15 · via jdhao's digital space

update: 2020-11-15, add detailed instruction for Neovim config location.

TL;DR: After nearly one year of using Neovim on Windows, I find that the best experience one can get on Windows is to use GUI Neovim client such as Nvim-qt or fvim, not the terminal Nvim1.

In this post, I want to share how to install and configure Neovim on Windows 102. For configurations of nvim-qt on Windows, check this post.

Before we begin#

The built-in CMD on Windows is awful and lacks features of a normal Linux terminal. I strongly recommend readers using a better terminal emulator, for example, Cmder, which comes with Git for Windows and other utilities for you.

Install#

You can download the neovim nightly release from its GitHub repo. Then extract the package, add the extracted folder to your system PATH variable, and make sure that you can invoke nvim on the command line.

See here for other ways to install Neovim on Windows.

Where to put the configuration file?#

A common confusion for novice users of Neovim is that they do not know where to put the config files. It is in fact quite simple.

First of all, the neovim config file is named init.vim regardless of your system.

Second, based on Neovim official documentation, you should put init.vim under the directory ~/AppData/Local/nvim on Windows. To find here that directory is exactly, use the command :echo stdpath('config') inside Neovim.

If this directory does not exist, do not worry. Just create it and put your config file there.

Install plugin-manager vim-plug#

vim-plug is popular plugin manager for Neovim. To install it on Windows, open a PowerShell terminal (not Windows CMD!), and execute the following command:

md ~\AppData\Local\nvim\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile(
  $uri,
  $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
    "~\AppData\Local\nvim\autoload\plug.vim"
  )
)

In init.vim, use the following settings for vim-plug:

call plug#begin('~/AppData/Local/nvim/plugged')
" below are some vim plugins for demonstration purpose.
" add the plugin you want to use here.
Plug 'joshdick/onedark.vim'
Plug 'iCyMind/NeoSolarized'

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()

When we run command :PlugInstall, all the plugins will be installed under ~/AppData/Local/nvim/plugged. We can also change this directory to where we want, for example, ~/AppData/Local/nvim-data/plugged.

Issues#

The Neovim window content is not cleared when I exit#

When I exit Neovim, the text content inside the buffer is still shown in the command line, wasting a lot of space. How do we clear the Neovim window content after exit?

After some research, I have finally found a solution that works for Cmder. Open Cmder settings and go to Startup -> Environment, add the following settings:

Restart Cmder and the issue should disappear. More discussions can be found here.

Can not enter Neovim if there are errors in config file#

If there are errors in init.vim, Neovim will prompt you the following message during startup:

Press ENTER or type command to continue

However, pressing Enter has no effect. Neovim will hang unless you press Ctrl-C to terminate the process.

To circumvent this issue, according to this issue, try to open Neovim with the following option:

Some shortcuts do not work#

Shortcut conflict with Cmder#

For Cmder, Ctrl-W is used to close a console. Unfortunately, this shortcut is also used by Neovim as prefix for window operations. Maybe there are some other conflicting shortcuts, for example, Ctrl-V does work like Linux.

To disable the conflicting shortcuts in Cmder, go to Keys & Macro part to change or disable a shortcut.

<Ctrl-6> does not work?#

On Linux, we can use Ctrl-^(actually Ctrl-6) to switch buffers. However, on Windows, using <Ctrl-6> for buffer switching does not work in terminal nvim. I try to map Ctrl-6 to Ctrl-^:

It doesn’t work either. Until I find the solution , I use Ctrl+shift+6 to switch buffers.

My complete configurations for Neovim can be found in this repo. For How to configure Neovim for Python development, check this post.

References#