Compare commits

..

1 Commits

Author SHA1 Message Date
Fabian Schmidt
15d27dc96a Update config: tsserver -> ts_ls, add nvim-nio as dap-ui dep 2024-10-31 14:31:08 +01:00
12 changed files with 163 additions and 634 deletions

View File

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

View File

@@ -1,9 +0,0 @@
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
local default_diagnostic_handler = vim.lsp.handlers[method]
vim.lsp.handlers[method] = function(err, result, context, config)
if err ~= nil and err.code == -32802 then
return
end
return default_diagnostic_handler(err, result, context, config)
end
end

View File

@@ -13,6 +13,7 @@ end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " " vim.g.mapleader = " "
require("lazy").setup("plugins") require("lazy").setup("plugins")
require("maps").init()
require("commands") require("commands")
vim.opt.backup = false vim.opt.backup = false
@@ -28,17 +29,8 @@ vim.opt.incsearch = true
vim.opt.scrolloff = 12 vim.opt.scrolloff = 12
vim.opt.sidescrolloff = 8 vim.opt.sidescrolloff = 8
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
vim.opt.autochdir = false vim.opt.autochdir = true
vim.opt.clipboard = 'unnamed,unnamedplus' 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.number = true
vim.opt.wrap = false vim.opt.wrap = false
vim.opt.signcolumn = 'yes:2' vim.opt.signcolumn = 'yes:2'
@@ -51,10 +43,3 @@ vim.opt.expandtab = false
vim.opt.autoindent = true vim.opt.autoindent = true
vim.opt.smartindent = true vim.opt.smartindent = true
vim.opt.completeopt = { "menu", "menuone", "noselect" } vim.opt.completeopt = { "menu", "menuone", "noselect" }
--vim.opt.foldmethod = "expr"
--vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
--vim.opt.foldtext = ""
--vim.opt.foldlevelstart = 1
--vim.opt.foldnestmax = 2
-- TODO replace config with opts in every plugin

View File

@@ -1,41 +1,37 @@
{ {
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "bufferline.nvim": { "branch": "main", "commit": "5c528bee3dd797d5bd6bae5f229411939b25b203" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "fd3e882e56956675c620898bf1ffcf4fcbe7ec84" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" }, "dashboard-nvim": { "branch": "master", "commit": "d2c5a4d1341f5ca1ed2ecb4ecfcff2bc8ea18b14" },
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" }, "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, "gitsigns.nvim": { "branch": "main", "commit": "7c27a30450130cd59c4994a6755e3c5d74d83e76" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, "kanagawa.nvim": { "branch": "master", "commit": "f491b0fe68fffbece7030181073dfe51f45cda81" },
"lspkind-nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" }, "lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" }, "lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"minuet-ai.nvim": { "branch": "main", "commit": "cb37724d9513759ca2e907ab541424358fb2a90b" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"mssql.nvim": { "branch": "main", "commit": "d3d3078b42988ae90b9d0a17d7bdb44b1b6d18e3" }, "nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" },
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
"nvim-dap": { "branch": "master", "commit": "5860c7c501eb428d3137ee22c522828d20cca0b3" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "52638640ae309cacdaff785fdbb854437bd1ee5c" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, "nvim-lspconfig": { "branch": "master", "commit": "54617a18f4cf46f0c2f6d024fa6feb7515fe036d" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-jdtls": { "branch": "master", "commit": "943e2398aba6b7e976603708450c6c93c600e830" }, "nvim-tree.lua": { "branch": "master", "commit": "120ba58254835d412bbc91cffe847e9be835fadd" },
"nvim-lspconfig": { "branch": "master", "commit": "effe4bf2e1afb881ea67291c648b68dd3dfc927a" }, "nvim-treesitter": { "branch": "master", "commit": "f9e9370a6f710148f4a3f3f4f23d5349c85c2888" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"nvim-treesitter-context": { "branch": "master", "commit": "660861b1849256398f70450afdf93908d28dc945" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, "rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" },
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "trouble.nvim": { "branch": "main", "commit": "2f3b537f2207ce32f4459f9d56746ee013b5e01b" },
"rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" }, "vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" }
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "84b9ba066d1860f7a586ce9cd732fd6c4f77d1d9" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
} }

View File

@@ -1,80 +1,12 @@
-- commands.lua -- commands.lua
vim.cmd 'autocmd! User GoyoEnter Limelight'
vim.cmd 'autocmd! User GoyoLeave Limelight!'
vim.cmd 'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap' vim.cmd 'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap'
vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl' vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
-- I don't know why but whenever I accidentally type :W instead of :w, I slows down the ide and reverts all changes vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
-- 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', 'justfile', 'CMakeLists.txt', 'maskfile.md' }
-- Cache to use for speed up (at cost of possibly outdated results)
local root_cache = {}
local set_root = function()
-- Get directory path to start search from
local path = vim.api.nvim_buf_get_name(0)
if path == '' then return end
path = vim.fs.dirname(path)
-- Try cache and resort to searching upward for root directory
local root = root_cache[path]
if root == nil then
local root_file = vim.fs.find(root_names, { path = path, upward = true })[1]
if root_file == nil then return end
root = vim.fs.dirname(root_file)
root_cache[path] = root
end
-- Set current directory
vim.fn.chdir(root)
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
})

59
lua/maps.lua Normal file
View File

@@ -0,0 +1,59 @@
-- maps.lua
local maps = {}
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
function maps.toggleGoyo()
map('n', '<C-g>', ':Goyo<Enter>', { noremap = false })
end
function maps.term()
-- Open and move to resized terminal
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', { noremap = false })
-- Enter normal mode in terminal
map('t', 'ß<C-N>', '<C-\\><C-N>')
end
function maps.telescope()
map('n', '<Leader>ff', '<cmd>lua require(\'telescope.builtin\').git_files()<CR>')
map('n', '<Leader>fg', '<cmd>lua require(\'telescope.builtin\').live_grep()<CR>')
map('n', '<Leader>fb', '<cmd>lua require(\'telescope.builtin\').buffers()<CR>')
map('n', '<Leader>fh', '<cmd>lua require(\'telescope.builtin\').help_tags()<CR>')
end
function maps.fixIndent()
map('v', '<', '<gv')
map('v', '>', '>gv')
end
function maps.moveByRow()
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
map('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', { silent = true, expr = true })
map('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', { silent = true, expr = true })
end
function maps.centeredSearch()
map('n', 'n', 'nzzzv')
map('n', 'N', 'Nzzzv')
end
function maps.init()
vim.g.mapleader = " "
map('n', '<leader>b', '<cmd>NvimTreeToggle<CR>')
map('n', '<leader>cc', '<cmd>Telescope colorscheme<CR>')
maps.toggleGoyo()
maps.term()
maps.telescope()
maps.fixIndent()
maps.moveByRow()
maps.centeredSearch()
end
return maps

View File

@@ -1,44 +0,0 @@
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

@@ -1,37 +1,17 @@
return { return {
{ {
'mfussenegger/nvim-dap', 'mfussenegger/nvim-dap',
lazy = true, dependencies = { 'nvim-lua/plenary.nvim' }
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local wk = require("which-key")
local dap = require("dap")
wk.add({
{ '<leader>d', group = "dap" },
{ '<leader>db', dap.toggle_breakpoint, desc = "Toggle breakpoint" },
{ '<leader>dc', dap.continue, desc = "Launch/resume debug session" },
{ '<leader>do', dap.step_over, desc = "Step over" },
{ '<leader>di', dap.step_into, desc = "Step into" },
{ '<leader>du', dap.step_out, desc = "Step out" },
})
end
}, },
{ {
'rcarriga/nvim-dap-ui', 'rcarriga/nvim-dap-ui',
lazy = true,
config = function() config = function()
local dapui = require("dapui") require("dapui").setup()
dapui.setup()
local wk = require("which-key")
wk.add({
{ '<leader>dd', dapui.toggle, desc = "Toggle dap ui" }
})
end, end,
dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' } dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' }
}, },
{ {
'theHamsta/nvim-dap-virtual-text', 'theHamsta/nvim-dap-virtual-text',
lazy = true,
config = true config = true
} }
} }

View File

@@ -1,35 +1,25 @@
local lsp_attach = function(client, buf) local opts = { noremap = true, silent = true }
vim.api.nvim_set_option_value("formatexpr", "v:lua.vim.lsp.formatexpr()", { buf = buf }) vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = buf }) vim.keymap.set('n', ',d', vim.diagnostic.goto_prev, opts)
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = buf }) vim.keymap.set('n', '.d', vim.diagnostic.goto_next, opts)
vim.lsp.inlay_hint.enable(true, nil) local lsp_attach = function(client, buf)
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()")
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
vim.lsp.inlay_hint.enable(buf, true)
local bufopts = { noremap = true, silent = true, buffer = buf } local bufopts = { noremap = true, silent = true, buffer = buf }
local wk = require("which-key") vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
local diag_next = function() vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.diagnostic.jump({ count = 1, float = true }) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
end vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
local diag_prev = function() vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.diagnostic.jump({ count = -1, float = true }) vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
end vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
wk.add({
{ '<C-e>', require("telescope.builtin").diagnostics, bufopts, desc = "Show diagnostics under cursor" },
{ '<leader>e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" },
{ '[d', diag_prev, bufopts },
{ ']d', diag_next, bufopts },
{ 'gD', vim.lsp.buf.declaration, bufopts, desc = "Go to declaration" },
{ 'gd', vim.lsp.buf.definition, bufopts, desc = "Go to definition" },
{ 'gi', vim.lsp.buf.implementation, bufopts, desc = "Go to implementation" },
{ '<C-k>', vim.lsp.buf.signature_help, bufopts, desc = "Show signature" },
{ '<leader>rn', vim.lsp.buf.rename, bufopts, desc = "Rename" },
{ '<leader>ca', vim.lsp.buf.code_action, bufopts, desc = "Show code actions" },
{ 'gr', require("telescope.builtin").lsp_references, bufopts, desc = "Shwo references" },
})
end end
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/") local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/")
@@ -44,25 +34,21 @@ return {
-- lsp -- lsp
{ {
'williamboman/mason.nvim', 'williamboman/mason.nvim',
lazy = true,
config = true config = true
}, },
{ {
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
config = true 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', 'neovim/nvim-lspconfig',
config = function() config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities() local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
vim.lsp.config('lua_ls', { lspconfig.lua_ls.setup {
capabilities = capabilities, capabilities = capabilities,
root_markers = { '.git' }, root_dir = lspconfig.util.root_pattern('.git'),
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = {
@@ -81,120 +67,57 @@ return {
} }
}, },
on_attach = lsp_attach on_attach = lsp_attach
})
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'
} }
} }
}) lspconfig.ts_ls.setup {
vim.lsp.config('vue_ls', {
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) }
vim.lsp.config('gopls', { lspconfig.gopls.setup {
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) }
--vim.lsp.config(rust_analyzer.setup { --lspconfig.rust_analyzer.setup {
-- capabilities = capabilities, -- capabilities = capabilities,
-- on_attach = lsp_attach -- on_attach = lsp_attach
--}) --}
vim.lsp.config('bashls', { lspconfig.bashls.setup {
capabilities = capabilities,
on_attach = lsp_attach
}
lspconfig.sqlls.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) })
vim.lsp.config('sqlls', { lspconfig.html.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) })
vim.lsp.config('html', { lspconfig.cssls.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) })
vim.lsp.config('cssls', { lspconfig.tailwindcss.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) })
vim.lsp.config('tailwindcss', { lspconfig.phpactor.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) })
vim.lsp.config('phpactor', { capabilities.textDocument.completion.completionItem.snippetSupport = true
lspconfig.emmet_ls.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp_attach on_attach = lsp_attach
}) })
vim.lsp.config('julials', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.config('wgsl_analyzer', {
capabilities = capabilities,
on_attach = lsp_attach
})
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 = {
---@type table<string, string>
includeLanguages = {},
--- @type string[]
excludeLanguages = {},
--- @type string[]
extensionsPath = {},
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/)
preferences = {},
--- @type boolean Defaults to `true`
showAbbreviationSuggestions = true,
--- @type "always" | "never" Defaults to `"always"`
showExpandedAbbreviation = "always",
--- @type boolean Defaults to `false`
showSuggestionsAsSnippets = false,
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/)
syntaxProfiles = {},
--- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables)
variables = {},
},
})
-- vim.lsp.config('ccls.setup {
-- capabilities = capabilities,
-- on_attach = lsp_attach,
-- })
vim.lsp.config('clangd', {
capabilities = capabilities,
on_attach = lsp_attach
})
vim.lsp.enable({ 'ts_ls', 'vue_ls', 'clangd' })
end end
}, },
{ {
'mrcjkb/rustaceanvim', 'mrcjkb/rustaceanvim',
version = "^6", version = "^3",
lazy = false,
ft = { "rust" }, ft = { "rust" },
config = function() 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 = { vim.g.rustaceanvim = {
server = { server = {
cmd = { rust_analyzer_path },
on_attach = lsp_attach, on_attach = lsp_attach,
settings = { settings = {
-- rust-analyzer language server configuration -- rust-analyzer language server configuration
@@ -203,11 +126,16 @@ return {
extraArgs = { "+nightly" }, extraArgs = { "+nightly" },
}, },
cargo = { cargo = {
allFeatures = true,
loadOutDirsFromCheck = true, loadOutDirsFromCheck = true,
runBuildScripts = true, runBuildScripts = true,
}, },
-- Add clippy lints for Rust. -- Add clippy lints for Rust.
checkOnSave = true, checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
-- TODO this breaks diagnostics, look into what can be done -- TODO this breaks diagnostics, look into what can be done
-- procMacro = { -- procMacro = {
-- enable = true, -- enable = true,
@@ -223,144 +151,6 @@ return {
} }
end end
}, },
{
'mfussenegger/nvim-jdtls',
ft = { "java" },
config = function()
local home = os.getenv('HOME')
local jdtls = require('jdtls')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local root_markers = { 'gradlew', 'mvnw', 'git' }
local root_dir = require('jdtls.setup').find_root(root_markers)
local workspace_folder = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
local config = {
flags = {
debounce_text_changes = 80,
},
capabilities = capabilities,
on_attach = lsp_attach, -- We pass our on_attach keybindings to the configuration map
root_dir = root_dir, -- Set the root directory to our found root_marker
-- here you can configure eclipse.jdt.ls specific settings
-- these are defined by the eclipse.jdt.ls project and will be passed to eclipse when starting.
-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request
-- for a list of options
settings = {
java = {
format = {
settings = {
-- use google java style guidelines for formatting
-- to use, make sure to download the file from https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml
-- and place it in the ~/.local/share/eclipse directory
-- url = "/.local/share/eclipse/eclipse-java-google-style.xml",
-- profile = "googlestyle",
},
},
signaturehelp = { enabled = true },
contentprovider = { preferred = 'fernflower' }, -- use fernflower to decompile library code
-- specify any completion options
completion = {
favoritestaticmembers = {
-- "org.hamcrest.matcherassert.assertthat",
-- "org.hamcrest.matchers.*",
-- "org.hamcrest.corematchers.*",
-- "org.junit.jupiter.api.assertions.*",
-- "java.util.objects.requirenonnull",
-- "java.util.objects.requirenonnullelse",
-- "org.mockito.mockito.*"
},
filteredtypes = {
-- "com.sun.*",
-- "io.micrometer.shaded.*",
-- "java.awt.*",
-- "jdk.*", "sun.*",
},
},
-- specify any options for organizing imports
sources = {
organizeimports = {
starthreshold = 9999,
staticstarthreshold = 9999,
},
},
-- how code generation should act
codegeneration = {
tostring = {
template = "${object.classname}{${member.name()}=${member.value}, ${othermembers}}"
},
hashcodeequals = {
usejava7objects = true,
},
useblocks = true,
},
-- if you are developing in projects with different java versions, you need
-- to tell eclipse.jdt.ls to use the location of the jdk for your java version
-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request
-- and search for `interface runtimeoption`
-- the `name` is not arbitrary, but must match one of the elements from `enum executionenvironment` in the link above
configuration = {
runtimes = {
{
name = "JavaSE-17",
path = home .. "/.local/share/asdf/installs/java/oracle-17.0.11/",
},
{
name = "JavaSE-21",
path = home .. "/.local/share/asdf/installs/java/oracle-21.0.2/",
},
{
name = "JavaSE-1.8",
path = home .. "/.local/share/asdf/installs/java/adoptopenjdk-8.0.412+8/"
},
}
}
}
},
-- cmd is the command that starts the language server. whatever is placed
-- here is what is passed to the command line to execute jdtls.
-- note that eclipse.jdt.ls must be started with a java version of 17 or higher
-- see: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
-- for the full list of options
cmd = {
home .. "/.local/share/asdf/installs/java/oracle-21.0.2/bin/java",
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultstartlevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true',
'-Dlog.level=all',
'-Xmx4G',
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
-- if you use lombok, download the lombok jar and place it in ~/.local/share/eclipse
'-javaagent:' .. home .. '/.local/share/nvim/mason/packages/jdtls/lombok.jar',
-- the jar file is located where jdtls was installed. this will need to be updated
-- to the location where you installed jdtls
'-jar', vim.fn.glob(
home ..
'/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar'),
-- the configuration for jdtls is also placed where jdtls was installed. this will
-- need to be updated depending on your environment
'-configuration', home .. '/.local/share/nvim/mason/packages/jdtls/config_linux',
-- use the workspace_folder defined above to store data for this project
'-data', workspace_folder,
},
}
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 { 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga
{ {
'j-hui/fidget.nvim', 'j-hui/fidget.nvim',
@@ -405,15 +195,7 @@ return {
{ name = 'nvim_lsp_signature_help' }, { name = 'nvim_lsp_signature_help' },
}, { }, {
{ name = 'buffer', keyword_length = 5 }, { 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 = { formatting = {
format = lspkind.cmp_format { format = lspkind.cmp_format {
with_text = true, with_text = true,
@@ -423,7 +205,6 @@ return {
nvim_lua = "[api]", nvim_lua = "[api]",
path = "[path]", path = "[path]",
luasnip = "[snip]", luasnip = "[snip]",
minuet = "[llm]",
} }
} }
} }

View File

@@ -3,64 +3,17 @@ return {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
version = '0.1.*', version = '0.1.*',
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local telescope = require("telescope.builtin")
local wk = require("which-key")
wk.add({
{ "<leader>g", group = "git" },
{ "<leader>gh", telescope.git_bcommits, { noremap = true, silent = true }, desc = "View commits of current buffer" },
{ "<leader>gb", telescope.git_branches, { noremap = true, silent = true }, desc = "View git branches" },
{ "<leader>gs", telescope.git_status, { noremap = true, silent = true }, desc = "View git status" },
{ "<leader>f", group = "find" },
{ '<Leader>ff', telescope.git_files, { noremap = true, silent = true }, desc = "Search files" },
{ '<Leader>fg', telescope.live_grep, { noremap = true, silent = true }, desc = "Search in files" },
{ '<Leader>fb', telescope.buffers, { noremap = true, silent = true }, desc = "Search in buffers" },
{ '<Leader>fh', telescope.help_tags, { noremap = true, silent = true }, desc = "Search in help" },
{ '<Leader>fk', telescope.keymaps, { noremap = true, silent = true }, desc = "Search in keymaps" },
{ '<leader>cc', telescope.colorscheme, desc = "Select colorscheme" },
})
require("telescope.config").set_defaults({
file_ignore_patterns = { "doc/" }
})
end,
}, },
{ {
'nvim-telescope/telescope-ui-select.nvim', 'nvim-tree/nvim-tree.lua',
dependencies = { 'nvim-telescope/telescope.nvim' },
config = function() config = function()
require("telescope").setup { require('nvim-tree').setup {
defaults = { view = {
mappings = { width = 30,
i = { side = 'left',
["<C-h>"] = "which_key"
}
}
}, },
pickers = {
colorscheme = {
enable_preview = true,
} }
}, end,
extensions = { dependencies = { 'nvim-tree/nvim-web-devicons' }
["ui-select"] = {
require("telescope.themes").get_cursor()
} }
}
}
require("telescope").load_extension("ui-select")
end
}
-- Don't really need it. Nicer than the default but that's it
-- {
-- 'nvim-tree/nvim-tree.lua',
-- config = function()
-- require('nvim-tree').setup {
-- view = {
-- width = 30,
-- side = 'left',
-- },
-- }
-- end,
-- dependencies = { 'nvim-tree/nvim-web-devicons' }
-- }
} }

View File

@@ -3,23 +3,9 @@ return {
'rebelot/kanagawa.nvim', 'rebelot/kanagawa.nvim',
config = function() config = function()
vim.opt.guifont = 'Source Code Pro for Powerline' vim.opt.guifont = 'Source Code Pro for Powerline'
vim.cmd('colorscheme kanagawa')
vim.cmd('set termguicolors') vim.cmd('set termguicolors')
vim.opt.syntax = 'on' vim.opt.syntax = 'on'
-- require('kanagawa').setup({
-- colors = {
-- palette = {
-- lotusGray = "#F8F7F4",
-- lotusWhite0 = "#FBFBF9",
-- lotusWhite1 = "#F2F0E9",
-- lotusWhite2 = "#F8F7F2",
-- lotusWhite3 = "#F6F6F1",
-- lotusWhite4 = "#F4F1E6",
-- lotusWhite5 = "#FcFBF9",
-- }
-- }
-- })
-- vim.cmd('colorscheme kanagawa-lotus')
vim.cmd('colorscheme kanagawa')
end end
}, },
{ 'lunarvim/lunar.nvim' }, { 'lunarvim/lunar.nvim' },
@@ -38,39 +24,7 @@ return {
} }
} }
end, end,
}, dependencies = { 'nvim-treesitter/playground' }
{
"nvim-treesitter/nvim-treesitter-context",
dependencies = { 'nvim-treesitter/nvim-treesitter' }
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
dependencies = { 'nvim-treesitter/nvim-treesitter' },
config = function()
require("nvim-treesitter.configs").setup({
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
}
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
}
})
end
}, },
{ {
'akinsho/bufferline.nvim', 'akinsho/bufferline.nvim',
@@ -92,4 +46,10 @@ return {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
config = true config = true
}, },
{
'glepnir/dashboard-nvim',
event = 'VimEnter',
config = true,
dependencies = { 'nvim-tree/nvim-web-devicons' }
},
} }

View File

@@ -1,60 +0,0 @@
-- maps.lua
local maps = {}
function maps.term()
vim.api.nvim_set_keymap('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i',
{ noremap = false, desc = "Open and move to terminal" })
vim.api.nvim_set_keymap('t', 'ß<C-N>', '<C-\\><C-N>', { noremap = true, desc = "Enter normal mode in terminal" })
end
function maps.fixIndent()
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = true, desc = "Remove identation level" })
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = true, desc = "Add identation level" })
end
function maps.moveByRow()
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
vim.api.nvim_set_keymap('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'',
{ noremap = true, silent = true, expr = true, desc = "Go down 1 line" })
vim.api.nvim_set_keymap('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'',
{ noremap = true, silent = true, expr = true, desc = "Go up 1 line" })
end
function maps.centeredSearch()
vim.api.nvim_set_keymap('n', 'n', 'nzzzv', { noremap = true, desc = "Search next" })
vim.api.nvim_set_keymap('n', 'N', 'Nzzzv', { noremap = true, desc = "Search previous" })
end
function maps.init()
vim.g.mapleader = " "
vim.api.nvim_set_keymap('n', '<leader>b', '<cmd>Lexplore | vert res 30<CR>',
{ noremap = true, desc = "Open file explorer" })
maps.term()
maps.fixIndent()
maps.moveByRow()
maps.centeredSearch()
end
return {
"folke/which-key.nvim",
event = "VeryLazy",
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
config = function()
require("which-key").setup({
preset = "helix"
})
local wk = require("which-key")
maps.init()
end
}