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 windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
hc rule class='nvim-zen' fullscreen=on hc rule class='nvim-zen' fullscreen=on
hc rule class='mpv' floating=on hc rule class='mpv' floating=on
hc rule class='sim_arduboy' floating=on
hc set tree_style '╾│ ├└╼─┐' hc set tree_style '╾│ ├└╼─┐'

View file

@ -10,6 +10,7 @@ vim.opt.hidden = true
vim.opt.ignorecase = true vim.opt.ignorecase = true
vim.opt.list = true vim.opt.list = true
vim.opt.listchars = 'eol:¶,tab:→ ,trail:␣,extends:»,precedes:«' vim.opt.listchars = 'eol:¶,tab:→ ,trail:␣,extends:»,precedes:«'
vim.opt.fillchars = 'stl: ,stlnc:-,vert:|,fold:-,diff:-'
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
vim.opt.number = true vim.opt.number = true
vim.opt.shiftwidth = 2 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 -- replace built in selector with telescope
require('telescope').setup { require('telescope').setup {
@ -10,7 +17,7 @@ require('telescope').setup {
} }
} }
} }
require("telescope").load_extension("ui-select") require('telescope').load_extension('ui-select')
-- autocomplete config -- autocomplete config
local cmp = require 'cmp' local cmp = require 'cmp'
@ -41,52 +48,39 @@ cmp.setup {
require('gitsigns').setup() require('gitsigns').setup()
-- lsp configs -- lsp configs
require'lspconfig'.openscad_ls.setup { lsp.openscad_ls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
} }
require'lspconfig'.omnisharp.setup { lsp.omnisharp.setup {
capabilities = lspcap,
on_attach = lspatt,
root_dir = function(file, _) root_dir = function(file, _)
if file:sub(-#".csx") == ".csx" then if file:sub(-#".csx") == ".csx" then
return util.path.dirname(file) return util.path.dirname(file)
end end
return util.root_pattern("*.sln")(file) or util.root_pattern("*.csproj")(file) return util.root_pattern("*.sln")(file) or util.root_pattern("*.csproj")(file)
end, 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) }, cmd = { "/home/rudism/.local/share/omnisharp/OmniSharp", "--languageserver" , "--hostPID", tostring(pid) },
} }
require'lspconfig'.tsserver.setup { lsp.tsserver.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
--cmd = { 'npx', 'typescript-language-server', '--stdio' },
} }
require'lspconfig'.yamlls.setup { lsp.yamlls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
} }
require'lspconfig'.ccls.setup { lsp.ccls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
} }
local runtime_path = vim.split(package.path, ';') local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua") table.insert(runtime_path, "lua/?/init.lua")
require'lspconfig'.sumneko_lua.setup { lsp.sumneko_lua.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
cmd = { "lua-language-server", "-E" }, cmd = { "lua-language-server", "-E" },
settings = { settings = {
Lua = { Lua = {
@ -106,11 +100,9 @@ require'lspconfig'.sumneko_lua.setup {
}, },
} }
} }
require'lspconfig'.perlpls.setup { lsp.perlpls.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
settings = { settings = {
perl = { perl = {
perlcritic = { perlcritic = {
@ -122,11 +114,9 @@ require'lspconfig'.perlpls.setup {
} }
} }
} }
require'lspconfig'.efm.setup { lsp.efm.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
filetypes = {"sh", "markdown"}, filetypes = {"sh", "markdown"},
settings = { settings = {
languages = { languages = {
@ -144,13 +134,22 @@ require'lspconfig'.efm.setup {
} }
} }
} }
require'lspconfig'.pyright.setup { lsp.pyright.setup {
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = lspcap,
on_attach = function(_, bufnr) on_attach = lspatt,
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') }
end, -- 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 -- status line setup
require'lualine'.setup { require'lualine'.setup {