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:
parent
99ce5c68d8
commit
ea722bb23d
7
.cspell.json
Normal file
7
.cspell.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"version": "0.2",
|
||||||
|
"language": "en-GB",
|
||||||
|
"words": [ "UKAEA" ],
|
||||||
|
"allowCompoundWords": true,
|
||||||
|
"useGitignore": true
|
||||||
|
}
|
39
Makefile
39
Makefile
|
@ -1,30 +1,49 @@
|
||||||
BIN_DIR := $(HOME)/.local/bin
|
BIN_DIR := $(HOME)/.local/bin
|
||||||
FONTS_DIR := $(HOME)/.fonts
|
FONTS_DIR := $(HOME)/.fonts
|
||||||
|
|
||||||
.PHONY: default clean nvim direnv firacode
|
.PHONY: default clean nvim firacode cspell
|
||||||
|
|
||||||
default:
|
default: nvim firacode cspell
|
||||||
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
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -rf $(HOME)/.local/share/nvim
|
-rm -rf $(HOME)/.local/share/nvim
|
||||||
-rm -rf $(HOME)/.local/state/nvim
|
-rm -rf $(HOME)/.local/state/nvim
|
||||||
-rm -rf $(HOME)/.cache/nvim
|
-rm -rf $(HOME)/.cache/nvim
|
||||||
-rm $(BIN_DIR)/nvim
|
-rm $(BIN_DIR)/nvim
|
||||||
-rm $(BIN_DIR)/direnv
|
|
||||||
-rm -rf $(FONTS_DIR)/FiraCode
|
-rm -rf $(FONTS_DIR)/FiraCode
|
||||||
|
-rm $(HOME)/.cspell.json
|
||||||
|
|
||||||
nvim: $(BIN_DIR)
|
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)
|
# direnv: $(BIN_DIR)
|
||||||
bin_path="$(BIN_DIR)" ./installers/direnv.sh
|
# bin_path="$(BIN_DIR)" ./installers/direnv.sh
|
||||||
|
|
||||||
|
firacode: $(FONTS_DIR)/
|
||||||
|
|
||||||
firacode: $(FONTS_DIR)
|
firacode: $(FONTS_DIR)
|
||||||
command -v fc-cache > /dev/null || exit 1
|
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):
|
$(BIN_DIR) $(FONTS_DIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -1,6 +1,6 @@
|
||||||
return {
|
return {
|
||||||
"https://github.com/direnv/direnv.vim.git",
|
"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",
|
name = "direnv.vim",
|
||||||
event = { "DirChangedPre" },
|
event = { "DirChangedPre" },
|
||||||
config = function()
|
config = function()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
return {
|
return {
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
cond = not vim.g.vscode,
|
cond = not vim.g.vscode,
|
||||||
|
dependencies = {"nvim-treesitter"},
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = true,
|
config = true,
|
||||||
opts = {
|
opts = {
|
||||||
|
|
|
@ -44,34 +44,49 @@ local config = function()
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp_flags = { debounce_text_changes = 150 }
|
local lsp_config = {
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
on_attach = on_attach,
|
||||||
local servers = {
|
flags = { debounce_text_changes = 150 },
|
||||||
"pyright",
|
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||||
"ruff_lsp",
|
|
||||||
"nil_ls",
|
|
||||||
"lua_ls",
|
|
||||||
"fortls",
|
|
||||||
"yamlls",
|
|
||||||
"vimls",
|
|
||||||
"bashls",
|
|
||||||
}
|
}
|
||||||
for _, name in ipairs(servers) do
|
local lsp = require("lspconfig")
|
||||||
require("lspconfig")[name].setup {
|
if vim.fn.executable("pyright") == 1 then lsp["pyright"].setup(lsp_config) end
|
||||||
on_attach = on_attach,
|
if vim.fn.executable("ruff_lsp") == 1 then lsp["ruff_lsp"].setup(lsp_config) end
|
||||||
flags = lsp_flags,
|
if vim.fn.executable("lua-language-server") == 1 then lsp["lua_ls"].setup(lsp_config) end
|
||||||
capabilities = capabilities,
|
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
|
||||||
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 builtins = require "null-ls.builtins"
|
||||||
local cspell = require "cspell"
|
local cspell = require "cspell"
|
||||||
local cspell_filetypes = { "json", "yaml", "html", "markdown", "norg", "gitcommit" }
|
local cspell_config = {
|
||||||
local cspell_config = { config_file_preferred_name = ".cspell.json" }
|
filetypes = { "json", "yaml", "html", "markdown", "norg", "gitcommit" },
|
||||||
|
config={ config_file_preferred_name = ".cspell.json" }
|
||||||
|
}
|
||||||
require("null-ls").setup {
|
require("null-ls").setup {
|
||||||
sources = {
|
sources = {
|
||||||
cspell.diagnostics.with { filetypes = cspell_filetypes, config = cspell_config },
|
cspell.diagnostics.with (cspell_config),
|
||||||
cspell.code_actions.with { filetypes = cspell_filetypes, config = cspell_config },
|
cspell.code_actions.with (cspell_config),
|
||||||
|
|
||||||
builtins.code_actions.gitsigns,
|
builtins.code_actions.gitsigns,
|
||||||
builtins.formatting.alejandra,
|
builtins.formatting.alejandra,
|
||||||
|
@ -84,9 +99,9 @@ local config = function()
|
||||||
builtins.formatting.stylua,
|
builtins.formatting.stylua,
|
||||||
builtins.hover.dictionary,
|
builtins.hover.dictionary,
|
||||||
},
|
},
|
||||||
on_attach = on_attach,
|
on_attach = lsp_config.on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_config.flags,
|
||||||
capabilities = capabilities,
|
capabilities = lsp_config.capabilities,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ return {
|
||||||
ft = "norg",
|
ft = "norg",
|
||||||
cmd = "Neorg",
|
cmd = "Neorg",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" },
|
dependencies = { "plenary.nvim", "nvim-treesitter", "nvim-cmp" },
|
||||||
init = function()
|
init = function()
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
pattern = { "*.norg" },
|
pattern = { "*.norg" },
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
return {
|
return {
|
||||||
"ahmedkhalf/project.nvim",
|
"ahmedkhalf/project.nvim",
|
||||||
cond = not vim.g.vscode,
|
cond = not vim.g.neovide and not vim.g.vscode,
|
||||||
enabled = false,
|
|
||||||
name = "project_nvim",
|
name = "project_nvim",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = true,
|
config = true,
|
||||||
opts = {
|
opts = {
|
||||||
ignore_lsp = { "efm", "null-ls" },
|
ignore_lsp = { "null-ls" },
|
||||||
show_hidden = true,
|
show_hidden = true,
|
||||||
silent_chdir = true,
|
silent_chdir = true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue