Compare commits

...

5 Commits

Author SHA1 Message Date
David JULIEN 7fe2da7d37
Merge branch 'dev' into mercury
nvim:
        fix lsp hints
        fix latex snippets
        remove unused backup file

scripts:
        compiler luatex + main.tex if available
2022-05-31 22:02:30 +02:00
David JULIEN 96b6b535a5 [nvim] cleanup: remove unused backup file 2022-05-31 17:31:35 +02:00
David JULIEN 5689005285 [scripts] feat: compile luatex + main project if exists 2022-05-31 17:24:57 +02:00
David JULIEN 12182ea487 [nvim] fix: lsp hints in signbar 2022-05-31 17:21:29 +02:00
David JULIEN 6bdf71567f [nvim] fix: no newline after itemize in tex files 2022-05-19 15:08:44 +02:00
4 changed files with 15 additions and 140 deletions

View File

@ -52,7 +52,7 @@ ls.add_snippets("tex", {
i(1),
t({ "" }),
d(2, rec_ls, {}),
t({ "", "\\end{itemize}", "" }),
t({ "", "\\end{itemize}" }),
}),
s("lsl", {
t({ "\\begin{itemize}[label=" }),
@ -61,7 +61,7 @@ ls.add_snippets("tex", {
i(2),
t({ "" }),
d(3, rec_ls, {}),
t({ "", "\\end{itemize}", "" }),
t({ "", "\\end{itemize}" }),
}),
s("frm", {
t({ "\\begin{" }),
@ -76,7 +76,7 @@ ls.add_snippets("tex", {
i(0),
t({ "", "\\end{" }),
f(copy, 1),
t({ "}", "" }),
t({ "}" }),
}),
s("env", {
t({ "\\begin{" }),

View File

@ -1,130 +0,0 @@
-- Author : swytch
-- Created : Saturday Sept. 11, 2021 22:12:33 CET
-- License : GPLv3
-- Description : nvim-lsp-installer plugin config file
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.settings {
ui = {
icons = {
server_installed = "✓",
server_pending = "o",
server_uninstalled = "x"
}
}
}
local servers = {
"clangd",
"sumneko_lua",
}
for _, name in ipairs(servers) do
local ok, server = lsp_installer.get_server(name)
-- Check that the server is supported in nvim-lsp-installer
if ok then
if not server:is_installed() then
print("Installing " .. name)
server:install()
end
end
end
local lsp_root_path = vim.fn.stdpath("data") .. "/lsp_servers/"
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
local enhance_server_opts = {
["clangd"] = function(opts)
opts.settings = {
cmd = { lsp_root_path .. "clangd/clangd/bin/clangd",
"--background-index",
"--suggest-missing-includes",
"--clang-tidy",
"--header-insertion=iwyu"
},
}
end,
["sumneko_lua"] = function(opts)
opts.settings = {
cmd = { lsp_root_path
.. "sumneko_lua/extension/server/bin/"
.. "lua-language-server",
"-E",
lsp_root_path
.. "sumneko_lua/extension/server/main.lua"
},
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {
"vim",
"use",
"globals",
"utils"
},
},
workspace = {
-- Make the server aware of Neovim runtime files
library =
vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
}
end,
}
local on_attach = function(_, bufnr)
local opts = { buffer = bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<leader>wa',
vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<leader>wr',
vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<leader>wl', function()
vim.inspect(vim.lsp.buf.list_workspace_folders())
end, opts)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<leader>so',
require('telescope.builtin').lsp_document_symbols, opts)
vim.api.nvim_create_user_command("Format", vim.lsp.buf.formatting, {})
end
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
lsp_installer.on_server_ready(function(server)
-- Specify the default options which we'll use to setup all servers
local opts = {
on_attach = on_attach,
capabilities = capabilities,
}
if enhance_server_opts[server.name] then
-- Enhance the default opts with the server-specific ones
enhance_server_opts[server.name](opts)
end
server:setup(opts)
end)

View File

@ -15,7 +15,7 @@ local signs = {
Info = globals.sign_info,
}
for type, icon in ipairs(signs) do
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, {
text = icon,
@ -57,7 +57,6 @@ end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
-- Setup nvim-lsp-installer
local servers = { "clangd", "sumneko_lua", "texlab" }
lsp_installer.setup {
ensure_installed = servers,

View File

@ -31,15 +31,21 @@ shebangtest()
}
texcompile() { \
[ -e "main.tex" ] && base="main" && file="$base.tex"
cmd="pdflatex"
case "$(head -n 1 $file)" in
*lua*) cmd="lualatex" ;;
esac
bibliography="$(grep '\\bibliography' "$file")"
if [ -n "$bibliography" ]; then
pdflatex --output-directory="$dir" "$base" &&
$cmd --output-directory="$dir" "$base" &&
bibtex "$base" &&
pdflatex --output-directory="$dir" "$base" &&
pdflatex --output-directory="$dir" "$base"
$cmd --output-directory="$dir" "$base" &&
$cmd --output-directory="$dir" "$base"
else
pdflatex --output-directory="$dir" "$base" &&
pdflatex --output-directory="$dir" "$base"
$cmd --output-directory="$dir" "$base" &&
$cmd --output-directory="$dir" "$base"
fi
}