This commit is contained in:
Sebastian 2025-07-04 14:22:47 +02:00
parent 1b949bdb01
commit a90ea1f671
18 changed files with 1361 additions and 1210 deletions

1048
init.lua

File diff suppressed because it is too large Load Diff

20
lua/config/autocmds.lua Normal file
View File

@ -0,0 +1,20 @@
-- Autocommands
-- Highlight on yank
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- Set indentation for specific languages
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'cs', 'go', 'rust' },
callback = function()
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
end,
})

41
lua/config/keymaps.lua Normal file
View File

@ -0,0 +1,41 @@
-- Keymaps
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
vim.keymap.set('n', '<leader>w', '<cmd>:w<CR>', { desc = 'Save File' })
vim.keymap.set('n', '<leader>pv', '<cmd>:Ex<CR>', { desc = 'Go back to Dir' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- Disable arrow keys
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Window navigation
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- Auto-close brackets
vim.keymap.set('i', '(', '()<Left>')
vim.keymap.set('i', '[', '[]<Left>')
vim.keymap.set('i', '{', '{}<Left>')
vim.keymap.set('i', '"', '""<Left>')
vim.keymap.set('i', "'", "''<Left>")
-- Smart enter for brackets
vim.keymap.set('i', '<CR>', function()
local line = vim.api.nvim_get_current_line()
local col = vim.api.nvim_win_get_cursor(0)[2]
local before = line:sub(col, col)
local after = line:sub(col + 1, col + 1)
if (before == '{' and after == '}') or
(before == '[' and after == ']') or
(before == '(' and after == ')') then
return '<CR><CR><Up><Tab>'
else
return '<CR>'
end
end, { expr = true })

31
lua/config/lazy.lua Normal file
View File

@ -0,0 +1,31 @@
-- 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
error('Error cloning lazy.nvim:\n' .. out)
end
end
vim.opt.rtp:prepend(lazypath)
-- Setup lazy.nvim
require('lazy').setup('plugins', {
ui = {
icons = vim.g.have_nerd_font and {} or {
cmd = '',
config = '🛠',
event = '📅',
ft = '📂',
init = '',
keys = '🗝',
plugin = '🔌',
runtime = '💻',
require = '🌙',
source = '📄',
start = '🚀',
task = '📌',
lazy = '💤 ',
},
},
})

36
lua/config/options.lua Normal file
View File

@ -0,0 +1,36 @@
-- Options
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.mouse = ''
vim.opt.showmode = false
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
vim.opt.breakindent = true
vim.opt.undofile = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.signcolumn = 'yes'
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
-- Enable inline diagnostics
vim.diagnostic.config({
virtual_text = {
prefix = '',
source = 'always',
},
signs = true,
underline = true,
update_in_insert = false,
severity_sort = true,
})
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.list = false
vim.opt.inccommand = 'split'
vim.opt.cursorline = true
vim.opt.scrolloff = 10

View File

@ -1,9 +0,0 @@
return {
{ -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help ibl`
main = 'ibl',
opts = {},
},
}

View File

@ -0,0 +1,74 @@
-- Autocompletion
return {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
{
'L3MON4D3/LuaSnip',
build = (function()
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
return
end
return 'make install_jsregexp'
end)(),
config = function()
require('luasnip.loaders.from_lua').load { paths = { '~/.config/nvim/snippets/' } }
end,
},
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
},
config = function()
local cmp = require 'cmp'
local luasnip = require 'luasnip'
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = { completeopt = 'menu,menuone,noinsert' },
preselect = require('cmp').PreselectMode.None,
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-j>'] = cmp.mapping.select_next_item(),
['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.confirm({ select = true })
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<C-Space>'] = cmp.mapping.complete {},
['<C-l>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }),
['<C-h>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }),
},
sources = {
{
name = 'lazydev',
group_index = 0,
},
{ name = 'luasnip', priority = 1000 },
{ name = 'nvim_lsp', priority = 800 },
{ name = 'path', priority = 300 },
},
}
end,
}

19
lua/plugins/core.lua Normal file
View File

@ -0,0 +1,19 @@
-- Core plugins
return {
'tpope/vim-sleuth',
{
'lewis6991/gitsigns.nvim',
opts = {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
},
},
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
}

View File

@ -0,0 +1,44 @@
-- Code formatting
return {
'stevearc/conform.nvim',
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
},
},
opts = {
notify_on_error = false,
formatters = {
csharpier = {
command = 'csharpier',
args = { 'format', '$FILENAME' },
stdin = false,
tmpfile_format = '.cs',
},
},
format_on_save = function(bufnr)
local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 500,
lsp_format = lsp_format_opt,
}
end,
formatters_by_ft = {
lua = { 'stylua' },
-- cs = { 'csharpier' },
},
},
}

63
lua/plugins/harpoon.lua Normal file
View File

@ -0,0 +1,63 @@
-- Harpoon for quick file navigation
return {
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local harpoon = require 'harpoon'
harpoon:setup()
vim.keymap.set('n', '<leader>A', function()
harpoon:list():add()
end, { desc = 'Add a file to harpoon' })
vim.keymap.set('n', '<leader>a', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = 'Open harpoon nav' })
vim.keymap.set('n', '<leader>1', function()
harpoon:list():select(1)
end, { desc = 'Go to file 1' })
vim.keymap.set('n', '<leader>2', function()
harpoon:list():select(2)
end, { desc = 'Go to file 2' })
vim.keymap.set('n', '<leader>3', function()
harpoon:list():select(3)
end, { desc = 'Go to file 3' })
vim.keymap.set('n', '<leader>4', function()
harpoon:list():select(4)
end, { desc = 'Go to file 4' })
vim.keymap.set('n', '<leader>5', function()
harpoon:list():select(5)
end, { desc = 'Go to file 5' })
vim.keymap.set('n', '<C-S-P>', function()
harpoon:list():prev()
end)
vim.keymap.set('n', '<C-S-N>', function()
harpoon:list():next()
end)
local conf = require('telescope.config').values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require('telescope.pickers')
.new({}, {
prompt_title = 'Harpoon',
finder = require('telescope.finders').new_table {
results = file_paths,
},
previewer = conf.file_previewer {},
sorter = conf.generic_sorter {},
})
:find()
end
vim.keymap.set('n', '<leader>z', function()
toggle_telescope(harpoon:list())
end, { desc = 'Open harpoon window in telescope' })
end,
}

112
lua/plugins/lsp.lua Normal file
View File

@ -0,0 +1,112 @@
-- LSP configuration
return {
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ 'Bilal2453/luvit-meta', lazy = true },
{
'neovim/nvim-lspconfig',
dependencies = {
{ 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
{ 'j-hui/fidget.nvim', opts = {} },
'hrsh7th/cmp-nvim-lsp',
},
config = function()
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
vim.api.nvim_create_autocmd('LspDetach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
end,
})
end
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
end
end,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
local servers = {
omnisharp = {
cmd = { 'omnisharp-mono' },
},
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
},
},
},
}
require('mason').setup()
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua',
'csharpier',
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
require('mason-lspconfig').setup {
handlers = {
function(server_name)
local server = servers[server_name] or {}
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
}
end,
},
}

60
lua/plugins/telescope.lua Normal file
View File

@ -0,0 +1,60 @@
-- Telescope fuzzy finder
return {
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
require('telescope').setup {
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
}
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
end,
}

233
lua/plugins/theme.lua Normal file
View File

@ -0,0 +1,233 @@
-- Custom theme
return {
{
name = 'vague-theme',
dir = vim.fn.stdpath('config'),
config = function()
-- Vague theme
local function setup_vague_theme()
vim.cmd 'highlight clear'
if vim.fn.exists 'syntax_on' == 1 then
vim.cmd 'syntax reset'
end
vim.o.background = 'dark'
vim.g.colors_name = 'vague'
local c = {
black = '#000000',
dark_gray = '#1b1c1d',
gray = '#2d2d30',
light_gray = '#5c5c6e',
white = '#cdcdcd',
foreground = '#be8c8c',
cursor = '#c2c2c2',
line_bg = '#282830',
active_fg = '#deb896',
focus_fg = '#ddb795',
property = '#b6c4dc',
number = '#C2966B',
parameter = '#b8a2ba',
class = '#b06767',
namespace = '#748fa7',
keyword = '#7894AB',
control_kw = '#748fa7',
interface = '#d57d7d',
func = '#be8c8c',
operator = '#CDCDCD',
string = '#deb896',
comment = '#8c8c8c',
error = '#d2788c',
warning = '#e6be8c',
info = '#61a0c4',
}
local function hi(group, fg, bg, attr)
local cmd = 'highlight ' .. group
if fg and fg ~= '' then
cmd = cmd .. ' guifg=' .. fg
end
if bg and bg ~= '' then
cmd = cmd .. ' guibg=' .. bg
end
if attr and attr ~= '' then
cmd = cmd .. ' gui=' .. attr
end
vim.cmd(cmd)
end
-- Basic highlights
hi('Normal', c.white, c.black, '')
hi('Cursor', c.black, c.cursor, '')
hi('CursorLine', '', c.line_bg, '')
hi('CursorColumn', '', c.line_bg, '')
hi('LineNr', c.light_gray, '', '')
hi('CursorLineNr', c.focus_fg, '', 'bold')
hi('Visual', '', '#3d3d3d28', '')
hi('VisualNOS', '', '#3d3d3d28', '')
hi('Search', c.black, c.number, '')
hi('IncSearch', c.black, c.active_fg, '')
hi('MatchParen', '', '#0064001a', '')
hi('VertSplit', c.gray, '', '')
hi('WinSeparator', c.gray, '', '')
hi('StatusLine', c.active_fg, c.black, '')
hi('StatusLineNC', c.foreground, c.black, '')
hi('TabLine', c.foreground, c.black, '')
hi('TabLineFill', '', c.black, '')
hi('TabLineSel', c.active_fg, c.black, 'bold')
hi('Pmenu', c.warning, c.black, '')
hi('PmenuSel', c.active_fg, '#232426', '')
hi('PmenuSbar', '', c.gray, '')
hi('PmenuThumb', '', c.light_gray, '')
hi('FloatBorder', c.gray, '', '')
hi('NormalFloat', c.white, c.black, '')
hi('Folded', c.comment, '#8484841c', '')
hi('FoldColumn', c.light_gray, '', '')
hi('DiffAdd', '', '#587c0c4c', '')
hi('DiffChange', '', '#0c7d9d52', '')
hi('DiffDelete', '', '#94151b54', '')
hi('DiffText', '', '#bcbcbc14', '')
hi('DiagnosticError', c.error, '', '')
hi('DiagnosticWarn', c.warning, '', '')
hi('DiagnosticInfo', c.info, '', '')
hi('DiagnosticHint', c.comment, '', '')
hi('ErrorMsg', c.error, '', '')
hi('WarningMsg', c.warning, '', '')
hi('ModeMsg', c.active_fg, '', '')
hi('MoreMsg', c.active_fg, '', '')
hi('Question', c.active_fg, '', '')
-- Syntax
hi('Comment', c.comment, '', 'italic')
hi('Constant', c.number, '', '')
hi('String', c.string, '', '')
hi('Character', c.string, '', '')
hi('Number', c.number, '', '')
hi('Boolean', c.number, '', '')
hi('Float', c.number, '', '')
hi('Identifier', c.property, '', '')
hi('Function', c.func, '', '')
hi('Statement', c.keyword, '', '')
hi('Conditional', c.control_kw, '', '')
hi('Repeat', c.control_kw, '', '')
hi('Label', c.keyword, '', '')
hi('Operator', c.operator, '', '')
hi('Keyword', c.keyword, '', '')
hi('Exception', c.control_kw, '', '')
hi('PreProc', c.keyword, '', '')
hi('Include', c.keyword, '', '')
hi('Define', c.keyword, '', '')
hi('Macro', c.keyword, '', '')
hi('PreCondit', c.keyword, '', '')
hi('Type', c.class, '', '')
hi('StorageClass', c.keyword, '', '')
hi('Structure', c.class, '', '')
hi('Typedef', c.class, '', '')
hi('Special', c.operator, '', '')
hi('SpecialChar', c.operator, '', '')
hi('Tag', c.class, '', '')
hi('Delimiter', c.operator, '', '')
hi('SpecialComment', c.comment, '', 'bold')
hi('Debug', c.error, '', '')
-- TreeSitter
hi('@variable', c.white, '', '')
hi('@variable.builtin', c.class, '', '')
hi('@variable.parameter', c.parameter, '', '')
hi('@variable.member', c.property, '', '')
hi('@constant', c.number, '', '')
hi('@constant.builtin', c.number, '', '')
hi('@constant.macro', c.keyword, '', '')
hi('@string', c.string, '', '')
hi('@string.escape', c.operator, '', '')
hi('@string.special', c.operator, '', '')
hi('@character', c.string, '', '')
hi('@character.special', c.operator, '', '')
hi('@number', c.number, '', '')
hi('@boolean', c.number, '', '')
hi('@float', c.number, '', '')
hi('@function', c.func, '', '')
hi('@function.builtin', c.func, '', '')
hi('@function.call', c.func, '', '')
hi('@function.macro', c.func, '', '')
hi('@method', c.func, '', '')
hi('@method.call', c.func, '', '')
hi('@constructor', c.class, '', '')
hi('@parameter', c.parameter, '', '')
hi('@keyword', c.keyword, '', '')
hi('@keyword.function', c.keyword, '', '')
hi('@keyword.operator', c.keyword, '', '')
hi('@keyword.return', c.control_kw, '', '')
hi('@keyword.conditional', c.control_kw, '', '')
hi('@keyword.repeat', c.control_kw, '', '')
hi('@keyword.exception', c.control_kw, '', '')
hi('@operator', c.operator, '', '')
hi('@punctuation.delimiter', c.operator, '', '')
hi('@punctuation.bracket', c.operator, '', '')
hi('@punctuation.special', c.operator, '', '')
hi('@type', c.class, '', '')
hi('@type.builtin', c.class, '', '')
hi('@type.definition', c.class, '', '')
hi('@type.qualifier', c.keyword, '', '')
hi('@property', c.property, '', '')
hi('@field', c.property, '', '')
hi('@namespace', c.namespace, '', '')
hi('@module', c.namespace, '', '')
hi('@label', c.keyword, '', '')
hi('@comment', c.comment, '', 'italic')
hi('@tag', c.class, '', '')
hi('@tag.attribute', c.property, '', '')
hi('@tag.delimiter', c.operator, '', '')
-- LSP
hi('@lsp.type.class', c.class, '', '')
hi('@lsp.type.interface', c.interface, '', '')
hi('@lsp.type.namespace', c.namespace, '', '')
hi('@lsp.type.parameter', c.parameter, '', '')
hi('@lsp.type.property', c.property, '', '')
hi('@lsp.type.variable', c.white, '', '')
hi('@lsp.type.function', c.func, '', '')
hi('@lsp.type.method', c.func, '', '')
hi('@lsp.type.macro', c.func, '', '')
hi('@lsp.mod.defaultLibrary', c.func, '', '')
hi('LspSignatureActiveParameter', c.parameter, '', 'bold')
hi('LspCodeLens', c.comment, '', '')
hi('LspInlayHint', c.comment, '', 'italic')
-- Telescope
hi('TelescopeNormal', c.white, c.black, '')
hi('TelescopeBorder', c.gray, '', '')
hi('TelescopeSelection', c.active_fg, '#232426', '')
hi('TelescopeSelectionCaret', c.active_fg, '', '')
hi('TelescopeMatching', c.number, '', '')
-- Which-key
hi('WhichKey', c.property, '', '')
hi('WhichKeyGroup', c.class, '', '')
hi('WhichKeyDesc', c.white, '', '')
hi('WhichKeyFloat', '', c.black, '')
hi('WhichKeyBorder', c.gray, '', '')
-- Terminal colors
vim.g.terminal_color_0 = c.black
vim.g.terminal_color_1 = '#cd3131'
vim.g.terminal_color_2 = '#0dbc79'
vim.g.terminal_color_3 = '#e5e510'
vim.g.terminal_color_4 = '#2472c8'
vim.g.terminal_color_5 = '#bc3fbc'
vim.g.terminal_color_6 = '#11a8cd'
vim.g.terminal_color_7 = '#e5e5e5'
vim.g.terminal_color_8 = '#666666'
vim.g.terminal_color_9 = '#f14c4c'
vim.g.terminal_color_10 = '#23d18b'
vim.g.terminal_color_11 = '#f5f543'
vim.g.terminal_color_12 = '#3b8eea'
vim.g.terminal_color_13 = '#d670d6'
vim.g.terminal_color_14 = '#29b8db'
vim.g.terminal_color_15 = '#e5e5e5'
end
setup_vague_theme()
end,
},
}

View File

@ -0,0 +1,15 @@
-- Treesitter for syntax highlighting
return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
main = 'nvim-treesitter.configs',
opts = {
ensure_installed = { 'bash', 'c', 'c_sharp', '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' } },
},
}

163
lua/plugins/ui.lua Normal file
View File

@ -0,0 +1,163 @@
-- UI plugins
return {
{
'folke/which-key.nvim',
event = 'VimEnter',
opts = {
icons = {
mappings = vim.g.have_nerd_font,
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
spec = {
-- Groups
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>W', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
-- General keybinds
{ '<leader>w', desc = 'Save File' },
{ '<leader>pv', desc = 'Go back to Dir' },
{ '<leader>q', desc = 'Open diagnostic quickfix list' },
{ '<leader>f', desc = 'Format buffer', mode = { 'n', 'v' } },
-- LSP keybinds
{ '<leader>D', desc = 'Type Definition' },
{ '<leader>ds', desc = 'Document Symbols' },
{ '<leader>ws', desc = 'Workspace Symbols' },
{ '<leader>rn', desc = 'Rename' },
{ '<leader>ca', desc = 'Code Action', mode = { 'n', 'v' } },
{ '<leader>th', desc = 'Toggle Inlay Hints' },
-- Harpoon keybinds
{ '<leader>A', desc = 'Add file to harpoon' },
{ '<leader>a', desc = 'Open harpoon nav' },
{ '<leader>1', desc = 'Go to file 1' },
{ '<leader>2', desc = 'Go to file 2' },
{ '<leader>3', desc = 'Go to file 3' },
{ '<leader>4', desc = 'Go to file 4' },
{ '<leader>5', desc = 'Go to file 5' },
{ '<leader>z', desc = 'Open harpoon in telescope' },
-- Telescope search keybinds
{ '<leader>sh', desc = 'Search Help' },
{ '<leader>sk', desc = 'Search Keymaps' },
{ '<leader>sf', desc = 'Search Files' },
{ '<leader>ss', desc = 'Search Select Telescope' },
{ '<leader>sw', desc = 'Search current Word' },
{ '<leader>sg', desc = 'Search by Grep' },
{ '<leader>sd', desc = 'Search Diagnostics' },
{ '<leader>sr', desc = 'Search Resume' },
{ '<leader>s.', desc = 'Search Recent Files' },
{ '<leader><leader>', desc = 'Find existing buffers' },
{ '<leader>/', desc = 'Fuzzily search in current buffer' },
{ '<leader>s/', desc = 'Search in Open Files' },
{ '<leader>sn', desc = 'Search Neovim files' },
-- Debug keybinds
{ '<leader>b', desc = 'Debug: Toggle Breakpoint' },
{ '<leader>B', desc = 'Debug: Set Breakpoint' },
-- Git hunk actions
{ '<leader>hs', desc = 'Stage hunk', mode = { 'n', 'v' } },
{ '<leader>hr', desc = 'Reset hunk', mode = { 'n', 'v' } },
{ '<leader>hS', desc = 'Stage buffer' },
{ '<leader>hu', desc = 'Undo stage hunk' },
{ '<leader>hR', desc = 'Reset buffer' },
{ '<leader>hp', desc = 'Preview hunk' },
{ '<leader>hb', desc = 'Blame line' },
{ '<leader>hd', desc = 'Diff against index' },
{ '<leader>hD', desc = 'Diff against last commit' },
-- Git toggles
{ '<leader>tb', desc = 'Toggle git show blame line' },
{ '<leader>tD', desc = 'Toggle git show deleted' },
-- Function keys
{ '<F1>', desc = 'Debug: Step Into' },
{ '<F2>', desc = 'Debug: Step Over' },
{ '<F3>', desc = 'Debug: Step Out' },
{ '<F5>', desc = 'Debug: Start/Continue' },
{ '<F7>', desc = 'Debug: See last session result' },
-- Other important keybinds
{ '\\', desc = 'NeoTree reveal' },
{ 'gd', desc = 'Go to Definition' },
{ 'gr', desc = 'Go to References' },
{ 'gI', desc = 'Go to Implementation' },
{ 'gD', desc = 'Go to Declaration' },
{ ']c', desc = 'Next git change' },
{ '[c', desc = 'Previous git change' },
},
},
},
{
'echasnovski/mini.nvim',
config = function()
require('mini.ai').setup { n_lines = 500 }
require('mini.surround').setup()
local statusline = require 'mini.statusline'
statusline.setup { use_icons = vim.g.have_nerd_font }
statusline.section_location = function()
return '%2l:%-2v'
end
end,
},
{
'lukas-reineke/indent-blankline.nvim',
main = 'ibl',
event = 'BufReadPost',
config = function()
vim.api.nvim_set_hl(0, 'IblIndent', { fg = '#0a0a0a' })
vim.api.nvim_set_hl(0, 'IblScope', { fg = '#0e0e0e' })
require('ibl').setup({
indent = {
char = '',
highlight = 'IblIndent',
},
scope = {
enabled = true,
show_start = false,
show_end = false,
highlight = 'IblScope',
},
})
end,
},
}

View File

@ -1,178 +1,157 @@
local ls = require 'luasnip'
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local fmt = require('luasnip.extras.fmt').fmt
local fmt = require("luasnip.extras.fmt").fmt
-- Configure snippet options
local snippet_opts = {
condition = function()
return not ls.in_snippet()
end,
show_condition = function()
return not ls.in_snippet()
end
}
return {
-- Complete main setup
s("main", fmt([[
using System;
s(
'cww',
fmt('Console.WriteLine({});{}', {
i(1, ''),
i(0),
})
),
namespace {};
s(
'cw',
fmt('Console.Write({});{}', {
i(1, ''),
i(0),
})
),
class Program
{{
static void Main(string[] args)
{{
{}
}}
}}
]], { i(1, "MyApp"), i(2, 'Console.WriteLine("Hello, World!");') }), snippet_opts),
s(
'do',
fmt(
[[
do
{{
{}}} while ({});
{}]],
{
i(2),
i(1),
i(0),
}
)
),
-- Namespace
s("namespace", fmt([[
namespace {};
s(
'while',
fmt(
[[
while ({})
{{
{}}}
{}]],
{
i(1),
i(2),
i(0),
}
)
),
{}
]], { i(1, "MyNamespace"), i(2) }), snippet_opts),
s(
'fo',
fmt(
[[
for (int {} = 0; {} < {}; {}++)
{{
{}}}
{}]],
{
i(2, 'i'),
f(function(args)
return args[1][1]
end, { 2 }),
i(1, '1'),
f(function(args)
return args[1][1]
end, { 2 }),
i(3),
i(0),
}
)
),
-- Class
s("class", fmt([[
public class {}
{{
{}
}}
]], { i(1, "MyClass"), i(2) }), snippet_opts),
s(
'forr',
fmt(
[[
for (int {} = {} - 1; {} >= 0; {}--)
{{
{}}}
{}]],
{
i(2, 'i'),
i(1, 'length'),
f(function(args)
return args[1][1]
end, { 2 }),
f(function(args)
return args[1][1]
end, { 2 }),
i(3),
i(0),
}
)
),
-- Method
s("method", fmt([[
public {} {}({})
{{
{}
}}
]], { i(1, "void"), i(2, "MyMethod"), i(3), i(4) }), snippet_opts),
s('cc', t 'Console.Clear();'),
-- Property
s("prop", fmt([[
public {} {} {{ get; set; }}
]], { i(1, "string"), i(2, "MyProperty") }), snippet_opts),
s('crk', t 'Console.ReadKey(true);'),
-- Auto property with init
s("propi", fmt([[
public {} {} {{ get; init; }}
]], { i(1, "string"), i(2, "MyProperty") }), snippet_opts),
s('crl', t 'Console.ReadLine();'),
-- Constructor
s("ctor", fmt([[
public {}({})
{{
{}
}}
]], { i(1, "ClassName"), i(2), i(3) }), snippet_opts),
s(
'foreach',
fmt(
[[
foreach ({})
{{
{}}}{}]],
{
i(1),
i(2),
i(0),
}
)
),
-- Interface
s("interface", fmt([[
public interface {}
{{
{}
}}
]], { i(1, "IMyInterface"), i(2) }), snippet_opts),
s(
'cla',
fmt(
[[
class {}
{{
{}}}
]],
{
i(1, 'ClassName'),
i(0),
}
)
),
-- For loop
s("for", fmt([[
for (int {} = 0; {} < {}; {}++)
{{
{}
}}
]], { i(1, "i"), i(1), i(2, "10"), i(1), i(3) }), snippet_opts),
s(
'inter',
fmt(
[[
interface {}
{{
{}}}
]],
{
i(1, 'IInterfaceName'),
i(0),
}
)
),
-- Foreach loop
s("foreach", fmt([[
foreach ({} {} in {})
{{
{}
}}
]], { i(1, "var"), i(2, "item"), i(3, "collection"), i(4) }), snippet_opts),
s(
'enu',
fmt(
[[
enum {}
{{
{}}}
]],
{
i(1, 'EnumName'),
i(0),
}
)
),
-- If statement
s("if", fmt([[
if ({})
{{
{}
}}
]], { i(1, "condition"), i(2) }), snippet_opts),
s('comment', {
t { '/*', '' },
i(1),
t { '', '*/' },
}),
}
-- Console.WriteLine
s("cw", fmt([[
Console.WriteLine({});
]], { i(1, '"Hello"') }), snippet_opts),
-- Console.Write
s("cwn", fmt([[
Console.Write({});
]], { i(1, '"Hello"') }), snippet_opts),
-- Try-catch
s("try", fmt([[
try
{{
{}
}}
catch ({})
{{
{}
}}
]], { i(1), i(2, "Exception ex"), i(3, "throw;") }), snippet_opts),
-- Variable declaration
s("var", fmt([[
var {} = {};
]], { i(1, "name"), i(2, "value") }), snippet_opts),
-- String variable
s("string", fmt([[
string {} = {};
]], { i(1, "name"), i(2, '""') }), snippet_opts),
-- Record
s("record", fmt([[
public record {}({});
]], { i(1, "MyRecord"), i(2, "string Name") }), snippet_opts),
-- List declaration
s("list", fmt([[
List<{}> {} = [{}];
]], { i(1, "string"), i(2, "list"), i(3) }), snippet_opts),
-- Dictionary declaration
s("dict", fmt([[
Dictionary<{}, {}> {} = [];
]], { i(1, "string"), i(2, "string"), i(3, "dict") }), snippet_opts),
-- Array declaration
s("array", fmt([[
{}[] {} = [{}];
]], { i(1, "string"), i(2, "array"), i(3) }), snippet_opts),
}

126
snippets/go.lua Normal file
View File

@ -0,0 +1,126 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
-- Configure snippet options
local snippet_opts = {
condition = function()
return not ls.in_snippet()
end,
show_condition = function()
return not ls.in_snippet()
end
}
return {
-- Complete main setup
s("main", fmt([[
package main
import "fmt"
func main() {{
{}
}}
]], { i(1, 'fmt.Println("Hello, World!")') }), snippet_opts),
-- Package declaration
s("pkg", fmt([[
package {}
]], { i(1, "main") }), snippet_opts),
-- Function
s("func", fmt([[
func {}({}) {{
{}
}}
]], { i(1, "name"), i(2), i(3) }), snippet_opts),
-- Function with return
s("funcr", fmt([[
func {}() {} {{
{}
}}
]], { i(1, "name"), i(2, "string"), i(3, 'return ""') }), snippet_opts),
-- If error
s("iferr", fmt([[
if err != nil {{
{}
}}
]], { i(1, "return err") }), snippet_opts),
-- For loop
s("for", fmt([[
for {} {{
{}
}}
]], { i(1, "i := 0; i < 10; i++"), i(2) }), snippet_opts),
-- Printf
s("pf", fmt([[
fmt.Printf("{}\n", {})
]], { i(1, "%v"), i(2, "value") }), snippet_opts),
-- Println
s("pl", fmt([[
fmt.Println({})
]], { i(1, '"Hello"') }), snippet_opts),
-- Variable declaration
s("var", fmt([[
var {} {}
]], { i(1, "name"), i(2, "string") }), snippet_opts),
-- Short variable declaration
s(":=", fmt([[
{} := {}
]], { i(1, "name"), i(2, "value") }), snippet_opts),
-- Struct
s("struct", fmt([[
type {} struct {{
{}
}}
]], { i(1, "Name"), i(2, "Field string") }), snippet_opts),
-- Interface
s("interface", fmt([[
type {} interface {{
{}
}}
]], { i(1, "Name"), i(2, "Method()") }), snippet_opts),
-- Test function
s("test", fmt([[
func Test{}(t *testing.T) {{
{}
}}
]], { i(1, "Name"), i(2) }), snippet_opts),
-- Method
s("method", fmt([[
func ({} *{}) {}() {{
{}
}}
]], { i(1, "r"), i(2, "Receiver"), i(3, "Method"), i(4) }), snippet_opts),
-- Goroutine
s("go", fmt([[
go func() {{
{}
}}()
]], { i(1) }), snippet_opts),
-- Channel
s("chan", fmt([[
{} := make(chan {})
]], { i(1, "ch"), i(2, "string") }), snippet_opts),
-- Defer
s("defer", fmt([[
defer {}
]], { i(1, "cleanup()") }), snippet_opts),
}

180
snippets/rust.lua Normal file
View File

@ -0,0 +1,180 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
-- Configure snippet options
local snippet_opts = {
condition = function()
return not ls.in_snippet()
end,
show_condition = function()
return not ls.in_snippet()
end
}
return {
-- Complete main setup
s("main", fmt([[
fn main() {{
{}
}}
]], { i(1, 'println!("Hello, World!");') }), snippet_opts),
-- Function
s("fn", fmt([[
fn {}({}) {{
{}
}}
]], { i(1, "name"), i(2), i(3) }), snippet_opts),
-- Function with return
s("fnr", fmt([[
fn {}({}) -> {} {{
{}
}}
]], { i(1, "name"), i(2), i(3, "()"), i(4) }), snippet_opts),
-- Struct
s("struct", fmt([[
struct {} {{
{}: {},
}}
]], { i(1, "Name"), i(2, "field"), i(3, "String") }), snippet_opts),
-- Enum
s("enum", fmt([[
enum {} {{
{},
}}
]], { i(1, "Name"), i(2, "Variant") }), snippet_opts),
-- Implementation
s("impl", fmt([[
impl {} {{
{}
}}
]], { i(1, "Name"), i(2) }), snippet_opts),
-- Trait
s("trait", fmt([[
trait {} {{
{}
}}
]], { i(1, "Name"), i(2) }), snippet_opts),
-- Match statement
s("match", fmt([[
match {} {{
{} => {},
_ => {},
}}
]], { i(1, "value"), i(2, "pattern"), i(3), i(4) }), snippet_opts),
-- If let
s("iflet", fmt([[
if let {} = {} {{
{}
}}
]], { i(1, "Some(value)"), i(2, "option"), i(3) }), snippet_opts),
-- For loop
s("for", fmt([[
for {} in {} {{
{}
}}
]], { i(1, "item"), i(2, "iterator"), i(3) }), snippet_opts),
-- While loop
s("while", fmt([[
while {} {{
{}
}}
]], { i(1, "condition"), i(2) }), snippet_opts),
-- Loop
s("loop", fmt([[
loop {{
{}
}}
]], { i(1) }), snippet_opts),
-- If statement
s("if", fmt([[
if {} {{
{}
}}
]], { i(1, "condition"), i(2) }), snippet_opts),
-- Variable declaration
s("let", fmt([[
let {} = {};
]], { i(1, "name"), i(2, "value") }), snippet_opts),
-- Mutable variable
s("letm", fmt([[
let mut {} = {};
]], { i(1, "name"), i(2, "value") }), snippet_opts),
-- Print
s("print", fmt([[
println!("{}", {});
]], { i(1, "{}"), i(2, "value") }), snippet_opts),
-- Debug print
s("dbg", fmt([[
dbg!({});
]], { i(1, "value") }), snippet_opts),
-- Vector
s("vec", fmt([[
let {} = vec![{}];
]], { i(1, "name"), i(2) }), snippet_opts),
-- HashMap
s("hashmap", fmt([[
let mut {} = HashMap::new();
]], { i(1, "map") }), snippet_opts),
-- Result match
s("result", fmt([[
match {} {{
Ok({}) => {},
Err({}) => {},
}}
]], { i(1, "result"), i(2, "value"), i(3), i(4, "err"), i(5) }), snippet_opts),
-- Option match
s("option", fmt([[
match {} {{
Some({}) => {},
None => {},
}}
]], { i(1, "option"), i(2, "value"), i(3), i(4) }), snippet_opts),
-- Test function
s("test", fmt([[
#[test]
fn test_{}() {{
{}
}}
]], { i(1, "name"), i(2) }), snippet_opts),
-- Derive
s("derive", fmt([[
#[derive({})]
]], { i(1, "Debug, Clone") }), snippet_opts),
-- Module
s("mod", fmt([[
mod {} {{
{}
}}
]], { i(1, "name"), i(2) }), snippet_opts),
-- Use statement
s("use", fmt([[
use {};
]], { i(1, "std::collections::HashMap") }), snippet_opts),
}