lspconfig update and cspell config file

Start checking for executable before registering lsp server
Add missing dependencies for direnv, indent_blankline and nvim_neorg
Add standard .cspell.json, make now links it to home directory
This commit is contained in:
Evie Litherland-Smith 2023-06-12 18:59:08 +01:00
parent 99ce5c68d8
commit ea722bb23d
9 changed files with 81 additions and 55 deletions

7
.cspell.json Normal file
View file

@ -0,0 +1,7 @@
{
"version": "0.2",
"language": "en-GB",
"words": [ "UKAEA" ],
"allowCompoundWords": true,
"useGitignore": true
}

View file

@ -1,30 +1,49 @@
BIN_DIR := $(HOME)/.local/bin
FONTS_DIR := $(HOME)/.fonts
.PHONY: default clean nvim direnv firacode
.PHONY: default clean nvim firacode cspell
default:
command -v nvim > /dev/null || make nvim
command -v direnv > /dev/null || make direnv
-fc-list | grep -iE "(fira.*code)*(nerd.*font)" > /dev/null || make firacode
default: nvim firacode cspell
clean:
-rm -rf $(HOME)/.local/share/nvim
-rm -rf $(HOME)/.local/state/nvim
-rm -rf $(HOME)/.cache/nvim
-rm $(BIN_DIR)/nvim
-rm $(BIN_DIR)/direnv
-rm -rf $(FONTS_DIR)/FiraCode
-rm $(HOME)/.cspell.json
nvim: $(BIN_DIR)
./installers/nvim.sh
command -v nvim > /dev/null && exit 0
curl -sSLO https://github.com/neovim/neovim/releases/download/stable/nvim.appimage
curl -sSLO https://github.com/neovim/neovim/releases/download/stable/nvim.appimage.sha256sum
sha256sum -c nvim.appimage.sha256sum || {
rm nvim.appimage nvim.appimage.sha256sum
exit 1
}
rm nvim.appimage.sha256sum
chmod a+x nvim.appimage
mv nvim.appimage $(HOME)/.local/bin/nvim
direnv: $(BIN_DIR)
bin_path="$(BIN_DIR)" ./installers/direnv.sh
# direnv: $(BIN_DIR)
# bin_path="$(BIN_DIR)" ./installers/direnv.sh
firacode: $(FONTS_DIR)/
firacode: $(FONTS_DIR)
command -v fc-cache > /dev/null || exit 1
./installers/firacode.sh && fc-cache
command -v fc-list > /dev/null || exit 1
fc-list | grep -iE "(fira.*code)*(nerd.*font)" > /dev/null && exit 0
mkdir -p $(FONTS_DIR) && cd $(FONTS_DIR)
curl -sSLO https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.0/FiraCode.zip
unzip FiraCode.zip -d FiraCode
rm FiraCode.zip
fc-cache
cspell: $(HOME)/.cspell.json
$(HOME)/.cspell.json:
-ln -s $$(readlink -f .cspell.json) $@
$(BIN_DIR) $(FONTS_DIR):
mkdir -p $@

View file

@ -1,6 +0,0 @@
mkdir -p $HOME/.fonts
cd $HOME/.fonts
curl -sSLO https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.0/FiraCode.zip
unzip FiraCode.zip -d FiraCode
rm FiraCode.zip
fc-cache

View file

@ -1,9 +0,0 @@
curl -sSLO https://github.com/neovim/neovim/releases/download/stable/nvim.appimage
curl -sSLO https://github.com/neovim/neovim/releases/download/stable/nvim.appimage.sha256sum
sha256sum -c nvim.appimage.sha256sum || {
rm nvim.appimage nvim.appimage.sha256sum
exit 1
}
rm nvim.appimage.sha256sum
chmod a+x nvim.appimage
mv nvim.appimage $HOME/.local/bin/nvim

View file

@ -1,6 +1,6 @@
return {
"https://github.com/direnv/direnv.vim.git",
cond = not vim.g.vscode,
cond = function() return vim.fn.executable("direnv") == 1 and not vim.g.vscode end,
name = "direnv.vim",
event = { "DirChangedPre" },
config = function()

View file

@ -1,6 +1,7 @@
return {
"lukas-reineke/indent-blankline.nvim",
cond = not vim.g.vscode,
dependencies = {"nvim-treesitter"},
event = { "BufReadPre", "BufNewFile" },
config = true,
opts = {

View file

@ -44,34 +44,49 @@ local config = function()
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local lsp_flags = { debounce_text_changes = 150 }
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local servers = {
"pyright",
"ruff_lsp",
"nil_ls",
"lua_ls",
"fortls",
"yamlls",
"vimls",
"bashls",
}
for _, name in ipairs(servers) do
require("lspconfig")[name].setup {
local lsp_config = {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
flags = { debounce_text_changes = 150 },
capabilities = require("cmp_nvim_lsp").default_capabilities(),
}
end
local lsp = require("lspconfig")
if vim.fn.executable("pyright") == 1 then lsp["pyright"].setup(lsp_config) end
if vim.fn.executable("ruff_lsp") == 1 then lsp["ruff_lsp"].setup(lsp_config) end
if vim.fn.executable("lua-language-server") == 1 then lsp["lua_ls"].setup(lsp_config) end
if vim.fn.executable("fortls") == 1 then lsp["fortls"].setup(lsp_config) end
if vim.fn.executable("yamlls") == 1 then lsp["yamlls"].setup(lsp_config) end
if vim.fn.executable("vimls") == 1 then lsp["vimls"].setup(lsp_config) end
if vim.fn.executable("bashls") == 1 then lsp["bashls"].setup(lsp_config) end
-- local servers = {
-- {"pyright"},
-- {"ruff_lsp"},
-- {"nil_ls"},
-- {"lua_langauge_server", "lua_ls"},
-- {"fortls"},
-- {"yamlls"},
-- {"vimls"},
-- {"bashls"},
-- }
-- for _, name in ipairs(servers) do
-- if vim.fn.executable(name[0]) == 1 then
-- require("lspconfig")[name[1]].setup {
-- on_attach = on_attach,
-- flags = lsp_flags,
-- capabilities = capabilities,
-- }
-- end
-- end
local builtins = require "null-ls.builtins"
local cspell = require "cspell"
local cspell_filetypes = { "json", "yaml", "html", "markdown", "norg", "gitcommit" }
local cspell_config = { config_file_preferred_name = ".cspell.json" }
local cspell_config = {
filetypes = { "json", "yaml", "html", "markdown", "norg", "gitcommit" },
config={ config_file_preferred_name = ".cspell.json" }
}
require("null-ls").setup {
sources = {
cspell.diagnostics.with { filetypes = cspell_filetypes, config = cspell_config },
cspell.code_actions.with { filetypes = cspell_filetypes, config = cspell_config },
cspell.diagnostics.with (cspell_config),
cspell.code_actions.with (cspell_config),
builtins.code_actions.gitsigns,
builtins.formatting.alejandra,
@ -84,9 +99,9 @@ local config = function()
builtins.formatting.stylua,
builtins.hover.dictionary,
},
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
on_attach = lsp_config.on_attach,
flags = lsp_config.flags,
capabilities = lsp_config.capabilities,
}
end

View file

@ -5,7 +5,7 @@ return {
ft = "norg",
cmd = "Neorg",
lazy = true,
dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" },
dependencies = { "plenary.nvim", "nvim-treesitter", "nvim-cmp" },
init = function()
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*.norg" },

View file

@ -1,12 +1,11 @@
return {
"ahmedkhalf/project.nvim",
cond = not vim.g.vscode,
enabled = false,
cond = not vim.g.neovide and not vim.g.vscode,
name = "project_nvim",
event = { "BufReadPre", "BufNewFile" },
config = true,
opts = {
ignore_lsp = { "efm", "null-ls" },
ignore_lsp = { "null-ls" },
show_hidden = true,
silent_chdir = true,
},