Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/piyoki/dot-nvim
https://github.com/piyoki/dot-nvim
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/piyoki/dot-nvim
- Owner: piyoki
- Created: 2023-12-06T14:09:43.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-23T01:47:29.000Z (3 months ago)
- Last Synced: 2024-10-14T07:36:05.463Z (3 months ago)
- Language: Lua
- Size: 65.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Neovim Setup
* [Neovim 0.5.0+ New Features](#neovim-050-new-features)
* [Reference](#reference)
* [Installation](#installation)
* [Install Dependency Packages](#install-dependency-packages)
* [Getting Started with Lua-Based Neovim config](#getting-started-with-lua-based-neovim-config)
* [Benefits](#benefits)
* [Lua Keybings](#lua-keybings)
* [Package Management](#package-management)
* [Plugins](#plugins)
* [Core](#core)
* [Lua Native](#lua-native)
* [Editing Addons](#editing-addons)
* [Prerequisite:](#prerequisite)
* [LSP Addons](#lsp-addons)
* [Formatter Addons](#formatter-addons)
* [Extra Addons](#extra-addons)## Neovim 0.5.0+ New Features
- all the IDE-like goodies:
- LSP completion, go to def, hover and rename
- treesitter syntax highlighting
- ctrlp-like fuzzy finding
- embedded terminals## Reference
- [Neovim — init.lua](https://ichi.pro/neovim-init-lua-255152448823344)
- [Collections of awesome Neovim plugins](https://github.com/rockerBOO/awesome-neovim)
- [Getting started using Lua in Neovim](https://github.com/nanotee/nvim-lua-guide)## Installation
### Install Dependency Packages
```bash
# MacOS
brew install --HEAD tree-sitter luajit neovim fzf fd# Archlinux
sudo pacman -S tree-sitter luajit neovim fzf fd
```Install nvim-lspconfig
reference: https://github.com/neovim/nvim-lspconfig
Install nvim-lsp-installer
reference: https://github.com/williamboman/nvim-lsp-installer
## Getting Started with Lua-Based Neovim config
### Benefits
- Lua is a much nicer language
- More modular
- Easier to customize
- Easier to configure lua plugins### Lua Keybings
Set using `vim.api.nvim_set_keymap({mode}, {keymap}, {mapped to}, {options})`
Example
```vim
" Ctrl-s to Save
nmap :w
imap :wa" Ctrl+hjkl to navigate splits
nnoremap h
nnoremap j
nnoremap k
nnoremap l
```Now converted to
```lua
local keymap = vim.api.nvim_set_keymap
keymap('n', '', ':w', {})
keymap('i', '', '::wa', {})local opts = {noremap = true}
keymap('n', '', 'h', opts)
keymap('n', '', 'j', opts)
keymap('n', '', 'k', opts)
keymap('n', '', 'l', opts)
```### Package Management
Use `Packer` as the default plugin manager
In `Archlinux`, we can install from AUR: `yay -S nvim-packer-git`
Start with having packer manage itself:
```lua
require('packer').startup(function()
use 'wbthomason/packer.nvim'
-- add other use ... for other packages
end)
```Then we can run `:PackerSync` which will download/install the list of defined plugins
## Plugins
#### Core
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) - a collection of configurations for Neovim's built-in LSP
- [treesitter](https://github.com/nvim-treesitter/nvim-treesitter) - syntax highlight for Neovim's built-in LSP
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) - extendable fuzzy finder over lists#### Lua Native
- [lualine](https://github.com/nvim-lualine/lualine.nvim) - a blazing fast and easy to configure Neovim statusline written in Lua
#### Editing Addons
- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) - completion engine
- [vim-surround](https://github.com/tpope/vim-surround) - mappings to easily delete, change and add surroundings in pairs
- [formatter.nvim](https://github.com/mhartington/formatter.nvim) - A format runner for neovim, written in lua#### Prerequisite:
- nodejs
- npm
- yarn```bash
# Install yarn
sudo npm i -g yarn
```#### LSP Addons
```bash
# gopls
go install golang.org/x/tools/gopls@latest
# golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@lastet
```#### Formatter Addons
```bash
# go formatter (comes with the go binary)
sudo pacman -S go
# lua formatter
sudo pacman -S stylua
# shell script formatter
sudo pacman -S shfmt
# ctags
sudo pacman -S ctags
# typescript, javascript, markdown, JSON formatter
sudo npm install -g prettier
# yamlfmt
pip3 install yamlfmt
# python formatter
sudo pacman -S python-black
# ruby formatter (required PATH setup)
gem install rubocop
# terragrunt(terraform) formatter (comes with terragrunt/terraform)
sudo pacman -S terraform terragrunt
```#### Extra Addons
- [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim) - markdown preview plugin for (neo)vim