nvim: Fix ltex disabled autostart
Fixes #1ef7570.
We implement our own autostart-aware lsp register function. Any lsp
which has the option {autostart=false} set at their config root will be
not automatically enabled and can instead be enabled on demand.
This commit is contained in:
parent
6e6f804c08
commit
63c6c81f6e
3 changed files with 36 additions and 23 deletions
|
|
@ -38,7 +38,7 @@ After all files are linked and you open a new shell session, the `dotlink` alias
|
|||
[^1]:
|
||||
This alias only works when the dotfiles are cloned into `~/.dotfiles`, mirroring my setup.
|
||||
This is due to a hard-coded cd into this directory.
|
||||
If your dotfiles lie in another directory and you want to use the dotlink alias, simply change the corresponding line in `bootstrap/.config/sh/alias.d/dotlink.sh`
|
||||
If your dotfiles lie in another directory, and you want to use the dotlink alias, simply change the corresponding line in `bootstrap/.config/sh/alias.d/dotlink.sh`
|
||||
|
||||
Both automatic installation paths are presumably somewhat brittle. In any case, I would suggest to manually look through the files for things you want instead of copying and activating everything.
|
||||
Dotfiles are too personal to be standardized like that.
|
||||
|
|
|
|||
|
|
@ -56,9 +56,14 @@ local lsp = {
|
|||
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
|
||||
local function register(server_name, config)
|
||||
local function register(server_name, config, enabled)
|
||||
if vim.fn.has("nvim-0.11") == 1 then
|
||||
vim.lsp.config(server_name, config)
|
||||
if enabled == false or vim.lsp.config[server_name]["autostart"] == false then
|
||||
vim.lsp.enable(server_name, false)
|
||||
else
|
||||
vim.lsp.enable(server_name, true)
|
||||
end
|
||||
else
|
||||
require("lspconfig")[server_name].setup(config)
|
||||
end
|
||||
|
|
@ -186,19 +191,28 @@ local lsp = {
|
|||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "SpellEnable",
|
||||
callback = function()
|
||||
register("ltex", {
|
||||
on_attach = function(_, _)
|
||||
if require("core.util").is_available("ltex_extra") then
|
||||
require("ltex_extra").setup()
|
||||
end
|
||||
end,
|
||||
settings = {
|
||||
ltex = {
|
||||
language = vim.o.spelllang,
|
||||
},
|
||||
},
|
||||
local mapped = {}
|
||||
local lang_map = {
|
||||
en_us = "en-US",
|
||||
en_gb = "en-GB",
|
||||
de_de = "de-DE",
|
||||
}
|
||||
for _, v in ipairs(vim.opt.spelllang:get()) do
|
||||
table.insert(mapped, lang_map[v])
|
||||
end
|
||||
vim.lsp.config("ltex", {
|
||||
settings = { ltex = { language = mapped } },
|
||||
})
|
||||
vim.cmd("LspStart ltex")
|
||||
-- single-shot setup: Enable for this buffer
|
||||
-- but instantly disable again globally
|
||||
vim.lsp.enable("ltex")
|
||||
vim.lsp.enable("ltex", false)
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "SpellDisable",
|
||||
callback = function()
|
||||
vim.lsp.enable("ltex", false)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
|
|
|
|||
17
sh/README.md
17
sh/README.md
|
|
@ -3,18 +3,17 @@
|
|||
The bare minimum terminal configuration for a working system.
|
||||
Contains:
|
||||
|
||||
* an XDG compliant home directory setup
|
||||
* several basic environment variables
|
||||
* simple aliases
|
||||
* an optional fzf default setup
|
||||
* X autostart
|
||||
- an XDG compliant home directory setup
|
||||
- several basic environment variables
|
||||
- simple aliases
|
||||
- an optional fzf default setup
|
||||
- X autostart
|
||||
|
||||
While other modules are largely optional,
|
||||
While other modules are largely optional,
|
||||
this module is the only one strictly necessary for the system to really work at all.
|
||||
|
||||
Additionally contains two scripts on which some other modules build:
|
||||
|
||||
* a simple script to detect if applications exist
|
||||
- a simple script to detect if applications exist
|
||||
(and optionally warn the user if they don't)
|
||||
* and a script to check if internet connectivity exists
|
||||
|
||||
- and a script to check if internet connectivity exists
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue