Adds sections to Readme (#321)

* Added sections: What's included?, Getting Started, Useful Commands for troubleshooting.  Added table of contents

* Updates readme.  Adds sections: Installing plugins, Using Packer, Lsp errors
This commit is contained in:
rebuilt 2021-04-29 19:28:10 +02:00 committed by GitHub
parent a5a706a3cc
commit 220362ef8f
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

138
README.md
View file

@ -17,17 +17,25 @@
![LunarVim Demo](./utils/media/demo.png)
# Table of contents
- [Project Goals](#project-goals)
- [What's included?](#whats-included)
- [Why do I want tree-sitter and LSP?](#why-do-i-want-tree-sitter-and-lsp)
- [Project Goals](#project-goals)
- [Install In One Command!](#install-in-one-command)
- [Get the latest version of Neovim](#get-the-latest-version-of-neovim)
- [Getting started](#getting-started)
- [Home screen](#home-screen)
- [Leader and Whichkey](#leader-and-whichkey)
- [Important Configuration files](#important-configuration-files)
- [Install your own plugins](#install-your-own-plugins)
- [An example installation of the colorizer plugin](#an-example-installation-of-the-colorizer-plugin)
- [Using Packer](#using-packer)
- [Packer commands](#packer-commands)
- [Packer reports missing plugins](#packer-reports-missing-plugins)
- [Clipboard Support](#clipboard-support)
- [LSP](#lsp)
- [Lsp errors](#lsp-errors)
- [Understanding LspInfo](#understanding-lspinfo)
- [Last resort](#last-resort)
- [Useful Programs](#useful-programs)
- [EFM server](#efm-server)
- [Formatters and Linters](#formatters-and-linters)
@ -36,12 +44,6 @@
- [Useful commands for troubleshooting](#useful-commands-for-troubleshooting)
- [TODO](#todo)
# Project Goals
* This project aims to help one transition away from VSCode, and into a superior text editing experience. (Just making this clear)
* This is also a community project, if you would like to see support for a feature or [language](https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md) consider making a PR.
* This project will do it's best to include core features you would expect from a modern IDE, while making it easy to add or remove what the user wants.
# What's included?
@ -53,6 +55,13 @@ LunarVim provides neovim configuration files that take advantage of tree-sitter
* Neovim 0.5 including language server protocol means your editor can provide: code actions, completions, formatting, navigating to definitions, renaming, etc. The language server only has to be written once and will work on any editor that supports LSP. Any improvements made to the language server will immediately be used by all editors that support LSP.
# Project Goals
* This project aims to help one transition away from VSCode, and into a superior text editing experience. (Just making this clear)
* This is also a community project, if you would like to see support for a feature or [language](https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md) consider making a PR.
* This project will do it's best to include core features you would expect from a modern IDE, while making it easy to add or remove what the user wants.
# Install In One Command!
Make sure you have the newest version of Neovim.
@ -117,6 +126,72 @@ Or you can translate your old bindings to lua and keep them in the provided keym
|~/.config/nvim/lua/keymappings.lua | Key bindings |
|~/.config/nvim/lua/plugins.lua | Add or remove plugins here |
# Install your own plugins
The steps for configuring your own plugin are:
1. Add the plugin to plugins.lua
2. If the plugin requires configuration. Create a configuration file for it
3. If you created a configuration, require the file in init.lua
4. Use Packer to download and install the plugin
## An example installation of the colorizer plugin
* ~/.config/nvim/lua/plugins.lua
```lua
use {"norcalli/nvim-colorizer.lua", opt = true}
require_plugin("nvim-colorizer.lua")
```
* ~/.config/nvim/lua/lv-colorizer/init.lua
```lua
require'colorizer'.setup()
```
* ~/.config/nvim/init.lua
```lua
require('lv-colorizer')
```
```lua
:PackerCompile
:PackerInstall
```
# Using Packer
Packer manages your installed plugins. Any time you make changes to your list of plugins in ~/.config/nvim/lua/plugins.lua you must first run the command :PackerCompile then :PackerInstall.
## Packer commands
```bash
-- You must run this or `PackerSync` whenever you make changes to your plugin configuration
:PackerCompile
-- Only install missing plugins
:PackerInstall
-- Update and install plugins
:PackerUpdate
-- Remove any disabled or unused plugins
:PackerClean
-- Performs `PackerClean` and then `PackerUpdate`
:PackerSync
-- View the status of your plugins
:PackerStatus
```
## Packer reports missing plugins
If you get an error message about missing plugins and the above commands do not work, remove the plugin directory and reinstall from scratch.
```bash
sudo rm -R ~/.local/share/nvim
:PackerCompile
:PackerInstall
```
# Clipboard Support
- On Mac `pbcopy` should be built-in
@ -148,12 +223,59 @@ Or you can translate your old bindings to lua and keep them in the provided keym
To install a supported language server:
``` bash
```md
:LspInstall <your_language_server>
```
Most common languages should be supported out of the box, if yours is not I would welcome a PR
## Lsp errors
LunarVim lists the attached lsp server in the bottom status bar. If it says 'No client connected' use :LspInfo to troubleshoot.
### Understanding LspInfo
1. Make sure there is a client attached to the buffer. 0 attached clients means lsp is not running
2. Active clients are clients in other files you have open
3. Clients that match the filetype will be listed. If installed with :LspInstall <servername> the language servers will be installed.
4. 'cmd' must be populated. This is the language server executable. If the 'cmd' isn't set or if it's not executable you won't be able to run the language server.
* In the example below 'efm-langserver' is the name of the binary that acts as the langserver. If we run 'which efm-langserver' and we get a location to the executable, it means the langauge server is installed and available globally.
* If you know the command is installed AND you don't want to install it globally you'll need to manually set the cmd in the language server settings. Configurations are stored in ~/.config/nvim/lua/lsp/ The settings will be stored in a file that matches the name of the language. e.g. python-ls.lua
* 'identified root' must also be populated. Most language servers require you be inside a git repository for the root to be detected. If you don't want to initialize the directory as a git repository, an empty .git/ folder will also work.
5. Some language servers get set up on a per project basis so you may have to reinstall the language server when you move to a different project.
```md
Configured servers: dartls, graphql, clangd, sumneko_lua, intelephense, kotlin_language_server, bashls, tsserver, tailwindls, solargraph, gopls,
~ Neovim logs at: /Users/my-user/.cache/nvim/lsp.log
~
~ 0 client(s) attached to this buffer:
~
~ 0 active client(s):
~
~ Clients that match the filetype python:
~
~ Config: efm
~ cmd: /Users/my-user/.local/share/nvim/lspinstall/efm/efm-langserver
~ cmd is executable: True
~ identified root: None
~ custom handlers:
~
~ Config: pyright
~ cmd: /Users/my-user/.local/share/nvim/lspinstall/python/node_modules/.bin/pyright-langserver --stdio
~ cmd is executable: True
~ identified root: None
~ custom handlers: textDocument/publishDiagnostics
```
### Last resort
If you still have problems after implementing the above measures, rule out plugin problems with the following. This reinstalls your plugins and language servers.
```md
sudo rm -R ~/.local/share/nvim
:PackerCompile
:PackerInstall
:LspInstall python <-- REPLACE WITH YOUR OWN LANGUAGE
:LspInstall efm <-- REPLACE WITH YOUR OWN LANGUAGE
```
For a more in depth LSP support:
[link](https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md)