Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(docs): new layout #355

Merged
merged 12 commits into from
Jan 16, 2023
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ statusline
swapfile
titlestring
vmap
vimscript
filetype
filetypes
winbar
Expand Down
3 changes: 3 additions & 0 deletions docs/beginners-guide/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"position": 2
}
3 changes: 3 additions & 0 deletions docs/beginners-guide/beginners-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Beginner's guide

This page is not written yet, [you can help us write it](https://github.com/LunarVim/lunarvim.org/issues/352)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 3
---

# Keybind overview
# Keybinds overview

Here's an overview of the most commonly used mappings.
It is not a complete list, you can find more by pressing `<leader>sk` to search through them,
Expand Down
7 changes: 7 additions & 0 deletions docs/beginners-guide/plugins-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_position: 2
---

# Plugins overview

This page is not written yet, [you can help us write it](https://github.com/LunarVim/lunarvim.org/issues/352)
7 changes: 7 additions & 0 deletions docs/beginners-guide/terminology.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_position: 1
---

# Terminology

This page is not written yet, [you can help us write it](https://github.com/LunarVim/lunarvim.org/issues/352)
2 changes: 1 addition & 1 deletion docs/community/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"label": "Community",
"position": 10
"position": 7
}
2 changes: 1 addition & 1 deletion docs/configuration/_category_.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"position": 4
"position": 3
}
4 changes: 4 additions & 0 deletions docs/configuration/appearance/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"position": 4,
"label": "Appearance"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 3
sidebar_position: 1
---

# Colorscheme
Expand All @@ -22,7 +22,7 @@ lvim.colorscheme = 'desert'

## Installing colorschemes

You can add any colorscheme you like. Just add a plugin with the colorscheme of your choice. For more information on installing plugins [look here. ](../plugins/README.md)
You can add any colorscheme you like. Just add a plugin with the colorscheme of your choice. For more information on installing plugins [look here. ](../plugins/plugins.md)

[This is a list](https://github.com/rockerBOO/awesome-neovim#colorscheme) of colorschemes with tree-sitter support

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 6
sidebar_position: 2
---

# Statusline
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/autocommands.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 6
---

# Autocommands
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/keybindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 2

# Keybindings

See the [keybind overview](../keybind-overview.md) for most commonly used keybinds.
See the [keybinds overview](../beginners-guide/keybinds-overview.md) for most commonly used keybinds.

If you want to (re)map a keybinding that starts with `<leader>`, use [Whichkey Bindings](#whichkey-bindings).
If the bindings are LSP (intellisense) related, use [LSP Bindings](#lsp-bindings).
Expand Down
3 changes: 3 additions & 0 deletions docs/configuration/language-features/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"position": 5
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 8
sidebar_position: 3
---

# Custom snippets
Expand Down Expand Up @@ -62,7 +62,7 @@ Then, inside that folder, create a lua file named with the filetype you want to

```lua
return {
s("foo", { t "Expands to bar" }),
s("foo", { t("Expands to bar") }),
}
```

Expand Down
33 changes: 33 additions & 0 deletions docs/configuration/language-features/language-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Language features

LunarVim strives to have support for all major languages. This is made possible by utilizing some of the great plugins
in Neovim's ecosystem. Such plugins are [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) for LSP support, and
[Null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim) to provide support for handling external formatters, such
as [prettier](https://github.com/prettier/prettier) and [eslint](https://github.com/eslint/eslint). Furthermore,
LunarVim integrates with [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) to provide rich syntax
highlighting and other language parsing magic.

If your language is not supported please check the following links and file a ticket.

- Check if LSP support is available in the lspconfig [repo](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md)
- Check if your linter or formatter is available in the null-ls [repo](https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md)
- Check if your syntax is supported in the treesitter [repo](https://github.com/nvim-treesitter/nvim-treesitter)

## At a glance

You can use the following commands to check some information about any language servers that you have configured.

- `:LvimInfo`

- Contains information about all the servers attached to the buffer you are editing and their current capabilities, such as formatting and go-to definition support. It also includes information related to any linters and formatters that are, or can be, configured.
- keybind: `<leader>Li`

- `:LspInfo`

- Contains basic information about all the servers that are running.
- keybind: `<leader>li`

- `:Mason`

- Contains information about all the servers that you can manage with [mason](https://github.com/williamboman/mason.nvim).
- keybind: `<leader>lI`
118 changes: 118 additions & 0 deletions docs/configuration/language-features/language-servers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
sidebar_position: 1
---

# Language servers

_This page needs improvement_

## Installing and updating a server

### Automatic server installation

By default, most supported language servers will get automatically installed once you open the supported file-type, e.g, opening a Python file for the first time will install `Pyright` and configure it automatically for you.

- configuration option

```lua
lvim.lsp.automatic_servers_installation = true
```

Please refer to [mason](https://github.com/williamboman/mason.nvim) to see the updated full list of currently available servers.

To install a supported language server:

```md
:LspInstall `<your_language_server>`
```

You can also toggle `<:Mason>` and interactively choose which servers to install.

## Server override

`lvim.lsp.automatic_configuration.skipped_servers` contains a list of servers that will **not** be automatically configured by default, for example only `tsserver` is allowed for JS-family languages, and when a language has more than one server available, then the most popular one is usually chosen.

:::tip

Overriding a server will completely bypass the lsp-installer, so you would have to manage the installation for any of those servers manually.

:::

See the current list

```lua
:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))
```

See the default list in [`lua/lvim/lsp/config.lua`](https://github.com/LunarVim/LunarVim/blob/master/lua/lvim/lsp/config.lua#L1-L40)

:::tip

Any changes to `lvim.lsp.automatic_configuration.skipped_servers` **must** be followed by `:LvimCacheReset` to take effect.

:::

## Server setup

LunarVim uses [filetype plugins](/configuration/ftplugin.md) to enable lazy-loading the setup of a language server. A template generator is used to create `ftplugin` files and populate them with the setup call.

- configuration option

```lua
lvim.lsp.templates_dir = join_paths(get_runtime_dir(), "after", "ftplugin")
```

A typical setup call with default arguments

```lua
-- edit this file by running `:lua vim.cmd("edit " .. lvim.lsp.templates_dir .. "/lua.lua")`
require("lvim.lsp.manager").setup("sumneko_lua")
```

:::tip

You can quickly find these files by running `<leader>Lf` -> "Find LunarVim Files"

:::

### Overriding the default setup options

Add the server you wish to configure manually to `lvim.lsp.automatic_configuration.skipped_servers`.

```lua
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
```

Now you can set it up manually using the builtin [lsp-manager](https://github.com/LunarVim/LunarVim/blob/rolling/lua/lvim/lsp/manager.lua)

```lua
--- list of options that should take precedence over any of LunarVim's defaults
--- check the lspconfig documentation for a list of all possible options
local opts = {}
require("lvim.lsp.manager").setup("pyright", opts)
```

Alternatively, set it up using the `lspconfig` API directly

```lua
--- check the lspconfig documentation for a list of all possible options
local opts = {}
require("lspconfig")["pyright"].setup(opts)
```

## Server settings

To set a setting for your language server:

```vim
:LspSettings <TAB>
:LspSettings <NAME_OF_LANGUAGE_SERVER>
```

This will create a file in `$LUNARVIM_CONFIG_DIR/lsp-settings`, to enable persistent changes. Refer to the documentation of [nlsp-settings](https://github.com/tamago324/nlsp-settings.nvim/blob/main/schemas/README.md) for a full updated list of supported language servers.

:::tip

Make sure to install `jsonls` for autocompletion.

:::
Loading