Compare commits
4 Commits
a98f5808a4
...
e6658f026a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6658f026a | ||
|
|
2b577db2e5 | ||
|
|
f3362a2187 | ||
|
|
5ebc063aa8 |
@@ -1,21 +1,20 @@
|
|||||||
{
|
{
|
||||||
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
||||||
"fzf-lua": { "branch": "main", "commit": "6bb2a266facf0d16e30371b6b433037d1828a674" },
|
"fzf-lua": { "branch": "main", "commit": "123cc546c4618f5fd90d5db2da5643e76979162c" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
||||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
|
||||||
"image.nvim": { "branch": "master", "commit": "446a8a5cc7a3eae3185ee0c697732c32a5547a0b" },
|
"image.nvim": { "branch": "master", "commit": "446a8a5cc7a3eae3185ee0c697732c32a5547a0b" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" },
|
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3590d66effccc7376d8c3dbe45e8291f9fed2843" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "7d527c76c43f46294de9c19d39c5a86317809b4b" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||||
"mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" },
|
"mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
|
||||||
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
|
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "5099348591f7d3ba9e547b1e631c694c65bbe0b9" },
|
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "cbd1e91296189a765094810de1b71a04e2597579" },
|
"nvim-lspconfig": { "branch": "master", "commit": "b7c48a7111534b66bee077da8035ac7208a294ff" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
|
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
|
||||||
"nvim-treesitter": { "branch": "main", "commit": "645f42e85d8665c91a9911c3896afb57d6b8a923" },
|
"nvim-treesitter": { "branch": "main", "commit": "bb83a676128d95c865e40ba71376d883bdadec14" },
|
||||||
"oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" },
|
"oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" },
|
||||||
"render-markdown.nvim": { "branch": "main", "commit": "10126effbafb74541b69219711dfb2c631e7ebf8" },
|
"render-markdown.nvim": { "branch": "main", "commit": "6e0e8902dac70fecbdd8ce557d142062a621ec38" },
|
||||||
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
|
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }
|
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,71 @@
|
|||||||
|
local function markdown()
|
||||||
|
local pandoc_process = vim.system({
|
||||||
|
"pandoc",
|
||||||
|
vim.fn.expand("%:p"),
|
||||||
|
"-o",
|
||||||
|
vim.fn.expand("%:p:r") .. ".pdf",
|
||||||
|
"--verbose",
|
||||||
|
})
|
||||||
|
local pandoc_result = pandoc_process:wait()
|
||||||
|
vim.notify(pandoc_result.stdout, vim.log.levels.INFO);
|
||||||
|
vim.notify(pandoc_result.stderr, vim.log.levels.ERROR);
|
||||||
|
end
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
local function arduino()
|
||||||
pattern = { "markdown" },
|
local arduino_process = vim.system({
|
||||||
callback = function()
|
"arduino-cli",
|
||||||
vim.schedule(function()
|
"board",
|
||||||
vim.keymap.set("n", "<F5>", "<CMD>!pandoc %:p -o %:p:r.pdf --verbose &> .pandoc-log <CR>", {silent = true})
|
"listall",
|
||||||
end)
|
"--json"
|
||||||
|
})
|
||||||
|
local boards_json = arduino_process:wait()
|
||||||
|
|
||||||
|
local jq_process = vim.system({
|
||||||
|
"jq",
|
||||||
|
"[.boards.[] | {(.name): .fqbn}] | add",
|
||||||
|
}, { stdin = boards_json.stdout })
|
||||||
|
local boards_jq = jq_process:wait().stdout or {}
|
||||||
|
local boards_table = vim.json.decode(boards_jq)
|
||||||
|
|
||||||
|
local function table_keys(t)
|
||||||
|
local keys = {}
|
||||||
|
for k in pairs(t) do keys[#keys + 1] = k end
|
||||||
|
return keys
|
||||||
|
end
|
||||||
|
|
||||||
|
local keys = table_keys(boards_table)
|
||||||
|
table.sort(keys)
|
||||||
|
require("fzf-lua").fzf_exec(keys, {
|
||||||
|
actions = {
|
||||||
|
['default'] = function(selected, opts)
|
||||||
|
local process = vim.system({
|
||||||
|
"arduino-cli",
|
||||||
|
"compile",
|
||||||
|
"--fqbn",
|
||||||
|
boards_table[selected[1]],
|
||||||
|
vim.fn.expand("%:p:h")
|
||||||
|
})
|
||||||
|
local result = process:wait()
|
||||||
|
|
||||||
|
vim.notify(result.stdout, vim.log.levels.INFO)
|
||||||
|
vim.notify(result.stderr, vim.log.levels.ERROR)
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<F5>", function()
|
||||||
|
local default = {
|
||||||
|
__index = function()
|
||||||
|
return function() end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
local fttable = {
|
||||||
|
["markdown"] = markdown,
|
||||||
|
["arduino"] = arduino,
|
||||||
|
}
|
||||||
|
setmetatable(fttable, default)
|
||||||
|
|
||||||
|
fttable[vim.bo.filetype]()
|
||||||
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ require("config.ftkeybinds")
|
|||||||
require("config.lazy")
|
require("config.lazy")
|
||||||
|
|
||||||
require("config.treesitter")
|
require("config.treesitter")
|
||||||
|
require("lsp")
|
||||||
|
|
||||||
|
|||||||
5
lua/lsp/arduino.lua
Normal file
5
lua/lsp/arduino.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
vim.lsp.config("arduino_language_server", {
|
||||||
|
cmd = { "arduino-language-server", "--fqbn", "arduino:avr:micro" },
|
||||||
|
})
|
||||||
|
|
||||||
3
lua/lsp/init.lua
Normal file
3
lua/lsp/init.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
require("lsp.arduino")
|
||||||
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
return {
|
|
||||||
'ThePrimeagen/harpoon',
|
|
||||||
branch = 'harpoon2',
|
|
||||||
requires = {
|
|
||||||
{ 'nvim-lua/plenary.nvim' },
|
|
||||||
{ 'nvim-telescope/telescope.nvim' },
|
|
||||||
},
|
|
||||||
keys = {
|
|
||||||
{ "<leader>a", function() require("harpoon"):list():add() end },
|
|
||||||
{ "<C-w>", function()
|
|
||||||
local harpoon = require("harpoon")
|
|
||||||
local conf = require("telescope.config").values
|
|
||||||
local function toggle_telescope(harpoon_files)
|
|
||||||
local file_paths = {}
|
|
||||||
for _, item in ipairs(harpoon_files.items) do
|
|
||||||
table.insert(file_paths, item.value)
|
|
||||||
end
|
|
||||||
|
|
||||||
require("telescope.pickers").new({}, {
|
|
||||||
prompt_title = "Harpoon",
|
|
||||||
finder = require("telescope.finders").new_table({ results = file_paths }),
|
|
||||||
previewer = conf.file_previewer({}),
|
|
||||||
sorter = conf.generic_sorter({}),
|
|
||||||
}):find()
|
|
||||||
end
|
|
||||||
toggle_telescope(harpoon:list())
|
|
||||||
end, desc = "Open harpoon window" },
|
|
||||||
|
|
||||||
{ "<C-1>", function() require("harpoon"):list():select(1) end },
|
|
||||||
{ "<C-2>", function() require("harpoon"):list():select(2) end },
|
|
||||||
{ "<C-3>", function() require("harpoon"):list():select(3) end },
|
|
||||||
{ "<C-4>", function() require("harpoon"):list():select(4) end },
|
|
||||||
|
|
||||||
{ "<C-q>", function() require("harpoon"):list():prev() end },
|
|
||||||
{ "<C-e>", function() require("harpoon"):list():next() end },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user