Merge branch 'dev' into venus

system: fix external mode for displayselect
nvim: fix lsp installation dir variable
        format lsp server list
        add rust_analyzer LSP
        add rust config file
This commit is contained in:
David JULIEN 2022-12-02 22:32:55 +01:00
commit 52bc4efae0
Signed by: swytch
GPG Key ID: 498590A3AA82A06F
5 changed files with 42 additions and 8 deletions

View File

@ -0,0 +1,13 @@
-- Author : swytch
-- Created : Thursday Dec. 01, 2022 11:41:26 CET
-- License : GPLv3
-- Description : rust settings file
local format_sync_grp = vim.api.nvim_create_augroup("Format", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.rs",
callback = function()
vim.lsp.buf.format({ timeout_ms = 200 })
end,
group = format_sync_grp,
})

View File

@ -6,8 +6,7 @@
local M = {} local M = {}
local lsp_root_path = vim.fn.stdpath("data") .. "/lsp_servers/" local clangd_binary = _G.lsp_root_dir .. "clangd/clangd/bin/clangd"
local clangd_binary = lsp_root_path .. "clangd/clangd/bin/clangd"
M.setup = function(opts) M.setup = function(opts)
opts.settings = { opts.settings = {

View File

@ -58,7 +58,12 @@ end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
local servers = { "clangd", "sumneko_lua", "texlab" } local servers = {
"clangd",
"rust_analyzer",
"sumneko_lua",
"texlab",
}
mason.setup({ mason.setup({
ui = { ui = {
@ -70,6 +75,8 @@ mason.setup({
} }
}) })
_G.lsp_root_dir = vim.fn.stdpath("data") .. "/mason/bin"
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = servers, ensure_installed = servers,
}) })
@ -81,7 +88,7 @@ for _, server in ipairs(servers) do
capabilities = capabilities, capabilities = capabilities,
} }
local plugin = string.format("%s.%s", "plugin.lsp", server) local plugin = string.format("plugin.lsp.%s", server)
require(plugin).setup(opts) require(plugin).setup(opts)
lspconfig[server].setup(opts) lspconfig[server].setup(opts)

View File

@ -0,0 +1,16 @@
-- Author : swytch
-- Created : Wednesday Nov. 30, 2022 16:35:43 CET
-- License : GPLv3
-- Description : neovim lsp config file for rust_analyzer
local M = {}
local rust_analayzer_binary = _G.lsp_root_dir .. "rust_analyzer/rust_analyzer"
M.setup = function(opts)
opts.settings = {}
end
return M

View File

@ -44,10 +44,11 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
} }
default() { default() {
primary=$(echo "$allposs" | grep -w "connected primary" | awk '{ print $1 }') [ -z "$primary" ] && primary=$(echo "$allposs" | grep -w "connected primary" | awk '{ print $1 }')
secondary=$(echo "$screens" | grep -v -w "$primary") secondary=$(echo "$screens" | grep -v -w "$primary")
direction="left" direction="left"
rotation="normal" rotation="normal"
setup setup
} }
@ -55,9 +56,7 @@ external() {
internal=$(echo "$screens" | dmenu -i -p "Select internal display:") internal=$(echo "$screens" | dmenu -i -p "Select internal display:")
screens=$(echo "$screens" | grep -v -w "eDP-1") screens=$(echo "$screens" | grep -v -w "eDP-1")
primary=$(echo "$screens" | dmenu -i -p "Select primary display:") primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
xrandr --output $primary --primary xrandr --output $primary --primary && default
default
} }
setup() { setup() {