# nvim
**Repository Path**: peakyet/nvim
## Basic Information
- **Project Name**: nvim
- **Description**: configuration for vim
- **Primary Language**: Lua
- **License**: MulanPSL-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2022-06-14
- **Last Updated**: 2023-12-15
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
- [Neovim](#neovim)
- [Description](#description)
- [Install plugins in Ubuntu](#install-plugins-in-ubuntu)
- [Syntax](#syntax)
- [LSP](#lsp)
- [Debugger](#debugger)
- [How to use debuger](#how-to-use-debuger)
- [Plugins](#plugins)
- [TODO](#todo)
- [Lua resources](#lua-resources)
- [Recommend Keyboard](#recommend-keyboard)
- [Update](#update)
- [2023-7-6](#2023-7-6)
- [2023-6-4](#2023-6-4)
- [2023-5-20](#2023-5-20)
# Neovim
## Description
This repo is used to store my neovim configuration.
## Installation
***I recommend you to use a manager "MordechaiHadad/bob" in github to take control of the neovim.***
```shell
# install releases from github
wget https://github.com/MordechaiHadad/bob/releases/download/v2.4.1/bob-linux-x86_64.zip
unzip bob-linux-x86_64.zip
chmod -R 755 bob
sudo ln -s ${path}/bob /usr/local/bin/bob
# zsh
bob complete zsh > ~/.zsh_functions/_bob
```
And then
```shell
bob install nightly
bob use nightly
# check the nvim
nvim --version
```
Now you can use the nightly version of neovim.
> The official tutorial can be found in [official website](https://github.com/neovim/neovim/wiki/Installing-Neovim).
>
> In Linux, we install APPImage for convenience.
>
> ```shell
> curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
> chmod u+x nvim.appimage
> ./nvim.appimage
> ```
>
> If the `./nvim.appimage` command fails, try:
>
> ```shell
> ./nvim.appimage --appimage-extract
> ./squashfs-root/AppRun --version
>
> # Optional: exposing nvim globally.
> sudo mv squashfs-root /
> sudo ln -s /squashfs-root/AppRun /usr/bin/nvim
> nvim
> ```
>
> If you want to uninstall neovim, you need to delete `/squashfs-root` and the corresponding link. Then remove ` ~/.local/share/nvim, ~/.cache/nvim, ~/.local/state/nvim`.
>
using `:checkhealth` to check the plugin.
> install module 'pynvim' for python env. `conda install pynvim` (if you use any plugins needing python)
### Install plugins in Ubuntu
- install [dependencies](https://github.com/BurntSushi/ripgrep) for nvim-telescope.
- install npm, nodejs, unzip(clangd) and python3.8-venv(cmake)
```bash
sudo apt update
sudo apt install npm
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install nodejs
sudo apt-get install unzip
sudo apt install python3.8-venv
```
> install the nodejs with 14.x version.
> Need a patched font (see [nerd fonts](https://github.com/ryanoasis/nerd-fonts))
> In WSL2, just install the window compatible font and select the font in window terminal.
Open Neovim, the plugins manager (lazy.nvim) will install plugins automatically. After all plugins are installed, close the neovim and open neovim again which will install LSP and debuggers automatically.
In order to use markdown-preview.nvim plugin, we need to navigate to `stdpath('data')/lazy/markdown-preview.nvim/app` and run `npm install`.
### Syntax
1. Your home directory, for personal preferences. Given by `stdpath("config")`. `|$XDG_CONFIG_HOME|`
2. Directories which must contain configuration files according to `|xdg|` (`$XDG_CONFIG_DIRS`, defaults to `/etc/xdg`). This also contains preferences from system administrator.
3. Data home directory, for plugins installed by user. Given by `stdpath("data")/site`. `|$XDG_DATA_HOME|`
4. nvim/site subdirectories for each directory in `$XDG_DATA_DIRS`. This is for plugins which were installed by system administrator, but are not part of the Nvim distribution. `XDG_DATA_DIRS` defaults to `/usr/local/share/:/usr/share/`, so system administrators are expected to install site plugins to `/usr/share/nvim/site`.
5. Applications state home directory, for files that contain your session state (eg. backupdir, viewdir, undodir, etc). Given by `stdpath("state")`. `|$XDG_STATE_HOME|`
6. `$VIMRUNTIME`, for files distributed with Neovim.
7. `:verbose noremap {keybinding}` is used to check the keybinding.
8. `:mess` is used to print the message of neovim's output.
# LSP
Change Lsp you want in `nvim/lua/plugin/Lsp.lua`. You can choose LSP by run `:Mason`, and set it up in `.config/nvim/lua/plugins/Lsp/lspconfig.lua` .
## Debugger
You should install [debug adapter](https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation) yourself and add configuration files in `lua/plugins/DAP/` and set it up in `lua/plugins/DAP/dap.lua`. (Python and cpp configuration files have been added)
Use [ vscode json ](https://code.visualstudio.com/docs/cpp/launch-json-reference) configuration in `.vscode` to configure the behavior of debuggers.
### How to use debuger
See `lua/plugins/DAP/dap.lua` for the default keybindings and [official document](https://github.com/mfussenegger/nvim-dap/) for more details.
## Plugins
- LSP:
- [x] Mason and Mason-lspconfig (Lsp Installer)
- [x] nvim-lspconfig (Lsp)
- [x] nvim-cmp (a completion plugin)
- [x] neodev
- [x] autopairs
- [x] treesitter
- [x] treesitter-textobjects
- [x] lsp-status
- [x] lspsaga
- [x] gaurd (formatter and linter)
- DAP:
- [x] nvim-dap (debuger)
- [x] c++ configuration
- [x] python configuration
- [x] dap-ui
- Git:
- [x] gitsigns (git)
- [x] diffview.nvim
- [x] lazygit
- Note taking
- [x] markdown-preview (Markdown)
- Other:
- [x] indent-blankline
- [x] comment
- [x] nvim-tree (file explorer)
- [x] nvim-base16 (colorscheme)
- [x] lualine
- [x] telescope
- [x] which-key
- [x] Persistence
- [x] docker
- [x] buffer deleter
- [x] tmux.nvim
## TODO
- [ ] nvim-gdb
- [ ] noice
- [ ] python function description snippets
- [ ] c/c++ function description snippets
- [ ] all file description snippets
## Lua resources
https://github.com/nanotee/nvim-lua-guide
- [Learn X in Y minutes](https://learnxinyminutes.com/docs/lua/)
- [From init.vim to init.lua](https://teukka.tech/luanvim.html)
## Recommend Keyboard
- hhkb
## Update
### 2023-7-6
Add new todo,
### 2023-6-4
A Stable version using _lazy.nvim_ as the plugin manager.
### 2023-5-20
1. Use `:LspUninstallAll` to uninstall all server.
2. run `:PackerSync` to update plugins.
3. install server using `:Mason`. ([clangd, pyright, cmake, rome, xml, yaml])
4. In `cmp.lua`, lspkind plugin seem like doesn't work, I use my own icons.
5. update neovim
6. update bufferline