nvim setup for arduboy development

This commit is contained in:
Rudis Muiznieks 2022-06-14 09:07:55 -05:00
parent b1e56509f4
commit 56f4a9fb31
Signed by: rudism
GPG key ID: CABF2F86EF7884F9
3 changed files with 50 additions and 49 deletions

View file

@ -156,6 +156,7 @@ hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
hc rule class='nvim-zen' fullscreen=on
hc rule class='mpv' floating=on
hc rule class='sim_arduboy' floating=on
hc set tree_style '╾│ ├└╼─┐'

View file

@ -10,6 +10,7 @@ vim.opt.hidden = true
vim.opt.ignorecase = true
vim.opt.list = true
vim.opt.listchars = 'eol:¶,tab:→ ,trail:␣,extends:»,precedes:«'
vim.opt.fillchars = 'stl: ,stlnc:-,vert:|,fold:-,diff:-'
vim.opt.mouse = 'a'
vim.opt.number = true
vim.opt.shiftwidth = 2

View file

@ -1,4 +1,11 @@
local util = require('lspconfig').util
local lsp = require('lspconfig')
local util = lsp.util
local lspcap = require('cmp_nvim_lsp')
.update_capabilities(vim.lsp.protocol.make_client_capabilities())
local lspatt = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end
-- replace built in selector with telescope
require('telescope').setup {
@ -10,7 +17,7 @@ require('telescope').setup {
}
}
}
require("telescope").load_extension("ui-select")
require('telescope').load_extension('ui-select')
-- autocomplete config
local cmp = require 'cmp'
@ -41,52 +48,39 @@ cmp.setup {
require('gitsigns').setup()
-- lsp configs
require'lspconfig'.openscad_ls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
lsp.openscad_ls.setup {
capabilities = lspcap,
on_attach = lspatt,
}
require'lspconfig'.omnisharp.setup {
lsp.omnisharp.setup {
capabilities = lspcap,
on_attach = lspatt,
root_dir = function(file, _)
if file:sub(-#".csx") == ".csx" then
return util.path.dirname(file)
end
return util.root_pattern("*.sln")(file) or util.root_pattern("*.csproj")(file)
end,
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
cmd = { "/home/rudism/.local/share/omnisharp/OmniSharp", "--languageserver" , "--hostPID", tostring(pid) },
}
require'lspconfig'.tsserver.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
--cmd = { 'npx', 'typescript-language-server', '--stdio' },
lsp.tsserver.setup {
capabilities = lspcap,
on_attach = lspatt,
}
require'lspconfig'.yamlls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
lsp.yamlls.setup {
capabilities = lspcap,
on_attach = lspatt,
}
require'lspconfig'.ccls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
lsp.ccls.setup {
capabilities = lspcap,
on_attach = lspatt,
}
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
require'lspconfig'.sumneko_lua.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
lsp.sumneko_lua.setup {
capabilities = lspcap,
on_attach = lspatt,
cmd = { "lua-language-server", "-E" },
settings = {
Lua = {
@ -106,11 +100,9 @@ require'lspconfig'.sumneko_lua.setup {
},
}
}
require'lspconfig'.perlpls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
lsp.perlpls.setup {
capabilities = lspcap,
on_attach = lspatt,
settings = {
perl = {
perlcritic = {
@ -122,11 +114,9 @@ require'lspconfig'.perlpls.setup {
}
}
}
require'lspconfig'.efm.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
lsp.efm.setup {
capabilities = lspcap,
on_attach = lspatt,
filetypes = {"sh", "markdown"},
settings = {
languages = {
@ -144,13 +134,22 @@ require'lspconfig'.efm.setup {
}
}
}
require'lspconfig'.pyright.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()),
on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
lsp.pyright.setup {
capabilities = lspcap,
on_attach = lspatt,
}
-- setup for Arduboy dev
lsp.arduino_language_server.setup {
capabilities = lspcap,
on_attach = lspatt,
cmd = {
"arduino-language-server",
"-cli-config", "~/.arduino15/arduino-cli.yaml",
"-cli", "/bin/arduino-cli",
"-clangd", "/usr/bin/clangd",
"-fqbn", "arduino:avr:leonardo"
},
}
-- status line setup
require'lualine'.setup {