Windows Terminal configuration (Neovim configuration)

Significance of Neovim

  1. vim is a very useful editor (IDE) on linux. After all, it is highly configurable
  2. If you are a linux developer, you can quickly adapt by switching to windows
  3. After the configuration is completed, you can edit files directly in powershell through vim commands, focusing on problem solving and coding, reducing the frequency of using the mouse and switching windows, and preventing end-to-end thinking
  4. It is reconstructed based on vim and introduces asynchronous tasks. After all, when VIM executed some tasks a long time ago, it would be stuck and unable to respond.
  5. B can be installed. For many people, the command line is also a belief! (my goal is only 3)

Download Neovim

  • Link address click
  • Right click to unzip somewhere on the disk

Install VIM plug

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"
  )
)

If you encounter the Download error of the second parameter of Download, it is recommended to copy the above code into txt first, and then paste it back into windows Terminal

Create profile manually

In the ~ \ AppData\Local\nvim directory, create an init vim

Some common habits of configuring the most basic vim

1. This is my simple configuration. I just use vim when writing some scripts, and save after pasting;

  • All plug-ins should be placed between begin and end
  • You need an external network (this can only be solved by yourself) to download the following plug-ins normally
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese,cp936

call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
" Code comments and anti comments
Plug 'preservim/nerdcommenter'
" Highlight the word under the cursor
Plug 'RRethy/vim-illuminate'
"Fuzzy file search
Plug 'junegunn/fzf.vim'
" ranger of nvim Plug in, file browsing
Plug 'kevinhwang91/rnvimr', {'do': 'make sysc'}
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install'  }
Plug 'mzlogin/vim-markdown-toc', { 'for': ['gitignore', 'markdown'] }
" Code format sorting
Plug 'Chiel92/vim-autoformat'
"Rainbow bracket
Plug 'luochen1990/rainbow'
call plug#end()

2. Install / uninstall plug-ins. After saving, these plug-ins do not take effect. You need to install them through the following commands;

# install
:PlugInstall
# uninstall
:PlugClean
  • Go to the installation bin directory of neovim, right-click powershell or Windows Terminal, and run here
  • input
./nvim.exe
  • Press esc and enter
PlugInstall
  • When you see "Finishing... Done!" Indicates that the installation is complete
  • If a new plug-in is deleted / added, it can be modified directly in the configuration file. After modification, run the install / delete command at the same time

Configuring powershell to support vim commands

1. Open the startup configuration file of powershell

notepad $PROFILE

2. Paste the following startup items, save and restart powershell

# There's usually much more than this in my profile!
$SCRIPTPATH = "D:\Neovim\bin"
$VIMPATH    = $SCRIPTPATH + "\nvim.exe"
Set-Alias vi   $VIMPATH
Set-Alias vim  $VIMPATH
# for editing your PowerShell profile
Function Edit-Profile
{
    vim $profile
}
# for editing your Vim settings
Function Edit-Vimrc
{
    vim $home\_vimrc
}

Closing words

  1. There is no need to regard the command line as God
  2. Personally, I think modern IDE is powerful enough, and vim is an auxiliary tool

Keywords: Windows vim PowerShell

Added by ccalzaretta on Fri, 07 Jan 2022 02:37:52 +0200