An open API service indexing awesome lists of open source software.

https://github.com/rurumimic/nvim

.config/nvim
https://github.com/rurumimic/nvim

neovim nvchad vim

Last synced: about 2 months ago
JSON representation

.config/nvim

Awesome Lists containing this project

README

          

# Neovim

## Setup

```bash
git clone https://github.com/rurumimic/nvim ~/.config/nvim
```

### Alias vi

```bash
alias vi='nvim'
```

### Run Neovim

```bash
vi
```

#### Install plugins

```vim
:MasonInstallAll
```

### Prerequisites

#### Install Packages

- neovim
- node.js
- nerd font
- ripgrep
- gcc
- make
- luarocks
- python3-venv

#### Clean old neovim folders

```bash
rm -rf ~/.config/nvim
rm -rf ~/.local/state/nvim
rm -rf ~/.local/share/nvim
```

---

## Key Mappings

- Cheatsheets: `ch`

### General

- Save file without formatting: ``
- Opens the current filepath or URL: `gx`
- goto file: `gf`

### Terminals

- New horizontal: `h`
- New vertical: `v`
- Toggle horizontal: ``
- Toggle vertical: ``
- Toggle floating: ``

### Tree

- Toggle: ``
- Focus: `e`

### Formatters

- Format file: `fm`

### LSP

- Diagnostic under the cursor: ``, `d`, `gl`, `gl`
- Diagnostic loclist: ` + ds`
- To the previous diagnostic: `[d`
- To the next diagnostic: `]d`

### Git

- Fugitive: `gf`
- Lazygit: `lg`

### Telescope

- Live grep: `fw`
- Find files: `ff`
- Find in current buffer: `fz`
- Find buffers: `fb`
- Find oldfiles: `fo`
- Find help: `fh`
- Pick a terminal: `pt`
- Git status: `gt`
- Git commits: `cm`

#### in Telescope window

- Send items to quicfixlist with Trouble: ``

### Trouble

- Toggle diagnostics: `tl`
- Toggle diagnostics (current buffer): `tL`
- Toggle symbols: `ts`
- Toggle LSP references: `tr`
- Toggle quickfix: `tq` (like `:vim /pattern/ %`)
- Toggle loclist: `tc` (like `:lv /pattern/ %`)

### ~~Copilot~~

- Next suggestion: ``
- Previous suggestion: ``
- Accept word: ``
- Accept line: ``
- Accept suggestion: ``
- Dismiss suggestion: ``

---

## Languages

src: [lua/configs/lspconfig.lua](lua/configs/lspconfig.lua), [lua/configs/conform.lua](lua/configs/conform.lua)

- c, cpp, cuda: clangd, clang-format
- rust: rust-analyzer, rustfmt

---

## Providers

- [lua/configs/providers/python.lua](lua/configs/providers/python.lua)

### Python Virtual Environment

```bash
apt install python3-venv
```

```bash
uv python install 3.12
uv venv --python 3.12
```

```bash
source ~/.config/nvim/.venv/bin/activate
uv pip install pynvim
```

:checkhealth

```bash
provider.python: require("provider.python.health").check()

Python 3 provider (optional) ~
- Using: g:python3_host_prog = "/home/user/.config/nvim/.venv/bin/python"
- Executable: /home/user/.config/nvim/.venv/bin/python
- Python version: 3.12.9
- pynvim version: 0.6.0
- OK Latest pynvim is installed.
```

---

## NvChad

- [NvChad](https://github.com/NvChad/NvChad) v2.5
- [starter](https://github.com/NvChad/starter)
- [tinyvim](https://github.com/NvChad/tinyvim)

### LSP

- nvchad: [lsp](https://nvchad.com/docs/config/lsp)

#### with default config

`~/.config/nvim/lua/configs/lspconfig.lua`:

```lua
local servers = {
"html",
"cssls",
}
```

#### with custom config

`~/.config/nvim/lua/configs/lsp/rust.lua`:

```lua
local nvlsp = require "nvchad.configs.lspconfig"

local M = {
on_attach = nvlsp.on_attach,
capabilities = nvlsp.capabilities,
settings = {
-- ...
},
}

return M
```

`~/.config/nvim/lua/configs/lspconfig.lua`:

```lua
lspconfig.rust_analyzer.setup(require "configs.lsp.rust")
```

### Formatters

`~/.config/nvim/lua/configs/conform.lua`:

```lua
local options = {
formatters_by_ft = {
rust = { "rustfmt" },
},
}

return options
```

### Install all plugins

```vim
:MasonInstallAll
```

---

## Tools

### LazyGit

- github: [lazygit](https://github.com/jesseduffield/lazygit)

```bash
go install github.com/jesseduffield/lazygit@latest
```