Reorganized plugins; Found out luasnip autosnippets are responsible for flickering statusline

This commit is contained in:
Andreas Tsouchlos 2025-11-09 23:25:21 +01:00
parent 9aba8cd855
commit 800ce599e9
20 changed files with 206 additions and 196 deletions

View File

@ -1,12 +1,13 @@
vim.pack.add({ "https://github.com/zbirenbaum/copilot.lua" })
require("copilot").setup({
suggestion = {
auto_trigger = true,
keymap = {
accept = "<C-l>",
}
}
})
vim.cmd('command! Run Copilot diable')
-- vim.pack.add({ "https://github.com/zbirenbaum/copilot.lua" })
--
-- require("copilot").setup({
-- suggestion = {
-- auto_trigger = true,
-- keymap = {
-- accept = "<C-l>",
-- }
-- }
-- })
--
-- -- TODO: Disable on startup. For some reason the below line gives an error
-- -- vim.cmd(':Copilot disable')

View File

@ -1,5 +1,5 @@
local plugin_dir = vim.fn.stdpath('config') .. '/lua/plugins'
local plugin_files = vim.fn.glob(plugin_dir .. '/*.lua', false, true)
local plugin_files = vim.fn.glob(plugin_dir .. '/*', false, true)
for _, file in ipairs(plugin_files) do
local plugin_name = vim.fn.fnamemodify(file, ':t:r')

View File

@ -1,63 +1,5 @@
--
--
-- Plugin config
--
--
vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
{ src = "https://github.com/mason-org/mason.nvim" },
})
require("mason").setup()
require("mason-lspconfig").setup()
--
--
-- Diagnostic config
--
--
vim.diagnostic.config({
virtual_text = true,
severity_sort = true,
})
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
local width = vim.api.nvim_win_get_width(0);
vim.diagnostic.open_float(nil, {
scope = "cursor",
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
source = true,
relative = "editor",
width = 40,
focusable = true,
focused = false,
border = "rounded",
title = "Diagnostics",
header = "",
title_pos = "center",
offset_x = width,
offset_y = -1,
})
end,
})
--
--
-- Completion & Formatting
--
--
vim.o.completeopt = "menu,menuone,noinsert,fuzzy"
vim.api.nvim_set_keymap("i", "<C-Space>", "<C-x><C-o>", { noremap = true })
vim.api.nvim_create_autocmd('LspAttach', {

View File

@ -0,0 +1,26 @@
vim.diagnostic.config({
virtual_text = true,
severity_sort = true,
})
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
local width = vim.api.nvim_win_get_width(0);
vim.diagnostic.open_float(nil, {
scope = "cursor",
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
source = true,
relative = "editor",
width = 40,
focusable = false,
focused = false,
border = "rounded",
title = "Diagnostics",
header = "",
title_pos = "center",
offset_x = width,
offset_y = -1,
})
end,
})

View File

@ -0,0 +1,3 @@
require("plugins.lsp.completion")
require("plugins.lsp.diagnostics")
require("plugins.lsp.plugin")

View File

@ -0,0 +1,8 @@
vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
{ src = "https://github.com/mason-org/mason.nvim" },
})
require("mason").setup()
require("mason-lspconfig").setup()

View File

@ -4,15 +4,33 @@ vim.pack.add({
})
require("lualine").setup({
options = {
theme = 'gruvbox_dark'
},
options = { theme = 'gruvbox_dark' },
extensions = {
'nvim-tree',
'trouble',
'mason',
'lazy',
'toggleterm'
},
sections = { lualine_x = { { color = { fg = "#ff9e64" } } } }
sections = {
lualine_c = {
{
"filename",
path = 1,
shorting_target = 50,
}
},
lualine_b = { 'branch' },
lualine_x = { 'encoding' },
lualine_y = {
{
function()
local reg = vim.fn.reg_recording()
if reg ~= "" then
return "Recording @" .. reg
else
return ""
end
end,
color = { fg = "#fabd2f" }
}
}
}
})

View File

@ -1,69 +0,0 @@
vim.pack.add({
{ src = "https://github.com/rafamadriz/friendly-snippets" },
{ src = "https://github.com/L3MON4D3/LuaSnip" }
})
local loader = require("luasnip.loaders.from_lua")
loader.lazy_load({ paths = { "./snippets" } })
require("luasnip").config.set_config({
enable_autosnippets = true,
store_selection_keys = "<leader>v"
})
vim.keymap.set({ "i" }, "<c-j>", function() require("luasnip").expand() end, { silent = true })
vim.keymap.set({ "i", "s" }, "<c-j>", function() require("luasnip").jump(1) end, { silent = true })
vim.keymap.set({ "i", "s" }, "<c-k>", function() require("luasnip").jump(-1) end, { silent = true })
-- TODO: Custom LSP server to supply snippets to completion
-- return {
-- {
-- "L3MON4D3/LuaSnip",
-- dependencies = {
-- {
-- 'rafamadriz/friendly-snippets'
-- }
-- },
-- version = "v2.*",
-- build = "make install_jsregexp",
-- event = {
-- "InsertEnter"
-- },
-- init = function()
-- vim.keymap.set({
-- "i"
-- }, "<c-j>", function() require("luasnip").expand() end, {
-- silent = true
-- })
-- vim.keymap.set({
-- "i",
-- "s"
-- }, "<c-j>", function() require("luasnip").jump(1) end, {
-- silent = true
-- })
-- vim.keymap.set({
-- "i",
-- "s"
-- }, "<c-k>", function() require("luasnip").jump(-1) end, {
-- silent = true
-- })
--
-- end,
-- config = function()
-- local loader = require("luasnip.loaders.from_lua")
-- loader.lazy_load({
-- paths = {
-- "./snippets"
-- }
-- })
--
-- require("luasnip").config.set_config({
-- enable_autosnippets = true,
-- store_selection_keys = "<leader>v"
-- })
-- end
-- }
-- }
--

View File

@ -0,0 +1,49 @@
-- TODO: Implement
-- A server implementation is just a function that returns a table with several methods
-- `dispatchers` is a table with a couple methods that allow the server to interact with the client
local function server(dispatchers)
local closing = false
local srv = {}
-- This method is called each time the client makes a request to the server
-- `method` is the LSP method name
-- `params` is the payload that the client sends
-- `callback` is a function which takes two parameters: `err` and `result`
-- The callback must be called to send a response to the client
-- To learn more about what method names are available and the structure of
-- the payloads you'll need to read the specification:
-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
function srv.request(method, params, callback)
if method == 'initialize' then
callback(nil, { capabilities = {} })
elseif method == 'shutdown' then
callback(nil, nil)
end
return true, 1
end
-- This method is called each time the client sends a notification to the server
-- The difference between `request` and `notify` is that notifications don't expect a response
function srv.notify(method, params)
if method == 'exit' then
dispatchers.on_exit(0, 15)
end
end
-- Indicates if the client is shutting down
function srv.is_closing()
return closing
end
-- Callend when the client wants to terminate the process
function srv.terminate()
closing = true
end
return srv
end
-- print( require("luasnip").get_current_choices())
-- vim.lsp.start({ name = "luasnip", cmd = server })

View File

@ -0,0 +1,2 @@
require("plugins.luasnip.plugin")
require("plugins.luasnip.completion-integration")

View File

@ -0,0 +1,19 @@
vim.pack.add({
{ src = "https://github.com/rafamadriz/friendly-snippets" },
{ src = "https://github.com/L3MON4D3/LuaSnip" }
})
local loader = require("luasnip.loaders.from_lua")
loader.lazy_load({ paths = { "./snippets" } })
-- TODO: Find out how to enable autosnippets without having the status line disappear
require("luasnip").config.set_config({
-- enable_autosnippets = true,
store_selection_keys = "<leader>v"
})
vim.keymap.set({ "i", "s" }, "<c-j>", function() require("luasnip").jump(1) end, { silent = true })
vim.keymap.set({ "i", "s" }, "<c-k>", function() require("luasnip").jump(-1) end, { silent = true })
-- TODO: Is this keymap used?
vim.keymap.set({ "i" }, "<c-j>", function() require("luasnip").expand() end, { silent = true })

View File

@ -3,9 +3,13 @@ vim.pack.add({
{ src = "https://github.com/folke/noice.nvim" }
})
require("noice").setup({
messages = { enabled = false },
views = {
history = {
{ event = "lsp", kind = "" },
},
cmdline_popup = {
backend = "popup",
relative = "editor",
@ -13,9 +17,7 @@ require("noice").setup({
row = -1,
col = "0%"
},
border = {
style = "none"
}
border = { style = "none" }
},
cmdline_popupmenu = {
relative = "editor",
@ -23,6 +25,17 @@ require("noice").setup({
row = -2,
col = "0%"
}
},
mini = {
border = { style = "rounded" },
position = {
row = -3,
col = "100%",
},
size = {
max_width = 50,
max_height = 4,
},
}
}
})

View File

@ -1,22 +0,0 @@
vim.pack.add({
{ src = "https://github.com/stevearc/overseer.nvim", version = "v1.6.0" }
})
require("overseer").setup({
templates = {
"user.cargo_build",
"user.cargo_clean",
"user.cargo_run",
"user.cargo_test",
"user.cmake_generate",
"user.cmake_build",
"user.cmake_clean",
"user.cmake_test",
"user.python_run"
}
})
vim.keymap.set("n", "<leader>oo", function() require("overseer").toggle() end, { desc = "Toggle" })
vim.keymap.set("n", "<leader>or", ":OverseerRun<CR>", { desc = "Run" })
vim.keymap.set("n", "<leader>oq", ":OverseerQuickAction<CR>", { desc = "Quick Action" })
vim.keymap.set("n", "<leader>of", ":OverseerQuickAction open float<CR>", { desc = "Open Float" })

View File

@ -1,2 +0,0 @@
vim.pack.add({"https://github.com/stevearc/quicker.nvim"})
require("quicker").setup()

View File

@ -14,13 +14,12 @@ vim.keymap.set('n', '<leader>fa', function() require("telescope.builtin").find_f
vim.keymap.set('n', '<leader>fb', function() require("telescope.builtin").buffers() end, { desc = "Buffers" })
vim.keymap.set('n', '<leader>fh', function() require("telescope.builtin").help_tags() end, { desc = "Help tags" })
-- require("telescope").setup {
-- -- extensions = {
-- -- ["ui-select"] = {
-- -- require("telescope.themes").get_dropdown {
-- -- }
-- -- }
-- -- }
-- }
require("telescope").setup {
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown()
}
}
}
require("telescope").load_extension("ui-select")

View File

@ -7,4 +7,5 @@ require("gruvbox").setup({
vim.cmd("colorscheme gruvbox")
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
-- TODO: Is this necessary?
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })

View File

@ -1,8 +0,0 @@
vim.pack.add({
{ src = "https://github.com/3rd/sqlite.nvim" },
{ src = "https://github.com/3rd/time-tracker.nvim" }
})
require("time-tracker").setup({
data_file = vim.fn.stdpath("data") .. "/time-tracker.db"
})

View File

@ -11,11 +11,8 @@ require("nvim-treesitter.configs").setup({
},
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = {
"latex"
}
additional_vim_regex_highlighting = { "latex" }
}
})

View File

@ -3,6 +3,7 @@ vim.pack.add({ "https://github.com/folke/which-key.nvim" })
vim.o.timeout = true
vim.o.timeoutlen = 300
-- TODO: Add names for other nameless keymaps
require("which-key").setup({
-- defaults = {
-- ["<leader>x"] = { name = "+Trouble" }

View File

@ -2,6 +2,7 @@ vim.g.mapleader = " "
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.wrap = false
vim.opt.undofile = true
@ -22,6 +23,37 @@ vim.api.nvim_create_autocmd('FileType', {
callback = function() vim.bo.commentstring = '// %s' end
})
-- TODO: Is this necessary?
--
-- vim.api.nvim_create_autocmd('FileType', {
-- pattern = 'rust',
-- callback = function()
-- vim.cmd [[
-- let &efm = ''
-- " Random non issue stuff
-- let &efm .= '%-G%.%#aborting due to previous error%.%#,'
-- let &efm .= '%-G%.%#test failed, to rerun pass%.%#,'
-- " Capture enter directory events for doc tests
-- let &efm .= '%D%*\sDoc-tests %f%.%#,'
-- " Doc Tests
-- let &efm .= '%E---- %f - %o (line %l) stdout ----,'
-- let &efm .= '%Cerror%m,'
-- let &efm .= '%-Z%*\s--> %f:%l:%c,'
-- " Unit tests && `tests/` dir failures
-- " This pattern has to come _after_ the doc test one
-- let &efm .= '%E---- %o stdout ----,'
-- let &efm .= '%Zthread %.%# panicked at %m\, %f:%l:%c,'
-- let &efm .= '%Cthread %.%# panicked at %m,'
-- let &efm .= '%+C%*\sleft: %.%#,'
-- let &efm .= '%+Z%*\sright: %.%#\, %f:%l:%c,'
-- " Compiler Errors and Warnings
-- let &efm .= '%Eerror%m,'
-- let &efm .= '%Wwarning: %m,'
-- let &efm .= '%-Z%*\s--> %f:%l:%c,'
-- ]]
-- end
-- })
vim.opt.cmdheight = 0
vim.o.updatetime = 50