Compare commits

..

25 Commits

Author SHA1 Message Date
THEON-1
288621e1a4 Lazy update 2025-12-23 12:58:59 +01:00
THEON-1
5123a6cc03 some plugin changes 2025-12-23 12:58:50 +01:00
THEON-1
ae30620d2a added <C-a> and <C-e> support 2025-12-23 12:58:34 +01:00
THEON-1
1d941bca87 Lazy update 2025-12-21 14:44:25 +01:00
THEON-1
f999ff81f9 Lazy update 2025-12-20 19:55:41 +01:00
THEON-1
06ba2f478d Lazy update 2025-12-08 13:37:37 +01:00
THEON-1
e5ebca8094 Lazy update 2025-12-08 11:45:56 +01:00
THEON-1
0e3a2dd8cc new ftkeybinds scheme working for arduino 2025-12-03 18:23:38 +01:00
THEON-1
92961e4b42 arduino lsp fix 2025-12-03 18:23:09 +01:00
THEON-1
97864420c3 switched from Mason + mason-lspconfig to custom install 2025-12-03 17:13:52 +01:00
THEON-1
b31dab0c4f Lazy update 2025-12-03 10:35:37 +01:00
THEON-1
608d71b7b1 Lazy update 2025-11-29 00:09:35 +01:00
THEON-1
ecd31ab3fe trim lsp logfile on startup 2025-11-28 16:33:43 +01:00
THEON-1
269c827a7b keybind inc 2025-11-27 11:24:45 +01:00
THEON-1
4a1006a062 Lazy update 2025-11-27 11:24:33 +01:00
THEON-1
f08a9f933f added F6 for additional options in ftkeybinds 2025-11-21 20:14:36 +01:00
THEON-1
3dafac9fa7 blink fix 2025-11-21 20:14:06 +01:00
THEON-1
398cbda7ae changed arduino lsp settings 2025-11-21 15:52:32 +01:00
THEON-1
af5d8b57f2 Lazy update 2025-11-21 14:36:21 +01:00
THEON-1
99b4397294 added winblend option to blink.cmp, set to 0 for now 2025-11-20 09:52:51 +01:00
THEON-1
e6658f026a Lazy update 2025-11-20 09:36:08 +01:00
THEON-1
2b577db2e5 improved upon F5 keybinds 2025-11-20 09:35:59 +01:00
THEON-1
f3362a2187 added arduino specific lsp options 2025-11-05 17:34:22 +01:00
THEON-1
5ebc063aa8 Lazy update 2025-11-05 17:31:48 +01:00
THEON-1
a98f5808a4 Lazy update 2025-10-29 12:58:42 +01:00
19 changed files with 421 additions and 61 deletions

View File

@@ -1,21 +1,19 @@
{
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
"fzf-lua": { "branch": "main", "commit": "6bb2a266facf0d16e30371b6b433037d1828a674" },
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
"fzf-lua": { "branch": "main", "commit": "b1d2b0dc146cb9260209da4d7ab754adb0a2653d" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
"image.nvim": { "branch": "master", "commit": "446a8a5cc7a3eae3185ee0c697732c32a5547a0b" },
"lazy.nvim": { "branch": "main", "commit": "ed4dc336a73c18da6fea6e1cf7ad6e1b76d281eb" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1d77bd86e1c3eaa777010c95dad455b83823f247" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" },
"mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
"noice.nvim": { "branch": "main", "commit": "d14d02cb709e3bb2da88363c32f8b4250bced52d" },
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-lspconfig": { "branch": "master", "commit": "2b52bc2190c8efde2e4de02d829a138666774c7c" },
"nvim-lspconfig": { "branch": "master", "commit": "effe4bf2e1afb881ea67291c648b68dd3dfc927a" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-treesitter": { "branch": "main", "commit": "645f42e85d8665c91a9911c3896afb57d6b8a923" },
"oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" },
"render-markdown.nvim": { "branch": "main", "commit": "bfd67f1402b97ac619cb538f4bbaed12a7fa89aa" },
"nvim-treesitter": { "branch": "main", "commit": "6e42d823ce0a5a76180c473c119c7677738a09d1" },
"oil.nvim": { "branch": "master", "commit": "756dec855b4811f2d27f067a3aca477f368d99f5" },
"render-markdown.nvim": { "branch": "main", "commit": "b2b135347e299ffbf7f4123fb7811899b0c9f4b8" },
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }
}

View File

@@ -1,10 +1,129 @@
local function options2list(options)
local options_list = {}
for opt in options:gmatch("%S+") do
table.insert(options_list, opt)
end
return options_list
end
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown" },
callback = function()
vim.schedule(function()
vim.keymap.set("n", "<F5>", "<CMD>!pandoc %:p -o %:p:r.pdf --verbose &> .pandoc-log <CR>", {silent = true})
end)
end,
local function markdown(options)
local options_list = options2list(options or "")
local cmd = vim.list_extend(
{ "pandoc" },
options_list
)
table.insert(cmd, "-s")
table.insert(cmd, vim.fn.expand("%:p"))
table.insert(cmd, "-o")
table.insert(cmd, vim.fn.expand("%:p:r") .. ".tex")
local pandoc_process = vim.system(cmd)
local pandoc_result = pandoc_process:wait()
local pdflatex_process = vim.system({
"pdflatex",
vim.fn.expand("%:p:r") .. ".tex",
})
local pdflatex_result = pdflatex_process:wait()
--vim.notify((pandoc_result.stdout .. "\n\n" .. pdflatex_result.stdout):gsub("^%s*", ""):gsub("%s*$", ""), vim.log.levels.INFO);
vim.notify((pandoc_result.stderr .. "\n\n" .. pdflatex_result.stderr):gsub("^%s*", ""):gsub("%s*$", ""), vim.log.levels.ERROR);
end
local function arduino(options)
local options_list = options2list(options or "")
local options_string = ""
for _, opt in pairs(options_list) do
options_string = options_string .. " -D" .. opt
end
local process = vim.system({
"arduino-cli",
"compile",
"-e",
"--build-property",
"compiler.cpp.extra_flags=" .. options_string,
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
--local function arduino2()
-- local arduino_process = vim.system({
-- "arduino-cli",
-- "board",
-- "listall",
-- "--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",
-- "-e",
-- "--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
local function tex()
local pdflatex_process = vim.system({
"pdflatex",
vim.fn.expand("%:p"),
})
local pdflatex_result = pdflatex_process:wait()
vim.notify(pdflatex_result.stdout, vim.log.levels.INFO);
vim.notify(pdflatex_result.stderr, vim.log.levels.ERROR);
end
local default = {
__index = function()
return function() end
end,
}
local fttable = {
["markdown"] = markdown,
["arduino"] = arduino,
["tex"] = tex,
}
setmetatable(fttable, default)
local fttable2 = {
["markdown"] = function() markdown(vim.fn.input("enter additional options")) end,
["arduino"] = function() arduino(vim.fn.input("enter preprocessor defines")) end,
}
setmetatable(fttable2, fttable)
vim.keymap.set("n", "<F5>", function() fttable[vim.bo.filetype]() end)
vim.keymap.set("n", "<F6>", function() fttable2[vim.bo.filetype]() end)

View File

@@ -1,3 +1,5 @@
require("config.startup")
require("config.vars")
require("config.keybinds")
require("config.ftkeybinds")
@@ -5,4 +7,5 @@ require("config.ftkeybinds")
require("config.lazy")
require("config.treesitter")
require("lsp")

View File

@@ -2,6 +2,13 @@
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- move to line start/end
vim.keymap.set('i', "<C-e>", "<C-o>$")
vim.keymap.set('i', "<C-a>", "<C-o>^")
vim.keymap.set({ 'n', 'v' }, "<C-e>", '$')
vim.keymap.set({ 'n', 'v' }, "<C-a>", '^')
-- yank to clipboard
vim.keymap.set("n", "<leader>y", "\"+y")
vim.keymap.set("v", "<leader>y", "\"+y")
@@ -24,12 +31,12 @@ vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", {silent = true})
vim.keymap.set("n", "<leader>sb", function ()
local filetype = vim.bo.filetype
local mapping = {
jl = "julia",
julia = "julia",
jl = "/usr/bin/env julia",
julia = "/usr/bin/env julia",
sh = "bash",
zsh = "zsh",
py = "/usr/bin/env python3",
python = "/usr/bin/env python3",
py = "/usr/bin/env python",
python = "/usr/bin/env python",
}
local command = mapping[filetype]
if (command == nil) then return end

12
lua/config/startup.lua Normal file
View File

@@ -0,0 +1,12 @@
local logfile = vim.lsp.log.get_filename()
local tail_process = vim.system({
"tail",
"-n 10000",
logfile,
}, {}, function(res)
vim.schedule(function ()
vim.fn.writefile(vim.split(res.stdout, "\n", { plain = true }), logfile)
end)
end)

30
lua/lsp/arduino.lua Normal file
View File

@@ -0,0 +1,30 @@
---@type vim.lsp.Config
local config = {
cmd = {
"arduino-language-server",
},
filetypes = {
"arduino",
"cpp",
},
root_dir = function (bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
--vim.notify(vim.fs.find({ vim.fn.fnamemodify(fname, ':t:r') }, { type = "directory", upward = true })[1])
on_dir(vim.fs.find({ vim.fn.fnamemodify(fname, ':t:r') }, { type = "directory", upward = true })[1])
end,
capabilities = {
textDocument = {
---@diagnostic disable-next-line: assign-type-mismatch
semanticTokens = vim.NIL,
},
workspace = {
---@diagnostic disable-next-line: assign-type-mismatch
semanticTokens = vim.NIL,
},
},
}
vim.lsp.config['arduino_language_server'] = config
vim.lsp.enable('arduino_language_server')

6
lua/lsp/init.lua Normal file
View File

@@ -0,0 +1,6 @@
# https://github.com/neovim/nvim-lspconfig/blob/master/lsp
require("lsp.arduino")
require("lsp.latex")
require("lsp.lua")
require("lsp.python")

171
lua/lsp/latex.lua Normal file
View File

@@ -0,0 +1,171 @@
local function buf_build(client, bufnr)
local win = vim.api.nvim_get_current_win()
local params = vim.lsp.util.make_position_params(win, client.offset_encoding)
client:request('textDocument/build', params, function(err, result)
if err then
error(tostring(err))
end
local texlab_build_status = {
[0] = 'Success',
[1] = 'Error',
[2] = 'Failure',
[3] = 'Cancelled',
}
vim.notify('Build ' .. texlab_build_status[result.status], vim.log.levels.INFO)
end, bufnr)
end
local function buf_search(client, bufnr)
local win = vim.api.nvim_get_current_win()
local params = vim.lsp.util.make_position_params(win, client.offset_encoding)
client:request('textDocument/forwardSearch', params, function(err, result)
if err then
error(tostring(err))
end
local texlab_forward_status = {
[0] = 'Success',
[1] = 'Error',
[2] = 'Failure',
[3] = 'Unconfigured',
}
vim.notify('Search ' .. texlab_forward_status[result.status], vim.log.levels.INFO)
end, bufnr)
end
local function buf_cancel_build(client, bufnr)
return client:exec_cmd({
title = 'cancel',
command = 'texlab.cancelBuild',
}, { bufnr = bufnr })
end
local function dependency_graph(client)
client:exec_cmd({ command = 'texlab.showDependencyGraph' }, { bufnr = 0 }, function(err, result)
if err then
return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
end
vim.notify('The dependency graph has been generated:\n' .. result, vim.log.levels.INFO)
end)
end
local function command_factory(cmd)
local cmd_tbl = {
Auxiliary = 'texlab.cleanAuxiliary',
Artifacts = 'texlab.cleanArtifacts',
}
return function(client, bufnr)
return client:exec_cmd({
title = ('clean_%s'):format(cmd),
command = cmd_tbl[cmd],
arguments = { { uri = vim.uri_from_bufnr(bufnr) } },
}, { bufnr = bufnr }, function(err, _)
if err then
vim.notify(('Failed to clean %s files: %s'):format(cmd, err.message), vim.log.levels.ERROR)
else
vim.notify(('Command %s executed successfully'):format(cmd), vim.log.levels.INFO)
end
end)
end
end
local function buf_find_envs(client, bufnr)
local win = vim.api.nvim_get_current_win()
client:exec_cmd({
command = 'texlab.findEnvironments',
arguments = { vim.lsp.util.make_position_params(win, client.offset_encoding) },
}, { bufnr = bufnr }, function(err, result)
if err then
return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
end
local env_names = {}
local max_length = 1
for _, env in ipairs(result) do
table.insert(env_names, env.name.text)
max_length = math.max(max_length, string.len(env.name.text))
end
for i, name in ipairs(env_names) do
env_names[i] = string.rep(' ', i - 1) .. name
end
vim.lsp.util.open_floating_preview(env_names, '', {
height = #env_names,
width = math.max((max_length + #env_names - 1), (string.len 'Environments')),
focusable = false,
focus = false,
title = 'Environments',
})
end)
end
local function buf_change_env(client, bufnr)
vim.ui.input({ prompt = 'New environment name: ' }, function(input)
if not input or input == '' then
return vim.notify('No environment name provided', vim.log.levels.WARN)
end
local pos = vim.api.nvim_win_get_cursor(0)
return client:exec_cmd({
title = 'change_environment',
command = 'texlab.changeEnvironment',
arguments = {
{
textDocument = { uri = vim.uri_from_bufnr(bufnr) },
position = { line = pos[1] - 1, character = pos[2] },
newName = tostring(input),
},
},
}, { bufnr = bufnr })
end)
end
---@type vim.lsp.Config
local config = {
cmd = { 'texlab' },
filetypes = { 'tex', 'plaintex', 'bib' },
root_markers = { '.git', '.latexmkrc', 'latexmkrc', '.texlabroot', 'texlabroot', 'Tectonic.toml' },
settings = {
texlab = {
rootDirectory = nil,
build = {
executable = 'latexmk',
args = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '%f' },
onSave = false,
forwardSearchAfter = false,
},
forwardSearch = {
executable = nil,
args = {},
},
chktex = {
onOpenAndSave = false,
onEdit = false,
},
diagnosticsDelay = 300,
latexFormatter = 'latexindent',
latexindent = {
['local'] = nil, -- local is a reserved keyword
modifyLineBreaks = false,
},
bibtexFormatter = 'texlab',
formatterLineLength = 80,
},
},
on_attach = function(client, bufnr)
for _, cmd in ipairs({
{ name = 'TexlabBuild', fn = buf_build, desc = 'Build the current buffer' },
{ name = 'TexlabForward', fn = buf_search, desc = 'Forward search from current position' },
{ name = 'TexlabCancelBuild', fn = buf_cancel_build, desc = 'Cancel the current build' },
{ name = 'TexlabDependencyGraph', fn = dependency_graph, desc = 'Show the dependency graph' },
{ name = 'TexlabCleanArtifacts', fn = command_factory('Artifacts'), desc = 'Clean the artifacts' },
{ name = 'TexlabCleanAuxiliary', fn = command_factory('Auxiliary'), desc = 'Clean the auxiliary files' },
{ name = 'TexlabFindEnvironments', fn = buf_find_envs, desc = 'Find the environments at current position' },
{ name = 'TexlabChangeEnvironment', fn = buf_change_env, desc = 'Change the environment at current position' },
}) do
vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. cmd.name, function()
cmd.fn(client, bufnr)
end, { desc = cmd.desc })
end
end,
}
vim.lsp.config['texlab'] = config
vim.lsp.enable('texlab')

17
lua/lsp/lua.lua Normal file
View File

@@ -0,0 +1,17 @@
---@type vim.lsp.Config
local config = {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
settings = {
codeLens = { enable = true },
hine = {
enable = true,
semicolon = 'Disable',
},
},
}
vim.lsp.config['lua_ls'] = config
vim.lsp.enable('lua_ls')

18
lua/lsp/python.lua Normal file
View File

@@ -0,0 +1,18 @@
---@type vim.lsp.Config
local config = {
cmd = { 'pylsp' },
filetypes = { 'python' },
root_markers = {
'pyproject.toml',
'setup.py',
'setup.cfg',
'requirements.txt',
'Pipfile',
'.git',
},
}
vim.lsp.config['python-language-server'] = config
vim.lsp.enable('python-language-server')

View File

@@ -26,6 +26,15 @@ return {
documentation = {
auto_show = true,
},
menu = {
winblend = 0,
},
},
signature = {
window = {
winblend = 0,
},
},
sources = {

View File

@@ -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 },
},
}

View File

@@ -12,5 +12,6 @@ return {
window_overlap_clear_enabled = true,
window_overlap_clear_ft_ignore = { 'cmp_menu', 'cmp_docs', '', },
},
lazy = true,
}

View File

@@ -25,5 +25,6 @@ return {
'latex2text',
},
},
enabled = false,
}

View File

@@ -19,5 +19,6 @@ return {
},
"neovim/nvim-lspconfig",
},
enabled = false,
}

View File

@@ -1,4 +1,5 @@
return {
'nvim-mini/mini.icons',
lazy = true,
}

View File

@@ -7,5 +7,6 @@ return {
vim.g.molten_image_provider = 'image.nvim'
vim.g.molten_output_win_max_height = 20
end,
enabled = false,
}

View File

@@ -3,5 +3,6 @@ return {
cmd = { 'LspInfo', 'LspInstall', 'LspStart' },
event = { 'BufReadPre', 'BufNewFile' },
dependencies = { 'saghen/blink.cmp' },
enabled = false,
}

View File

@@ -1,5 +1,7 @@
return {
'stevearc/oil.nvim',
--dependencies = { "nvim-mini/mini.icons" },
---@module 'oil'
---@type oil.SetupOpts
opts = {