Compare commits

...

20 Commits

Author SHA1 Message Date
Mathias Rothenhaeusler 38709a3b71 remove markdown, not working 2026-06-10 08:10:14 +02:00
mathias 391b30bd7a updated new textobjects method 2026-05-24 14:29:08 +02:00
mathias 0af71243a3 remove old leader s from vimrc 2026-05-20 21:22:55 +02:00
mathias d0ea7c50a0 gl mapping 2026-05-06 19:53:03 +02:00
mathias 233275c160 added gl, easymotion in line 2026-05-05 19:31:44 +02:00
mathias ccd0319364 fix some paths, install rust-analyzer not in mason! 2026-05-05 19:22:04 +02:00
Mathias Rothenhaeusler f11dae4fce fix telescope preview 2026-04-22 16:58:18 +02:00
mathias 09e50948e4 treesitter for nvim 0.12 2026-04-19 13:01:12 +02:00
mathias d1167c2fe9 fix treesitter config, configs issue 2026-04-03 10:55:43 +02:00
Mathias Rothenhaeusler 04f1abe4d1 Merge branch 'main' of https://gitea.safemind.net/mathias/nvim-kickstart 2026-04-03 10:42:28 +02:00
mathias 821f9bee27 fix treesitter config 2026-04-03 10:35:50 +02:00
mathias fbcc0b8d61 fix error message intelephense license txt 2026-03-22 17:17:16 +01:00
Mathias Rothenhaeusler 6a326d7321 phpactor deactivation 2026-01-12 14:34:15 +01:00
Mathias Rothenhaeusler 36bb19fc4e phpactor deactivation 2026-01-12 14:32:15 +01:00
mathias 8850a7cc27 show diagnostics for buffer db 2025-12-30 19:48:36 +01:00
mathias 480e35d011 improve lsp 2025-12-29 12:49:47 +01:00
mathias 95d3e129ad improve nvim-cmp 2025-11-29 19:10:35 +01:00
mathias 2e55a01664 optimize keymaps diagnostics 2025-11-24 19:09:28 +01:00
mathias a233f6e7f2 added clippy for rust lsp setup 2025-11-24 18:53:57 +01:00
mathias 8f4d2e287e lsp fixes and tweaks 2025-11-23 12:17:56 +01:00
7 changed files with 113 additions and 128 deletions
+32 -85
View File
@@ -75,25 +75,12 @@ require('lazy').setup({
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below.
-- seems i need this regardless
'neovim/nvim-lspconfig',
{
-- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
-- 'folke/neodev.nvim',
},
'williamboman/mason.nvim', config = true
},
'williamboman/mason-lspconfig.nvim',
{
-- Autocompletion
'hrsh7th/nvim-cmp',
@@ -146,8 +133,7 @@ require('lazy').setup({
-- Fuzzy Finder (files, lsp, etc)
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
'nvim-telescope/telescope.nvim', version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
@@ -167,31 +153,37 @@ require('lazy').setup({
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
branch="main",
lazy = false,
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'php', 'rust', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
},
-- config = function()
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = { 'bash', 'php', 'rust', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
-- auto_install = true,
-- highlight = {
-- enable = true,
-- additional_vim_regex_highlighting = { 'ruby' },
-- },
-- indent = { enable = true, disable = { 'ruby' } },
-- })
-- end,
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
branch="main"
},
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
init = function()
local ensureInstalled = {
'lua', 'python', 'typescript',
-- ... your parsers
}
local alreadyInstalled = require('nvim-treesitter.config').get_installed()
local parsersToInstall = vim.iter(ensureInstalled)
:filter(function(parser)
return not vim.tbl_contains(alreadyInstalled, parser)
end)
:totable()
require('nvim-treesitter').install(parsersToInstall)
end,
},
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
@@ -282,53 +274,8 @@ vim.api.nvim_create_autocmd('TextYankPost', {
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>dd', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- [[ Configure LSP ]]
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself
-- many times.
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
-- Setup neovim lua configuration
-- require('neodev').setup()
+1
View File
@@ -66,6 +66,7 @@ keymap.set('n', '<M-1>', '<cmd>ToggleTerm direction=horizontal<cr>', { silent =
keymap.set('n', '<leader>f', '<Plug>(easymotion-prefix)', { silent = true })
keymap.set('n', '<leader>fs', '<Plug>(easymotion-sn)', { silent = true })
keymap.set('n', '<leader>w', '<Plug>(easymotion-overwin-f2)', { silent = true })
keymap.set('n', 'gl', '<Plug>(easymotion-sl)', { silent = true })
vim.g.EasyMotion_smartcase = 1
+35 -28
View File
@@ -55,7 +55,10 @@ local on_attach = function(_, bufnr)
keymap.set("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
keymap.set("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
keymap.set("n", "<leader>l", smart_format, opts)
-- keymap.set("n", "<leader>l", smart_format, opts)
keymap.set("n", "<leader>l", function()
vim.lsp.buf.format()
end, { desc = "Format code function" })
keymap.set("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
keymap.set(
"n",
@@ -73,13 +76,15 @@ local on_attach = function(_, bufnr)
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts)
keymap.set("n", "ge", "<cmd>Lspsaga show_line_diagnostics<CR>", opts)
keymap.set("n", "<a-cr>", "<cmd>Lspsaga code_action<CR>", opts)
keymap.set("n", "<leader>d", "<cmd>Telescope diagnostics<CR>", opts)
-- keymap.set("n", "<leader>d", "<cmd>Telescope diagnostics<CR>", opts)
keymap.set("n", "<leader>da", "<cmd>Lspsaga show_workspace_diagnostics ++float<CR>", opts)
keymap.set("n", "<leader>db", "<cmd>Lspsaga show_buf_diagnostics ++float<CR>", opts)
keymap.set("n", "<leader>dn", "<cmd>Lspsaga diagnostic_jump_next<CR>")
keymap.set("n", "<leader>dp", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
keymap.set("n", "gj", "<cmd>lua require'nvim-treesitter.textobjects.move'.goto_next_start('@function.outer')<CR>",
keymap.set("n", "gj", "<cmd>lua require'nvim-treesitter-textobjects.move'.goto_next_start('@function.outer')<CR>",
opts)
keymap.set("n", "gk", "<cmd>lua require'nvim-treesitter.textobjects.move'.goto_previous_start('@function.outer')<CR>",
keymap.set("n", "gk", "<cmd>lua require'nvim-treesitter-textobjects.move'.goto_previous_start('@function.outer')<CR>",
opts)
end
@@ -105,25 +110,19 @@ setup_server("pyright", { filetypes = { "py" } })
setup_server("html", { filetypes = { "html" } })
setup_server("cssls",
{ filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" } })
setup_server("tailwindcss", {
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
})
setup_server("emmet_ls", {
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
})
setup_server("eslint", {
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
})
setup_server("rust_analyzer", {
settings = {
["rust-analyzer"] = { checkOnSave = true },
["rust-analyzer"] = { checkOnSave = true, check = { command = "clippy" } },
},
})
-- PHP LSPs
local util = vim.lsp.util
root_dir = function(fname)
local root_dir = function(fname)
return util.root_pattern("composer.json", ".git")(fname)
or util.path.dirname(fname)
end
@@ -132,21 +131,23 @@ local fallback_root_dir = function(fname)
return util.root_pattern("composer.json", ".git")(fname) or util.path.dirname(fname)
end
setup_server("phpactor", {
filetypes = { "php" },
-- root_dir = fallback_root_dir,
init_options = {
["language_server_phpstan.enabled"] = true,
["language_server_psalm.enabled"] = false,
},
})
-- start it manually :LspStart phpactor
-- setup_server("phpactor", {
-- filetypes = { "php" },
-- -- root_dir = fallback_root_dir,
-- init_options = {
-- ["language_server_phpstan.enabled"] = true,
-- ["language_server_psalm.enabled"] = false,
-- },
-- })
vim.lsp.config("lua_ls", {
setup_server("lua_ls", {
filetypes = { "lua" },
settings = {
Lua = {
diagnostics = {
globals = { "vim" } }
globals = { "vim" } },
format = { enable = true },
}
}
})
@@ -155,7 +156,13 @@ setup_server("intelephense", {
filetypes = { "php" },
-- root_dir = fallback_root_dir,
init_options = {
licenceKey = vim.fn.readfile(vim.fn.expand("$HOME/.config/intelephense/license.txt"))[1],
licenceKey = (function()
local license_path = vim.fn.expand("$HOME/.config/intelephense/license.txt")
if vim.fn.filereadable(license_path) == 1 then
return vim.fn.readfile(license_path)[1]
end
return nil
end)(),
},
settings = {
intelephense = {
@@ -179,10 +186,10 @@ setup_server("intelephense", {
-- phpcs / phpstan configs
vim.g.nvim_phpcs_config_phpcs_path = 'phpcs'
vim.g.nvim_phpcs_config_phpcbf_path = 'phpcbf'
vim.g.ale_php_phpstan_executable = '/home/mace/.config/composer/vendor/bin/phpstan'
vim.g.ale_php_phpstan_executable = '~/.config/composer/vendor/bin/phpstan'
local phpcs_config = "/home/mace/repos/configs/phpcs.xml"
local phpcs_config_new = "/home/mace/repos/dotfiles/phpcs.xml"
local phpcs_config = "~/repos/configs/phpcs.xml"
local phpcs_config_new = "~/repos/dotfiles/phpcs.xml"
if vim.loop.fs_stat(phpcs_config_new) then
vim.g.nvim_phpcs_config_phpcs_standard = phpcs_config_new
elseif vim.loop.fs_stat(phpcs_config) then
@@ -193,7 +200,7 @@ end
-- call this early in your init (so FileType autocommands are installed before opening files)
local enabled_servers = {
"bashls", "lemminx", "yamlls", "jsonls", "pyright", "html", "cssls",
"tailwindcss", "emmet_ls", "eslint", "rust_analyzer", "lua_ls",
"phpactor", "intelephense"
"eslint", "rust_analyzer", "lua_ls",
"intelephense"
}
vim.lsp.enable(enabled_servers)
+32 -7
View File
@@ -19,6 +19,11 @@ end
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
require("luasnip/loaders/from_vscode").lazy_load()
local function has_words_before()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
vim.opt.completeopt = "menu,menuone,noselect"
cmp.setup({
@@ -34,20 +39,40 @@ cmp.setup({
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-k>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<C-j>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
-- sources for autocompletion
sources = cmp.config.sources({
{ name = "nvim_lsp" }, -- lsp
{ name = "luasnip" }, -- snippets
{ name = "nvim_lsp" }, -- lsp
{ name = "luasnip" }, -- snippets
{ name = "buffer", keyword_length = 5 }, -- text within current buffer
{ name = "path" }, -- file system paths
{ name = "path" }, -- file system paths
}),
-- configure lspkind for vs-code like icons
formatting = {
+9 -7
View File
@@ -74,13 +74,15 @@ return {
"easymotion/vim-easymotion",
-- Markdown
{
"iamcco/markdown-preview.nvim",
ft = "markdown",
build = function()
vim.fn["mkdp#util#install"]()
end,
},
-- {
-- "iamcco/markdown-preview.nvim",
-- cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
-- build = "cd app && yarn install",
-- init = function()
-- vim.g.mkdp_filetypes = { "markdown" }
-- end,
-- ft = { "markdown" },
-- },
{
'akinsho/bufferline.nvim',
+3
View File
@@ -23,6 +23,9 @@ telescope.setup({
['<C-d>'] = false,
},
},
preview = {
treesitter = false,
},
},
})
+1 -1
View File
@@ -44,7 +44,7 @@ nnoremap ,b :buffers<CR>
nnoremap <leader>y "+yy
vnoremap <leader>y "+y
:nnoremap <Leader>s :%s/\<<C-r><C-w>\>/
":nnoremap <Leader>s :%s/\<<C-r><C-w>\>/
" xnoremap ("<leader>p", "\"_dP")
" autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab