I used to develop with Vim, but installing the code completion plugin (YouCompleteMe) and CSTags was too much of a hassle (those who have installed them before should deeply understand).
Therefore, I decided to switch to Neovim. There are several benefits:
- Easier configuration management.
- In case of future computer environment migration, Neovim is more convenient.
- Faster startup speed (not significantly different).
- neovim
>= 0.8.0
- nodejs
>= v14
- lua
>= 5.2.0
First back up your original configuration information.
And then:
rm -rf ~/.config/nvim/
cd ~/.config
git clone git@github.com:hustuhao/my-nvim.git
mv my-nvim nvim
cd nvim && nvim lua/plugins.lua
Run in Neovim :w
and Wait for the plugin installation to finish.
Run in command-line mode:
:CocInstall coc-git coc-json coc-lua <your code language...>
Tips: I'm using coc.nvim.Currently, the installed code completion includes coc-go, coc-json, coc-lua
.If the programming language you need is not available, you can refer to the official website.
First, let me explain that my <leader> key is set to \
You can modify the keybindings to your preferences in file lua/keymaps.lua
:
vim.g.mapleader = "\\"
Shortcut keys | Purpose | Remark | Mode |
---|---|---|---|
<C-c> | Copy text | Press Ctrl and c to copy text | Visual |
<C-v> | Paste text | Press Ctrl and v to paste text | Normal |
<F5> | Create a new tab window | Press F5 key to create a new tab | Normal |
<leader>t | Open the file tree on the left side | Press leader,t | Normal |
<leader>tf | Open the file tree on the left side and navigate to the location of your current file | Press leader,t,f | Normal |
<leader>te | Open a floating terminal inside the file | Press leader,t,e | Normal |
<leader>g | View the git commit history for the current line where the cursor is located | Press leader,g | Normal |
You can modify the shortcut keys in file lua/keymaps.lua
.
Shortcut keys | Purpose | Remark | Mode |
---|---|---|---|
<c-]> | Go to the definition | Press ctrl and ] | Normal |
<c-t> | Go to the type definition | Press ctrl and t | Normal |
gi | Go to the type definition | Press g and i | Normal |
gr | View variable or function references | Press g and r | Normal |
<Tab> | Scroll down the suggestions within the code completion box | Press TAB to scroll down | Insert |
<S-Tab> | Scroll up the suggestions within the code completion box | Press Shift and TAB to scroll up | Insert |
<S-k> | Display detailed information about the function or variable where the cursor is located | Press Shift and k show docs | Normal |
You can modify the language-related shortcut keys in file lua/options-plugins.lua
.
- Packer: Plugins management
- Gruvbox: Neovim gruvbox colorscheme
- Vim-airline: vim airline
- vim-airline-themes: vim airline themes
- nvim-tree: A File Explorer For Neovim Written In Lua
- nvim-treesitter: provide some basic functionality such as highlighting
- coc-nvim: Make your Vim/Neovim as smart as VS Code
- vim-floaterm: Use (neo)vim terminal in the floating/popup window
- auto-pairs: Insert or delete brackets, parens, quotes in pair
- vim-go: This plugin adds Go language support for Vim/Neovim
- vim-startify: This plugin provides a start screen for Vim and Neovim.
- Copilot: Uses OpenAI Codex to suggest code and entire functions in real-time right from your editor
- lukas-reineke/indent-blankline.nvim: This plugin adds indentation guides to Neovim
- coc-snippets
- coc-prettier
- coc-lua
- coc-git
- coc-tsserver
- coc-json
- coc-go
- coc-vetur
- coc-fish
.
├── init.lua
├── lua
│ ├── colorscheme.lua (Color-related configurations)
│ ├── keymaps.lua (keybindings configurations)
│ ├── options.lua (General settings)
│ ├── options-plugins.lua (plugins settings)
│ └── plugins.lua (plugins management)
├── README.md
Option 1: First, fork
the code repository, then update the feature, and finally, initiate a pull request
.
Option 2: Directly open an issue.