1
0

feat: Initial commit

This commit is contained in:
2024-07-29 20:11:11 +02:00
commit 028893231b
18 changed files with 5999 additions and 0 deletions

34
.config/nvim/init.lua Normal file
View File

@@ -0,0 +1,34 @@
-- Lazy bootstrap
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
end
vim.opt.rtp:prepend(lazypath)
require('BluePlum.set')
require('BluePlum.keymap')
-- Lualine filename
local function hello()
return [[hello world]]
end
require('lazy').setup({
-- Plugins
spec = {
{ import = 'plugins' },
},
checker = { enabled = true },
})
require('lsp')

View File

@@ -0,0 +1,29 @@
{
"LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" },
"actions-preview.nvim": { "branch": "master", "commit": "9f52a01c374318e91337697ebed51c6fae57f8a4" },
"cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" },
"formatter.nvim": { "branch": "fix-305-index-out-of-bounds", "commit": "a8a8b196c9ca37afa53f7ee30a98a343bbbca325" },
"inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "56db3d5ce5476b183783160e6045f7337ba12b83" },
"lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" },
"lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
"markview.nvim": { "branch": "main", "commit": "8537f7f03e4683b9ef98202e7a0286373a5b7135" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"monokai-pro.nvim": { "branch": "master", "commit": "2bad2a92fe0ff6c8581d33a853a1b17592b83239" },
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lspconfig": { "branch": "master", "commit": "fdc44768a09a65140aa00c92872a5381ad486485" },
"nvim-treesitter": { "branch": "master", "commit": "a7ba147b4b51631f7cf7d9da56f7d5763073b18d" },
"nvim-ufo": { "branch": "main", "commit": "1b5f2838099f283857729e820cc05e2b19df7a2c" },
"nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" },
"oil.nvim": { "branch": "master", "commit": "71c972fbd218723a3c15afcb70421f67340f5a6d" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"promise-async": { "branch": "main", "commit": "28c1d5a295eb5310afa2523d4ae9aa41ec5a9de2" },
"rustaceanvim": { "branch": "master", "commit": "e539aa2494460e4cf51df1c7ac6fb16549408f79" },
"telescope.nvim": { "branch": "master", "commit": "10b8a82b042caf50b78e619d92caf0910211973d" },
"todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" }
}

View File

@@ -0,0 +1,27 @@
vim.keymap.set('i', '<M-Up>', '<ESC>:move-2<CR>i')
vim.keymap.set('i', '<M-Down>', '<ESC>:move+<CR>i')
vim.keymap.set('n', '<C-Up>', '<C-u>zz')
vim.keymap.set('n', '<C-Down>', '<C-d>zz')
-- yank to clipboard with leader
vim.keymap.set('n', '<leader>y', '"+y')
vim.keymap.set('v', '<leader>y', '"+y')
vim.keymap.set('n', 'Q', '<nop>')
-- terminal
vim.keymap.set('n', '<leader>t', ':terminal <CR>')
vim.keymap.set('t', '<ESC>', '<C-\\><C-n>')
-- nice additions
vim.keymap.set('n', '<leader>er', function()
vim.diagnostic.open_float()
end)
vim.keymap.set('n', '<leader>l', ':e#<CR>')
-- vim.keymap.set('n', '<leader>ca', ':CodeActionMenu<CR>')
-- vim.keymap.set('n', '<leader>cn', ':IncRename ')
vim.keymap.set('n', '<leader>i', 'cc')
-- peek
vim.keymap.set('n', '<leader>p', vim.lsp.buf.hover)

View File

@@ -0,0 +1,21 @@
-- Tabs for indenting
vim.opt.autoindent = true
vim.g.noexpandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
-- Line numbers
vim.opt.number = true
vim.opt.relativenumber = true
-- Folding
vim.opt.foldlevelstart = 99
vim.g.mapleader = ' '
-- Terminal
vim.g.termguicolors = true
vim.g.terminal_emulator = 'kitty'
-- LSP
vim.lsp.inlay_hint.enable()

190
.config/nvim/lua/lsp.lua Normal file
View File

@@ -0,0 +1,190 @@
vim = vim
local required = { 'mason', 'mason-lspconfig', 'lspconfig', 'lsp-zero', 'cmp' }
local ready = true
vim.cmd.echohl('WarningMsg')
for _, module in ipairs(required) do
local ok, _ = pcall(require, module)
if not ok then
ready = false
vim.cmd.echo('"Module \'' .. module .. "' isn't present!\"")
end
end
if not ready then
vim.cmd.echo('"LSP disabled!"')
vim.cmd.echohl('None')
return
end
vim.cmd.echohl('None')
local zero = require('lsp-zero')
zero.preset('recommended')
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = {
'lua_ls',
'tsserver',
},
handlers = {
-- zero.default_setup,
function(name)
require('lspconfig')[name].setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})
end,
},
})
zero.on_attach(function(client, bufnr)
local opts = { buffer = bufnr, remap = false }
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
end)
-- #region CMP
local cmp_kind_icons = {
Text = '',
Method = '󰆧',
Function = '󰊕',
Constructor = '',
Field = '󰇽',
Variable = '󰂡',
Class = '󰠱',
Interface = '',
Module = '',
Property = '󰜢',
Unit = '',
Value = '󰎠',
Enum = '',
Keyword = '󰌋',
Snippet = '',
Color = '󰏘',
File = '󰈙',
Reference = '',
Folder = '󰉋',
EnumMember = '',
Constant = '󰏿',
Struct = '',
Event = '',
Operator = '󰆕',
TypeParameter = '󰅲',
}
local cmp = require('cmp')
cmp.setup({
mapping = cmp.mapping.preset.insert({
['<Tab>'] = cmp.mapping.confirm({ select = true }),
}),
snippet = {
expand = function(args)
local luasnip = require('luasnip')
if not luasnip then
return
end
luasnip.lsp_expand(args.body)
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'calc' },
},
window = {
completion = {
winhighlight = 'Normal:Pmeny,FloatBorder:Pmenu,Search:None',
col_offset = -3,
side_padding = 0,
},
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { 'kind', 'abbr', 'menu' },
format = function(entry, vim_item)
local kind = require('lspkind').cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item)
local strings = vim.split(kind.kind, '%s', { trimempty = true })
kind.kind = ' ' .. (strings[1] or '') .. ' '
kind.menu = ' (' .. (strings[2] or '') .. ')'
return kind
end,
-- format = function(entry, vim_item)
-- -- Kind icons
-- vim_item.kind = string.format('%s %s ', cmp_kind_icons[vim_item.kind], vim_item.kind)
--
-- return vim_item
-- end,
-- format = function(entry, item)
-- local menu_icon = {
-- nvim_lsp = 'λ',
-- luasnip = '⋗',
-- buffer = 'Ω',
-- path = '🖫',
-- }
-- item.menu = menu_icon[entry.source.name]
-- return item
-- end
},
})
-- #region Highlight groups
-- Customization for Pmenu
vim.api.nvim_set_hl(0, 'PmenuSel', { bg = '#282C34', fg = 'NONE' })
vim.api.nvim_set_hl(0, 'Pmenu', { fg = '#C5CDD9', bg = '#22252A' })
vim.api.nvim_set_hl(0, 'CmpItemAbbrDeprecated', { fg = '#7E8294', bg = 'NONE', strikethrough = true })
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { fg = '#82AAFF', bg = 'NONE', bold = true })
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { fg = '#82AAFF', bg = 'NONE', bold = true })
vim.api.nvim_set_hl(0, 'CmpItemMenu', { fg = '#C792EA', bg = 'NONE', italic = true })
vim.api.nvim_set_hl(0, 'CmpItemKindField', { fg = '#EED8DA', bg = '#B5585F' })
vim.api.nvim_set_hl(0, 'CmpItemKindProperty', { fg = '#EED8DA', bg = '#B5585F' })
vim.api.nvim_set_hl(0, 'CmpItemKindEvent', { fg = '#EED8DA', bg = '#B5585F' })
vim.api.nvim_set_hl(0, 'CmpItemKindText', { fg = '#e2f3c9', bg = '#94c549' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnum', { fg = '#e2f3c9', bg = '#94c549' })
vim.api.nvim_set_hl(0, 'CmpItemKindKeyword', { fg = '#e2f3c9', bg = '#94c549' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstant', { fg = '#FFE082', bg = '#D4BB6C' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstructor', { fg = '#FFE082', bg = '#D4BB6C' })
vim.api.nvim_set_hl(0, 'CmpItemKindReference', { fg = '#FFE082', bg = '#D4BB6C' })
vim.api.nvim_set_hl(0, 'CmpItemKindFunction', { fg = '#EADFF0', bg = '#A377BF' })
vim.api.nvim_set_hl(0, 'CmpItemKindStruct', { fg = '#EADFF0', bg = '#A377BF' })
vim.api.nvim_set_hl(0, 'CmpItemKindClass', { fg = '#EADFF0', bg = '#A377BF' })
vim.api.nvim_set_hl(0, 'CmpItemKindModule', { fg = '#EADFF0', bg = '#A377BF' })
vim.api.nvim_set_hl(0, 'CmpItemKindOperator', { fg = '#EADFF0', bg = '#A377BF' })
vim.api.nvim_set_hl(0, 'CmpItemKindVariable', { fg = '#C5CDD9', bg = '#7E8294' })
vim.api.nvim_set_hl(0, 'CmpItemKindFile', { fg = '#C5CDD9', bg = '#7E8294' })
vim.api.nvim_set_hl(0, 'CmpItemKindUnit', { fg = '#F5EBD9', bg = '#D29a32' })
vim.api.nvim_set_hl(0, 'CmpItemKindSnippet', { fg = '#F5EBD9', bg = '#D29a32' })
vim.api.nvim_set_hl(0, 'CmpItemKindFolder', { fg = '#F5EBD9', bg = '#D29a32' })
vim.api.nvim_set_hl(0, 'CmpItemKindMethod', { fg = '#DDE5F5', bg = '#6C8ED4' })
vim.api.nvim_set_hl(0, 'CmpItemKindValue', { fg = '#DDE5F5', bg = '#6C8ED4' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnumMember', { fg = '#DDE5F5', bg = '#6C8ED4' })
vim.api.nvim_set_hl(0, 'CmpItemKindInterface', { fg = '#D8EEEB', bg = '#58B5A8' })
vim.api.nvim_set_hl(0, 'CmpItemKindColor', { fg = '#D8EEEB', bg = '#58B5A8' })
vim.api.nvim_set_hl(0, 'CmpItemKindTypeParameter', { fg = '#D8EEEB', bg = '#58B5A8' })
-- #endregion
-- #endregion
vim.diagnostic.config({
severity_sort = true,
})

View File

@@ -0,0 +1,21 @@
return {
{
'smjonas/inc-rename.nvim',
keys = { {
'<leader>cn',
':IncRename ',
} },
config = function()
require('inc_rename').setup({
input_buffer_type = 'dressing',
})
end,
},
{
'aznhe21/actions-preview.nvim',
config = function()
require('actions-preview').setup({})
vim.keymap.set('n', '<leader>ca', require('actions-preview').code_actions)
end,
},
}

View File

@@ -0,0 +1,21 @@
return {
{ 'nvim-tree/nvim-web-devicons' },
{ 'stevearc/dressing.nvim', opts = {} },
{
'folke/todo-comments.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
require('todo-comments').setup()
end,
},
{ 'norcalli/nvim-colorizer.lua', opts = {} },
{
'OXY2DEV/markview.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' },
ft = 'markdown',
config = function()
require('markview')
vim.api.nvim_set_hl(0, 'MarkviewLayer', { fg = '#2a2a2a', bg = '#373737' })
end,
},
}

View File

@@ -0,0 +1,63 @@
return {
{
'kevinhwang91/nvim-ufo',
dependencies = {
{
'kevinhwang91/promise-async',
},
},
config = function()
-- Implement custom marker provider.
local CustomMarkerProvider = {}
function CustomMarkerProvider.getFolds(bufnr)
local buf = require('ufo.bufmanager'):get(bufnr)
if not buf then
return
end
local openRegex = '#region'
local closeRegex = '#endregion'
local summaryRegx = openRegex .. '%s*(.*)'
local ranges = {}
local stack = {}
local lines = buf:lines(1, -1)
for lnum, line in ipairs(lines) do
-- Check for start marker
if line:match(openRegex) then
table.insert(stack, lnum)
-- Check for end marker
elseif line:match(closeRegex) then
local startLnum = table.remove(stack)
if startLnum then
local summary = lines[startLnum]:match(summaryRegx)
table.insert(ranges, require('ufo.model.foldingrange').new(startLnum - 1, lnum - 1, summary))
end
end
end
return ranges
end
local function customizeSelector(bufnr)
local ranges = CustomMarkerProvider.getFolds(bufnr)
local maybe_additional_ranges = require('ufo').getFolds(bufnr, 'treesitter')
if next(maybe_additional_ranges) ~= nil then
ranges = vim.list_extend(ranges, maybe_additional_ranges)
else
ranges = vim.list_extend(ranges, require('ufo').getFolds(bufnr, 'indent'))
end
return ranges
end
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return customizeSelector
end,
})
end,
},
}

View File

@@ -0,0 +1,91 @@
return {
{
'tjex/formatter.nvim',
branch = 'fix-305-index-out-of-bounds',
config = function()
local util = require('formatter.util')
local function prettier()
return {
exe = 'prettier',
args = {
'--config-precedence',
'prefer-file',
'--single-quote',
'--use-tabs',
'--trailing-comma',
'es5',
'--bracket-same-line',
'--insert-pragma',
'--stdin-filepath',
vim.fn.shellescape(vim.api.nvim_buf_get_name(0)),
},
stdin = true,
}
end
require('formatter').setup({
filetype = {
javascript = {
prettier,
},
typescript = {
prettier,
},
markdown = {
prettier,
},
css = {
prettier,
},
json = {
prettier,
},
html = {
prettier,
},
scss = {
prettier,
},
lua = {
function()
return {
exe = 'stylua',
args = {
'--indent-type',
'Tabs',
'--line-endings',
'Unix',
'--quote-style',
'AutoPreferSingle',
'--column-width',
vim.api.nvim_command_output('echo &columns'),
'-',
},
stdin = true,
}
end,
},
['*'] = {
function()
if vim.lsp.buf.formatting then
vim.lsp.buf.format()
end
end,
},
},
})
local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
augroup('__formatter__', {
clear = true,
})
autocmd('BufWritePost', {
group = '__formatter__',
command = ':FormatWrite',
})
end,
},
}

View File

@@ -0,0 +1,20 @@
return {
-- Mason
{ 'williamboman/mason.nvim', opts = {}, cmd = 'Mason' },
{ 'williamboman/mason-lspconfig.nvim', opts = {} },
-- Lsp configuration
{ 'VonHeikemen/lsp-zero.nvim' },
{ 'neovim/nvim-lspconfig' },
-- Completion
{ 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-calc', 'L3MON4D3/LuaSnip', 'hrsh7th/cmp-nvim-lsp', 'onsails/lspkind.nvim' } },
-- Additions
{ 'ray-x/lsp_signature.nvim', event = 'VeryLazy', opts = {
hint_prefix = '',
} },
-- Rust
{ 'mrcjkb/rustaceanvim' },
}

View File

@@ -0,0 +1,33 @@
return {
-- Telescope
{
'nvim-telescope/telescope.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
keys = {
{ '<leader>ff', function() require('telescope.builtin').find_files({ show_hidden = true }) end },
{ '<leader>fs', require('telescope.builtin').live_grep },
{ '<leader>bb', require('telescope.builtin').buffers },
},
},
{ 'nvim-lua/plenary.nvim' },
-- Oil
{
'stevearc/oil.nvim',
opts = {
default_file_explorer = true,
view_options = {
show_hidden = true,
},
},
lazy = false,
keys = {
{
'<leader>ex',
function()
vim.cmd('Oil')
end,
},
},
},
}

View File

@@ -0,0 +1,13 @@
return {
{
'loctvl842/monokai-pro.nvim',
-- lazy = true,
priority = 999,
config = function()
require('monokai-pro').setup({
filter = 'spectrum',
})
vim.cmd.colorscheme('monokai-pro')
end,
},
}

View File

@@ -0,0 +1,20 @@
return {
-- Highlighting
{
'nvim-treesitter/nvim-treesitter',
config = function()
vim.cmd('TSUpdate')
require('nvim-treesitter.configs').setup({
ensure_installed = { 'lua', 'markdown', 'typescript', 'javascript', 'rust', 'json', 'toml' },
highlight = {
enable = true,
},
auto_install = true,
-- additional_vim_regex_highlighting = true,
})
end,
},
}