Compare commits

..

16 Commits

7 changed files with 232 additions and 79 deletions

4
after/ftplugin/cpp.lua Normal file
View File

@@ -0,0 +1,4 @@
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true

View File

@@ -1,14 +1,14 @@
-- init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " "
@@ -16,7 +16,7 @@ require("lazy").setup("plugins")
require("commands")
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. '/.cache/nvim/undodir'
vim.opt.undodir = vim.fn.stdpath('cache') .. '/undodir'
vim.opt.swapfile = false
vim.opt.undofile = true
vim.opt.smartcase = true
@@ -30,15 +30,24 @@ vim.opt.sidescrolloff = 8
vim.opt.mouse = 'a'
vim.opt.autochdir = false
vim.opt.clipboard = 'unnamed,unnamedplus'
in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil
if in_wsl then
vim.g.clipboard = {
name = 'wsl clipboard',
copy = { ["+"] = { "clip.exe" }, ["*"] = { "clip.exe" } },
paste = { ["+"] = { "win32yank.exe" }, ["*"] = { "win32yank.exe" } },
cache_enabled = true
}
end
vim.opt.number = true
vim.opt.wrap = false
vim.opt.signcolumn = 'yes:2'
vim.opt.list = true
vim.opt.listchars = 'tab:▸ ,trail:·'
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = false
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.completeopt = { "menu", "menuone", "noselect" }

View File

@@ -1,39 +1,41 @@
{
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"bufferline.nvim": { "branch": "main", "commit": "5726c4e291224181903e960119a11e20ac677a0a" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "fd3e882e56956675c620898bf1ffcf4fcbe7ec84" },
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
"kanagawa.nvim": { "branch": "master", "commit": "ad3dddecd606746374ba4807324a08331dfca23c" },
"lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
"lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" },
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lspkind-nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
"nvim-cmp": { "branch": "main", "commit": "ca4d3330d386e76967e53b85953c170658255ecb" },
"nvim-dap": { "branch": "master", "commit": "0a0daa796a5919a51e5e5019ffa91219c94c4fef" },
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" },
"nvim-jdtls": { "branch": "master", "commit": "ece818f909c6414cbad4e1fb240d87e003e10fda" },
"nvim-lspconfig": { "branch": "master", "commit": "6e385d2fe5da6714f00142afbd8d3591d330ffd7" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-treesitter": { "branch": "master", "commit": "0aaf146590f3edd1dfa64fbfa2ad1cdca65afa6f" },
"nvim-treesitter-context": { "branch": "master", "commit": "8ebcf62cf48dd97b3d121884ecb6bc4c00f1b069" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-web-devicons": { "branch": "master", "commit": "203da76ecfbb4b192cf830665b03eb651b635c94" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"minuet-ai.nvim": { "branch": "main", "commit": "cb37724d9513759ca2e907ab541424358fb2a90b" },
"mssql.nvim": { "branch": "main", "commit": "d3d3078b42988ae90b9d0a17d7bdb44b1b6d18e3" },
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
"nvim-dap": { "branch": "master", "commit": "5860c7c501eb428d3137ee22c522828d20cca0b3" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-jdtls": { "branch": "master", "commit": "943e2398aba6b7e976603708450c6c93c600e830" },
"nvim-lspconfig": { "branch": "master", "commit": "effe4bf2e1afb881ea67291c648b68dd3dfc927a" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-context": { "branch": "master", "commit": "660861b1849256398f70450afdf93908d28dc945" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
"telescope.nvim": { "branch": "master", "commit": "84b9ba066d1860f7a586ce9cd732fd6c4f77d1d9" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" },
"which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" }
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View File

@@ -6,10 +6,12 @@ vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
-- I don't know why but whenever I accidentally type :W instead of :w, I slows down the ide and reverts all changes
-- It doesn't even save files with sudo...
-- vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
-- Array of file names indicating root directory. Modify to your liking.
local root_names = { '.git', 'Makefile' }
local root_names = { '.git', 'Makefile', 'justfile', 'CMakeLists.txt', 'maskfile.md' }
-- Cache to use for speed up (at cost of possibly outdated results)
local root_cache = {}
@@ -35,3 +37,44 @@ end
local root_augroup = vim.api.nvim_create_augroup('MyAutoRoot', {})
vim.api.nvim_create_autocmd('BufEnter', { group = root_augroup, callback = set_root })
local function set_makeprg()
local cwd = vim.fn.getcwd()
if vim.fn.filereadable(cwd .. '/justfile') == 1 then
vim.o.makeprg = 'just'
elseif vim.fn.filereadable(cwd .. '/Makefile') == 1 then
vim.o.makeprg = 'make'
elseif vim.fn.filereadable(cwd .. '/maskfile.md') == 1 then
vim.o.makeprg = 'mask'
end
end
local makeprg_augroup = vim.api.nvim_create_augroup('MyMakeprg', {})
vim.api.nvim_create_autocmd('BufEnter', { pattern = '*', group = makeprg_augroup, callback = set_makeprg, })
vim.api.nvim_create_autocmd("BufRead", {
pattern = "*.ui",
callback = function(args)
local designer_path = "/home/schmidtf/Qt/6.10.0/gcc_64/bin/designer"
local filename = vim.fn.expand("<afile>:p")
-- Check if Qt Designer is available
if vim.fn.executable(designer_path) == 0 then
vim.notify("Qt Designer not found in PATH", vim.log.levels.WARN)
return
end
-- Open in Qt Designer and close the buffer
vim.fn.jobstart({ designer_path, filename }, {
detach = true,
on_exit = function()
vim.schedule(function()
vim.cmd("bd!")
end)
end
})
vim.notify("Opening " .. filename .. " in Qt Designer")
end
})

44
lua/plugins/ai.lua Normal file
View File

@@ -0,0 +1,44 @@
return {
-- I don't know if I use this wrong or what but opencode does not seem to work that well
-- {
-- 'NickvanDyke/opencode.nvim',
-- dependencies = { 'folke/snacks.nvim', },
-- ---@type opencode.Config
-- opts = {
-- port = 48291,
-- },
-- -- stylua: ignore
-- keys = {
-- { '<leader>ot', function() require('opencode').toggle({ port = 48291 }) end, desc = 'Toggle embedded opencode', },
-- { '<leader>oa', function() require('opencode').ask() end, desc = 'Ask opencode', mode = 'n', },
-- { '<leader>oa', function() require('opencode').ask('@selection: ') end, desc = 'Ask opencode about selection', mode = 'v', },
-- { '<leader>op', function() require('opencode').select_prompt() end, desc = 'Select prompt', mode = { 'n', 'v', }, },
-- { '<leader>on', function() require('opencode').command('session_new') end, desc = 'New session', },
-- { '<leader>oy', function() require('opencode').command('messages_copy') end, desc = 'Copy last message', },
-- { '<S-C-u>', function() require('opencode').command('messages_half_page_up') end, desc = 'Scroll messages up', },
-- { '<S-C-d>', function() require('opencode').command('messages_half_page_down') end, desc = 'Scroll messages down', },
-- },
-- },
-- This is great tho
{
'milanglacier/minuet-ai.nvim',
dependencies = { 'hrsh7th/nvim-cmp', 'nvim-lua/plenary.nvim' },
config = function()
require('minuet').setup {
-- Your configuration options here
provider_options = {
codestral = {
model = 'codestral-latest',
end_point = 'https://codestral.mistral.ai/v1/fim/completions',
api_key = 'CODESTRAL_API_KEY',
stream = true,
optional = {
stop = { '\n\n' }, -- the identifier to stop the completion generation
max_tokens = 256,
},
},
}
}
end,
},
}

View File

@@ -50,16 +50,19 @@ return {
{
'williamboman/mason-lspconfig.nvim',
config = true
--config = function()
-- ensure_installed = { "lua_ls", "ts_ls", "gopls", "rust_analyzer", "bashls", "sqlls", "html", "cssls",
-- "tailwindcss", "phpactor", "julials", "glsl_analyzer", "wgsl_analyzer", "emmet_language_server", "zls" }
--end
},
{
'neovim/nvim-lspconfig',
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
lspconfig.lua_ls.setup {
vim.lsp.config('lua_ls', {
capabilities = capabilities,
root_dir = lspconfig.util.root_pattern('.git'),
root_markers = { '.git' },
settings = {
Lua = {
runtime = {
@@ -78,57 +81,71 @@ return {
}
},
on_attach = lsp_attach
}
lspconfig.ts_ls.setup {
})
vim.lsp.config('ts_ls', {
capabilities = capabilities,
on_attach = lsp_attach,
filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact", "javascript.jsx", "typescript.tsx", "vue" },
init_options = {
plugins = { {
name = '@vue/typescript-plugin',
location = vim.fn.expand(vim.fn.stdpath "data" ..
"/mason/packages/vue-language-server/node_modules/@vue/language-server"),
languages = { 'vue' },
configNamespace = 'typescript'
} }
}
})
vim.lsp.config('vue_ls', {
capabilities = capabilities,
on_attach = lsp_attach
}
lspconfig.gopls.setup {
})
vim.lsp.config('gopls', {
capabilities = capabilities,
on_attach = lsp_attach
}
--lspconfig.rust_analyzer.setup {
})
--vim.lsp.config(rust_analyzer.setup {
-- capabilities = capabilities,
-- on_attach = lsp_attach
--}
lspconfig.bashls.setup {
capabilities = capabilities,
on_attach = lsp_attach
}
lspconfig.sqlls.setup({
--})
vim.lsp.config('bashls', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.html.setup({
vim.lsp.config('sqlls', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.cssls.setup({
vim.lsp.config('html', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.tailwindcss.setup({
vim.lsp.config('cssls', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.phpactor.setup({
vim.lsp.config('tailwindcss', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.julials.setup({
vim.lsp.config('phpactor', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.wgsl_analyzer.setup({
vim.lsp.config('julials', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.glsl_analyzer.setup({
vim.lsp.config('wgsl_analyzer', {
capabilities = capabilities,
on_attach = lsp_attach
})
lspconfig.emmet_language_server.setup({
filetypes = { "css", "html", "javascript", "typescript" },
vim.lsp.config('glsl_analyzer', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('emmet_ls', {
filetypes = { "css", "html" },
-- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration).
-- **Note:** only the options listed in the table are supported.
init_options = {
@@ -152,16 +169,33 @@ return {
variables = {},
},
})
-- vim.lsp.config('ccls.setup {
-- capabilities = capabilities,
-- on_attach = lsp_attach,
-- })
vim.lsp.config('clangd', {
capabilities = capabilities,
on_attach = lsp_attach,
cmd = { "clangd", '--background-index', '--clang-tidy' }
})
vim.lsp.enable({ 'ts_ls', 'vue_ls', 'clangd' })
end
},
{
'mrcjkb/rustaceanvim',
version = "^4",
version = "^6",
lazy = false,
ft = { "rust" },
config = function()
local rust_analyzer_path = vim.fn.trim(vim.fn.system("rustup which rust-analyzer"))
if rust_analyzer_path == "" then
vim.notify("rust-analyzer not found! Install it with: rustup component add rust-analyzer",
vim.log.levels.ERROR)
return
end
vim.g.rustaceanvim = {
server = {
cmd = { rust_analyzer_path },
on_attach = lsp_attach,
settings = {
-- rust-analyzer language server configuration
@@ -174,11 +208,7 @@ return {
runBuildScripts = true,
},
-- Add clippy lints for Rust.
checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
checkOnSave = true,
-- TODO this breaks diagnostics, look into what can be done
-- procMacro = {
-- enable = true,
@@ -323,6 +353,15 @@ return {
jdtls.start_or_attach(config)
end
},
{
"Kurren123/mssql.nvim",
opts = {
-- optional
keymap_prefix = "<leader>m"
},
-- optional
dependencies = { "folke/which-key.nvim" }
},
{ 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga
{
'j-hui/fidget.nvim',
@@ -367,7 +406,15 @@ return {
{ name = 'nvim_lsp_signature_help' },
}, {
{ name = 'buffer', keyword_length = 5 },
{ name = 'minuet' },
}),
performance = {
-- It is recommended to increase the timeout duration due to
-- the typically slower response speed of LLMs compared to
-- other completion sources. This is not needed when you only
-- need manual completion.
fetching_timeout = 2000,
},
formatting = {
format = lspkind.cmp_format {
with_text = true,
@@ -377,6 +424,7 @@ return {
nvim_lua = "[api]",
path = "[path]",
luasnip = "[snip]",
minuet = "[llm]",
}
}
}

View File

@@ -19,7 +19,10 @@ return {
{ '<Leader>fk', telescope.keymaps, { noremap = true, silent = true }, desc = "Search in keymaps" },
{ '<leader>cc', telescope.colorscheme, desc = "Select colorscheme" },
})
end
require("telescope.config").set_defaults({
file_ignore_patterns = { "doc/" }
})
end,
},
{
'nvim-telescope/telescope-ui-select.nvim',