Compare commits

...

20 Commits

Author SHA1 Message Date
Sven Vogel c69a88e20f style: formatted lua source
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 26s Details
2024-11-08 18:22:53 +01:00
Sven Vogel 252bfae0b0 feat(keymap): add keymap to format current buffer 2024-11-08 18:21:12 +01:00
Sven Vogel 840ac3d0cb feat(keymap): add keymap to scroll right- and leftways 2024-11-08 18:11:41 +01:00
Sven Vogel 9c8afc73b4 feat: add configuration for inlay hints 2024-11-08 18:06:24 +01:00
Sven Vogel 3159d83be7 feat: add custom icons to language server diagnostics 2024-11-08 17:47:59 +01:00
Sven Vogel e602c90efc feat: add language server configuration 2024-11-08 17:16:27 +01:00
Sven Vogel 6b5508c3a3 feat: add plugin vim-illuminate 2024-11-08 16:28:19 +01:00
Sven Vogel 37ee45ce2e feat: add plugin indent-blankline 2024-11-08 16:07:09 +01:00
Sven Vogel 7e99cdca1d fix: shift not working properly in visual mode 2024-11-08 12:24:16 +01:00
Sven Vogel 3ff3218ea1 feat: perform undo and redo with `strg+z` in visual mode 2024-11-08 00:07:51 +01:00
Sven Vogel 58c4ff9b99 feat: add mini plugins 2024-11-07 23:54:36 +01:00
Sven Vogel d7d9402eb3 feat: add plugin `twilight` 2024-11-07 23:12:50 +01:00
Sven Vogel ee88b9d3d8 feat: add plugin `satellite` 2024-11-07 23:00:28 +01:00
Sven Vogel 2d649199e0 fix: replace gitsign source information with URL 2024-11-07 23:00:15 +01:00
Sven Vogel e5223852d6 feat: add plugin `gitsigns` 2024-11-07 22:50:44 +01:00
Sven Vogel 60f295c6ca feat: add plugin `nvim-treesitter` 2024-11-07 20:42:43 +01:00
Sven Vogel b508d8dc46 chore: add comment header to neo-tree.lua 2024-11-07 20:16:27 +01:00
Sven Vogel ce3970e903 feat: add border config to neo-tree 2024-11-07 20:14:19 +01:00
Sven Vogel e42c21740f feat: add plugin `dressing` 2024-11-07 20:12:31 +01:00
Sven Vogel 38fbfb61c1 feat: add plugiin nvim-notify 2024-11-07 19:47:51 +01:00
19 changed files with 510 additions and 79 deletions

View File

@ -1,4 +1,3 @@
--
-- Initialize Neovim configuration
-- ..............................................

19
lua/config/icons.lua Normal file
View File

@ -0,0 +1,19 @@
--
-- Icons
--
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 08.11.2024
-- Edited: 08.11.2024
--
-- ==============================================
return {
diagnostics = {
error = "",
warn = "",
hint = "",
info = ""
}
}

View File

@ -1,4 +1,3 @@
--
-- Global custom plugin agnostic keymaps
-- ..............................................
@ -20,32 +19,29 @@ local keymaps = {
desc = "Write buffer to disk"
},
{
mode = { 'n', 'i' },
mode = { 'n', 'v', 'i' },
keys = '<C-z>',
cmd = vim.cmd.undo,
desc = "Undo last edit"
},
{
mode = { 'n', 'i' },
mode = { 'n', 'v', 'i' },
keys = '<C-y>',
cmd = vim.cmd.redo,
desc = "Redo last edit that was undone"
},
--
-- Shift line(s) by one shiftwidth
-- Buffer management
-- ..............................................
{
mode = { 'n', 'i' },
keys = '<S-tab>',
cmd = '<cmd>:<<cr>',
desc = "Shift cursor line left"
},
{
mode = { 'n', 'i' },
keys = '<tab>',
cmd = '<cmd>:><cr>',
desc = "Shift cursor line right"
keys = '<C-t>',
cmd = '<cmd>:enew<cr>',
desc = "Edit new, unnamed buffer"
},
--
-- Shift line(s) by one shiftwidth
-- ..............................................
{
mode = { 'v' },
keys = '<tab>',
@ -59,15 +55,6 @@ local keymaps = {
desc = "Shift selection in visual right"
},
--
-- Buffer management
-- ..............................................
{
mode = { 'n', 'i' },
keys = '<C-t>',
cmd = '<cmd>:enew<cr>',
desc = "Edit new, unnamed buffer"
},
--
-- Window controls
-- ..............................................
{
@ -100,7 +87,6 @@ local keymaps = {
local file_type = vim.api.nvim_buf_get_option(buf, 'filetype')
if buf_type == '' then
-- check if buffer is in ignore
in_ignore = false
for _, v in ipairs(ignore) do
@ -127,6 +113,18 @@ local keymaps = {
end,
desc = "Close buffer"
},
{
mode = { 'i', 'n', 'v' },
keys = '<S-ScrollWheelDown>',
cmd = '<ScrollWheelRight>',
desc = "Scroll rightways"
},
{
mode = { 'i', 'n', 'v' },
keys = '<S-ScrollWheelUp>',
cmd = '<ScrollWheelLeft>',
desc = "Scroll leftways"
},
--
-- Tab (barbar) controls
-- ..............................................
@ -141,6 +139,14 @@ local keymaps = {
keys = '<C-S-tab>',
cmd = vim.cmd('BufferPrevious'),
desc = "Switch to the previous buffer"
},
{
mode = { 'n' },
keys = '<S-f>',
cmd = function()
vim.lsp.buf.format()
end,
desc = "Format buffer with current LSP"
}
}

View File

@ -1,4 +1,3 @@
--
-- Bootstrap and start Lazy.nvim plugins
-- manager.
@ -17,17 +16,17 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
@ -50,16 +49,16 @@ require("config.opts")
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = false },
rtp = {
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = false },
rtp = {
disabled_plugins = {
"gzip",
"matchit",

View File

@ -1,4 +1,3 @@
--
-- Neovim and VIM global configuration
-- and options
@ -26,11 +25,11 @@ opt.mouse = "a"
opt.shiftwidth = 4
opt.tabstop = 4
opt.showmode = false
opt.termguicolors = true -- True color support
opt.termguicolors = true -- True color support
opt.virtualedit = "block" -- Allow cursor to move where there is no text in visual block mode
opt.wrap = false
opt.smoothscroll = true
opt.swapfile = false -- disable swapfiles because they are fucking garbage
opt.swapfile = false -- disable swapfiles because they are fucking garbage
opt.smartindent = true
--
@ -40,4 +39,4 @@ opt.smartindent = true
-- disable netrw
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.inlay_hints_visible = true

15
lua/config/ui.lua Normal file
View File

@ -0,0 +1,15 @@
--
-- User interface configuration
--
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 07.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
return {
border = 'rounded',
winhighlight = 'NormalFloat:DiagnosticError'
}

View File

@ -2,8 +2,8 @@ return {
{
'romgrk/barbar.nvim',
dependencies = {
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
},
init = function()
vim.g.barbar_auto_setup = false
@ -12,9 +12,9 @@ return {
auto_hide = 1,
tabpages = true,
clickable = true,
-- Set the filetypes which barbar will offset itself for
-- Set the filetypes which barbar will offset itself for
sidebar_filetypes = {
['neo-tree'] = {event = 'BufWipeout'}
['neo-tree'] = { event = 'BufWipeout' }
}
},
version = '^1.0.0'

View File

@ -1,5 +1,3 @@
--
-- Global custom plugin agnostic keymaps
--

36
lua/plugins/dressing.lua Normal file
View File

@ -0,0 +1,36 @@
--
-- Improve the default vim.ui interfaces
--
-- Source: https://github.com/stevearc/dressing.nvim
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 07.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
ui = require 'config.ui'
return {
{
'stevearc/dressing.nvim',
opts = {
input = {
enabled = true,
border = ui.border,
trim_prompt = true,
win_options = {
winhighlight = ui.winhighlight
}
},
select = {
enabled = true,
trim_prompt = true,
win_options = {
winhighlight = ui.winhighlight
}
}
}
}
}

20
lua/plugins/gitsigns.lua Normal file
View File

@ -0,0 +1,20 @@
--
-- Super fast git decorations implemented purely in Lua
--
-- Source: https://github.com/lewis6991/gitsigns.nvim
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 07.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
return {
{
'lewis6991/gitsigns.nvim',
opts = {
auto_attach = true,
}
}
}

View File

@ -0,0 +1,25 @@
--
-- Identation markers
--
-- Source: https://github.com/lukas-reineke/indent-blankline.nvim
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 08.11.2024
-- Edited: 08.11.2024
--
-- ==============================================
return {
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config
opts = {
scope = {
enabled = true
}
}
}
}

47
lua/plugins/mini.lua Normal file
View File

@ -0,0 +1,47 @@
--
-- Mini plugin library
--
-- Source: https://github.com/lewis6991/gitsigns.nvim
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 07.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
return {
{
'echasnovski/mini.animate',
version = false
},
{
'echasnovski/mini.comment',
version = false,
opts = {
mappings = {
comment_line = '#',
comment_visual = '#'
}
}
},
{
'echasnovski/mini.move',
version = false,
opts = {
mappings = {
-- Move visual selection in Visual mode. Defaults are Alt (Meta) + hjkl.
left = nil,
right = nil,
down = '<C-down>',
up = '<C-up>',
-- Move current line in Normal mode
line_left = '<S-tab>',
line_right = '<tab>',
line_down = '<C-down>',
line_up = '<C-up>',
}
}
}
}

View File

@ -1,3 +1,17 @@
--
-- Pretty file tree with various sources
--
-- Source: https://github.com/nvim-neo-tree/neo-tree.nvim
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 01.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
ui = require 'config.ui'
return {
"nvim-neo-tree/neo-tree.nvim",
lazy = false,
@ -9,28 +23,29 @@ return {
},
cmd = "Neotree",
opts = {
popup_border_style = ui.border,
source_selector = {
winbar = true,
statusline = false,
sources = {
{
source = "filesystem",
display_name = " 󰉓 Files "
},
{
source = "buffers",
display_name = " 󰈚 Buffers "
},
{
source = "document_symbols",
display_name = " 󰊢 Git "
},
sources = {
{
source = "filesystem",
display_name = " 󰉓 Files "
},
{
source = "buffers",
display_name = " 󰈚 Buffers "
},
{
source = "document_symbols",
display_name = " 󰊢 Git "
},
},
},
},
filesystem = {
filesystem = {
bind_to_cwd = false,
follow_current_file = { enabled = true },
use_libuv_file_watcher = true,
follow_current_file = { enabled = true },
use_libuv_file_watcher = true,
hijack_netrw_behavior = "open_default",
filtered_items = {
hide_dotfiles = false,
@ -42,7 +57,7 @@ return {
}
},
close_if_last_window = false,
default_component_configs = {
default_component_configs = {
container = {
enable_character_fade = true
},
@ -52,11 +67,11 @@ return {
with_markers = true,
indent_marker = "",
last_indent_marker = "",
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
}
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
}
}
}
}

View File

@ -0,0 +1,125 @@
--
-- Start config for builtin Neovim language server protocol client
--
-- Source: https://github.com/RRethy/vim-illuminate
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 08.11.2024
-- Edited: 08.11.2024
--
-- ==============================================
local ui = require 'config.ui'
local icons = require 'config.icons'
return {
{
'neovim/nvim-lspconfig',
dependencies = {
"williamboman/mason.nvim",
{
"williamboman/mason-lspconfig.nvim",
config = function()
end
},
},
opts = {
inlay_hints = {
enabled = true,
},
diagnostics = {
update_in_insert = false,
underline = true,
severity_sort = false,
float = {
border = ui.border,
source = 'always',
},
virtual_text = {
spacing = 4,
source = "if_many",
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
prefix = "icons"
},
signs = {
text = {
[vim.diagnostic.severity.ERROR] = icons.diagnostics.error,
[vim.diagnostic.severity.WARN] = icons.diagnostics.warn,
[vim.diagnostic.severity.HINT] = icons.diagnostics.hint,
[vim.diagnostic.severity.INFO] = icons.diagnostics.info
}
}
}
},
config = function(_, opts)
require("mason").setup()
local handlers = {
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup({
on_attach = function(client, bufnr)
-- optionally enable inlay hints
-- Source: https://www.reddit.com/r/neovim/comments/14em0f8/how_to_use_the_new_lsp_inlay_hints/
-- ..............................................
if client.server_capabilities.inlayHintProvider and opts.inlay_hints.enabled then
vim.lsp.inlay_hint.enable(true, { bufnr })
end
end
})
end,
}
require("mason-lspconfig").setup({ handlers = handlers })
-- Setup diagnostic signs
--
-- Source: https://www.lazyvim.org/plugins/lsp#mason-lspconfignvim
-- ..............................................
-- diagnostics signs
if type(opts.diagnostics.signs) ~= "boolean" then
for severity, icon in pairs(opts.diagnostics.signs.text) do
local name = vim.diagnostic.severity[severity]:lower():gsub("^%l", string.upper)
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
end
-- diagnostic sign as prefix for virtual text
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "" or function(diagnostic)
for d, icon in pairs(icons.diagnostics) do
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
return icon
end
end
end
end
-- Setup diagnostic user interface
--
-- Source: https://vonheikemen.github.io/devlog/tools/setup-nvim-lspconfig-plus-nvim-cmp
-- ..............................................
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{
border = ui.border
})
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{
border = ui.border
})
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
end
}
}

View File

@ -0,0 +1,25 @@
--
-- Prettier user interface for VIM notifications.
--
-- Source: https://github.com/rcarriga/nvim-notify
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 01.11.2024
-- Edited: 01.11.2024
--
-- ==============================================
return {
{
'rcarriga/nvim-notify',
lazy = false,
opts = {
render = "wrapped-compact"
},
-- Source: https://www.lazyvim.org/plugins/ui#nvim-notify
init = function()
vim.notify = require('notify')
end
}
}

View File

@ -0,0 +1,40 @@
--
-- Tree sitter syntax highlightning
--
-- Source: https://github.com/nvim-treesitter/nvim-treesitter
-- https://www.lazyvim.org/plugins/treesitter
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 07.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
return {
{
'nvim-treesitter/nvim-treesitter',
version = false, -- last release is way too old and doesn't work on Windows
build = ":TSUpdate",
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
init = function(plugin)
-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
-- no longer trigger the **nvim-treesitter** module to be loaded in time.
-- Luckily, the only things that those plugins need are the custom queries, which we make available
-- during startup.
require("lazy.core.loader").add_to_rtp(plugin)
require("nvim-treesitter.query_predicates")
end,
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
opts = {
auto_install = true,
highlight = {
enable = true
},
indent = {
enable = true
}
}
}
}

20
lua/plugins/satellite.lua Normal file
View File

@ -0,0 +1,20 @@
--
-- Super fast git decorations implemented purely in Lua
--
-- Source: https://github.com/lewis6991/satellite.nvim
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 07.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
return {
{
'lewis6991/satellite.nvim',
opts = {
current_only = false
}
}
}

20
lua/plugins/twilight.lua Normal file
View File

@ -0,0 +1,20 @@
--
-- Dim all non active scopes using tree sitter
--
-- Source: https://github.com/folke/twilight.nvim
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 07.11.2024
-- Edited: 07.11.2024
--
-- ==============================================
return {
{
"folke/twilight.nvim",
opts = {
}
}
}

View File

@ -0,0 +1,23 @@
--
-- Mark all occurances of the word under the current cursor
--
-- Source: https://github.com/RRethy/vim-illuminate
-- ..............................................
--
-- Author: Sven Vogel
-- Created: 08.11.2024
-- Edited: 08.11.2024
--
-- ==============================================
return {
{
'RRethy/vim-illuminate',
opts = {
case_insensitive_regex = false,
},
config = function(opts)
require('illuminate').configure(opts)
end
}
}