nvim: add config files

This commit is contained in:
2026-01-17 21:17:29 +00:00
parent d1cf18299e
commit ecefe3b413
30 changed files with 923 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
return {
'habamax/vim-asciidoctor',
}

View File

@@ -0,0 +1,19 @@
ssh_client = os.getenv("SSH_CLIENT")
if ssh_client == nil or string.len(ssh_client) == 0 then
return {
"f-person/auto-dark-mode.nvim",
priority = 1100,
opts = {
update_interval = 1000,
set_dark_mode = function()
vim.cmd("colorscheme catppuccin-mocha")
end,
set_light_mode = function()
vim.cmd("colorscheme catppuccin-latte")
end,
},
}
else
return {}
end

View File

@@ -0,0 +1,98 @@
return {
"catppuccin/nvim",
lazy = false,
priority = 1000,
config = function()
require('catppuccin').setup {
flavour = "mocha", -- latte, frappe, macchiato, mocha
background = { -- :h background
light = "latte",
dark = "mocha",
},
transparent_background = false, -- disables setting the background color.
show_end_of_buffer = true, -- shows the '~' characters after the end of buffers
term_colors = true, -- sets terminal colors (e.g. `g:terminal_color_0`)
dim_inactive = {
enabled = true, -- dims the background color of inactive window
shade = "dark",
percentage = 0.15, -- percentage of the shade to apply to the inactive window
},
no_italic = true, -- Force no italic
no_bold = false, -- Force no bold
no_underline = false, -- Force no underline
styles = { -- Handles the styles of general hi groups (see `:h highlight-args`):
comments = { "italic" }, -- Change the style of comments
conditionals = {},
loops = {},
functions = { "italic" },
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = { "bold" },
operators = {},
},
color_overrides = {},
highlight_overrides = {
all = function(colors)
return {
DashboardHeader = { fg = colors.yellow },
DashboardHotkeyFiles = { fg = colors.flamingo },
DashboardHotkeyProjects = { fg = colors.lavender },
DashboardHotkeyNotes = { fg = colors.pink },
DashboardHotkeyDotfiles = { fg = colors.sapphire },
DashboardHotkeyNotifications = { fg = colors.peach },
DashboardHotkeyQuit = { fg = colors.red },
StorageClass = { fg = colors.lavender },
Structure = { fg = colors.lavender } ,
--Identifier = { fg = colors.yellow } ,
["@lsp.type.class.c"] = { fg = colors.yellow },
["@lsp.type.class.cpp"] = { fg = colors.yellow },
["@lsp.type.enum.c"] = { fg = colors.yellow },
["@lsp.type.enum.cpp"] = { fg = colors.yellow },
["@lsp.type.macro.c"] = { fg = colors.peach },
["@lsp.type.macro.cpp"] = { fg = colors.peach },
["@function.builtin"] = { fg = colors.blue },
["@property"] = { fg = colors.rosewater },
PreProc = { fg = colors.mauve },
}
end,
mocha = function(colors)
return {
String = { fg = colors.green, bg = '#292a36' },
Special = { fg = colors.red, bg = '#292a36' },
CursorLineNr = { fg = colors.lavender, bg = '#2a2b3c' }
}
end,
latte = function(colors)
return {
--String = { fg = colors.green, bg = '#d9f3da' },
--Special = { fg = colors.red, bg = '#d9f3da' },
CursorLineNr = { fg = colors.lavender, bg = '#dce4f7' }
}
end
},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
treesitter = true,
notify = true,
hop = true,
noice = true,
telescope = {
enabled = true,
},
mini = {
enabled = true,
indentscope_color = "",
},
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
}
vim.cmd([[colorscheme catppuccin]])
end,
}

View File

@@ -0,0 +1,75 @@
return {
'nvimdev/dashboard-nvim',
-- event = 'VimEnter',
config = function()
require('dashboard').setup {
theme = 'hyper',
config = {
week_header = {
enable = false,
},
packages = {
enable = false,
},
--header = {
-- " __ _ ",
-- " /\\ \\ \\__ _(_)_ __ ___ ",
-- " / \\/ /\\ \\ / / | '_ ` _ \\ ",
-- "/ /\\ / \\ V /| | | | | | |",
-- "\\_\\ \\/ \\_/ |_|_| |_| |_|",
-- "==================================",
-- "on " .. vim.fn.hostname(),
-- ""
--},
header = {
" ___ __ __ ",
" / | / /____/ /_ ___ ____ ___ __ __",
" / /| | / / ___/ __ \\/ _ \\/ __ `__ \\/ / / /",
" / ___ |/ / /__/ / / / __/ / / / / / /_/ / ",
"/_/ |_/_/\\___/_/ /_/\\___/_/ /_/ /_/\\__, / ",
" Nvim /____/ ",
"............................................",
"on " .. vim.fn.hostname(),
""
},
shortcut = {
{
desc = ' Files',
action = 'Telescope find_files',
group = 'DashboardHotkeyFiles',
key = 'f',
},
{
desc = ' Projects',
group = 'DashboardHotkeyProjects',
action = 'Telescope projects',
key = 'p',
},
{
desc = ' Notes',
group = 'DashboardHotkeyNotes',
action = 'SearchNotes',
key = 'n',
},
{
desc = ' dotfiles',
group = 'DashboardHotkeyDotfiles',
action = 'SearchDotfiles',
key = 'd',
},
{
desc = ' Quit',
group = 'DashboardHotkeyQuit',
action = 'q',
key = 'q',
},
}
},
}
end,
dependencies = {
'nvim-tree/nvim-web-devicons',
'nvim-telescope/telescope.nvim',
}
}

9
nvim/lua/plugins/dev.lua Normal file
View File

@@ -0,0 +1,9 @@
return {
{
dir = '~/projects/ivy/ivy.vim'
},
{
dir = '~/projects/mie/mie.vim'
}
}

12
nvim/lua/plugins/hop.lua Normal file
View File

@@ -0,0 +1,12 @@
return {
'phaazon/hop.nvim',
config = function()
local hop = require('hop')
hop.setup {
keys = 'asdfweq'
}
vim.keymap.set('n', 'W', hop.hint_words, {})
vim.keymap.set('n', 'L', hop.hint_lines, {})
end
}

View File

@@ -0,0 +1,3 @@
return {
'b1narykid/llvm.vim'
}

View File

@@ -0,0 +1,229 @@
local cmp_kinds = {
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 border = {
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
}
function show_diagnostic()
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
if vim.api.nvim_win_get_config(winid).zindex then
return
end
end
-- THIS IS FOR BUILTIN LSP
vim.diagnostic.open_float(0, {
scope = "cursor",
focusable = false,
close_events = {
"CursorMoved",
"CursorMovedI",
"BufHidden",
"InsertCharPre",
"WinLeave",
},
})
end
local has_words_before = function()
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
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
return {
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
lazy = true,
config = false,
init = function()
vim.g.lsp_zero_extend_cmp = 0
vim.g.lsp_zero_extend_lspconfig = 0
end,
},
{
'williamboman/mason.nvim',
lazy = false,
config = true
},
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'L3MON4D3/LuaSnip',
'hrsh7th/cmp-vsnip',
'hrsh7th/vim-vsnip',
'onsails/lspkind.nvim',
'hrsh7th/cmp-nvim-lsp-signature-help'
},
config = function()
local lsp_zero = require('lsp-zero')
lsp_zero.extend_cmp()
local cmp = require('cmp')
local cmp_action = lsp_zero.cmp_action()
cmp.setup {
--formatting = lsp_zero.cmp_format({ details = true }),
formatting = {
fields = { 'kind', 'abbr', 'menu' },
format = function(entry, vim_item)
local lspkind = require('lspkind')
local kind = 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,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'neorg' },
{ name = 'nvim_lsp_signature_help' }
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
["<TAB>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
--elseif has_words_before() then
-- cmp.complete()
else
fallback()
end
end, { "i", "s" }),
['<S-TAB>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
else
fallback()
end
end, { "i", "s" }),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }),
}),
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
sorting = {
comparators = {
cmp.config.compare.length,
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.order,
},
},
}
end
},
{
'neovim/nvim-lspconfig',
cmp = { 'LspInfo', 'LspInstall', 'LspStart' },
event = { 'BufReadPre', 'BufNewFile' },
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'williamboman/mason-lspconfig.nvim'
},
config = function()
local lsp_zero = require('lsp-zero')
lsp_zero.extend_lspconfig()
lsp_zero.on_attach(function(client, bufnr)
lsp_zero.default_keymaps({ bufnr = bufnr })
end)
local util = require('lspconfig.util')
local capabilities = vim.tbl_deep_extend(
'force',
vim.lsp.protocol.make_client_capabilities(),
require('cmp_nvim_lsp').default_capabilities()
)
capabilities.workspace.didChangeWatchedFiles.dynamicRegistration = false
vim.lsp.enable('clangd')
vim.lsp.config('clangd', {
root_dir = util.root_pattern('build'),
capabilities = capabilities,
init_options = {
compilationDatabasePath = './build',
highlight = {
lsRanges = true
}
}
})
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
callback = function (args)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = args.buf,
callback = function ()
vim.lsp.buf.format { async = false, id = args.data.client_id }
end,
})
vim.api.nvim_create_autocmd("CursorHold", {
pattern = '*',
callback = show_diagnostic
})
end
})
end
}
}

View File

@@ -0,0 +1,9 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = {
'nvim-tree/nvim-web-devicons'
},
config = function()
require('lualine').setup()
end
}

View File

@@ -0,0 +1,55 @@
return {
"nvim-neorg/neorg",
lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
version = "*", -- Pin Neorg to the latest stable release
config = function()
local neorg = require("neorg")
neorg.setup {
load = {
["core.defaults"] = {},
["core.esupports.indent"] = {
config = {
tweaks = {
heading2 = 1,
heading3 = 2,
heading4 = 3,
heading5 = 4,
heading6 = 5,
unordered_list2 = 1,
unordered_list3 = 2,
unordered_list4 = 3,
unordered_list5 = 4,
unordered_list6 = 5,
ordered_list2 = 1,
ordered_list3 = 2,
ordered_list4 = 3,
ordered_list5 = 4,
ordered_list6 = 5,
paragraph_segment = 1,
}
}
},
["core.concealer"] = {
config = {
icons = {
code_block = {
conceal = true,
padding = {
left = 2,
right = 2,
},
width = 80,
},
},
},
},
}
}
--vim.keymap.set('n', 'N', function() vim.cmd(':e ~/notes/index.norg') end, {})
end,
}

View File

@@ -0,0 +1,85 @@
return {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'L3MON4D3/LuaSnip',
'hrsh7th/cmp-vsnip',
'hrsh7th/vim-vsnip',
'hrsh7th/cmp-nvim-lsp',
'onsails/lspkind.nvim',
'hrsh7th/cmp-nvim-lsp-signature-help'
},
config = function()
local cmp = require('cmp')
cmp.setup {
formatting = {
fields = { 'kind', 'abbr', 'menu' },
format = function(entry, vim_item)
local lspkind = require('lspkind')
local kind = 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,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'neorg' },
{ name = 'nvim_lsp_signature_help' }
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
--['<C-f>'] = cmp_action.luasnip_jump_forward(),
--['<C-b>'] = cmp_action.luasnip_jump_backward(),
["<TAB>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
--elseif has_words_before() then
-- cmp.complete()
else
fallback()
end
end, { "i", "s" }),
['<S-TAB>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
else
fallback()
end
end, { "i", "s" }),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }),
}),
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
sorting = {
comparators = {
cmp.config.compare.length,
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.order,
},
},
}
end
}

View File

@@ -0,0 +1,20 @@
return {
'ahmedkhalf/project.nvim',
config = function()
local project_nvim = require('project_nvim')
project_nvim.setup {
manual_mode = false,
detection_methods = { 'pattern' },
theme = 'ivy',
patterns = {
'>projects',
'.git',
}
}
local telescope = require('telescope')
telescope.load_extension('projects')
vim.keymap.set('n', 'fp', telescope.extensions.projects.projects, { desc = 'Find Projects' })
end
}

4
nvim/lua/plugins/pug.lua Normal file
View File

@@ -0,0 +1,4 @@
return {
'digitaltoad/vim-pug',
}

View File

@@ -0,0 +1,79 @@
local init = function()
local telescope = require('telescope')
local themes = require('telescope.themes')
local actions = require('telescope.actions')
telescope.setup {
defaults = themes.get_ivy {
file_ignore_pattern = { 'build', '.cache', '.ccls*' },
sorting_strategy = 'ascending',
preview = false,
layout_config = {
horizontal = {
prompt_position = 'top',
},
},
},
pickers = {
find_files = {
find_command = { 'rg', '--ignore', '-L', '--files' },
theme = 'ivy',
mappings = {
i = {
['<esc>'] = actions.close,
['<C-e>'] = { '<esc>', type = 'command' }
}
}
},
}
}
local builtin = require('telescope.builtin')
vim.api.nvim_create_user_command(
'SearchDotfiles',
function(opts)
builtin.find_files({ cwd = '~/.config/nvim' })
end,
{})
vim.api.nvim_create_user_command(
'SearchNotes',
function(opts)
builtin.find_files({ cwd = '~/notes' })
end,
{})
vim.keymap.set('n', 'ff', builtin.find_files, {})
vim.keymap.set('n', 'fd', function() vim.cmd('SearchDotfiles') end, {})
vim.keymap.set('n', 'fn', function() vim.cmd('SearchNotes') end, {})
vim.keymap.set('n', 'fb', function() vim.cmd('Telescope buffers') end, {})
vim.keymap.set('n', 'fs', function() vim.cmd('Telescope lsp_dynamic_workspace_symbols') end, {})
end
return {
{
'nvim-telescope/telescope.nvim',
tag = '0.1.8',
priority = 1000,
dependencies = {
'nvim-lua/plenary.nvim'
},
config = init
},
{
'kelly-lin/telescope-ag',
dependencies = {
'nvim-telescope/telescope.nvim'
},
config = function()
local telescope_ag = require('telescope-ag')
telescope_ag.setup({
cmd = telescope_ag.cmds.ag,
})
local telescope = require('telescope')
telescope.load_extension("ag")
end
}
}

View File

@@ -0,0 +1,3 @@
return {
'edkolev/tmuxline.vim'
}

View File

@@ -0,0 +1,30 @@
function _G.set_terminal_keymaps()
local opts = {buffer = 0}
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
end
return {
'akinsho/toggleterm.nvim',
config = function()
require('toggleterm').setup{
direction = 'float',
float_opts = {
border = 'single',
width = 80,
height = 25,
row = 2,
col = 2,
winblend = 3,
title_pos = 'right'
},
}
vim.keymap.set('n', 't', function() vim.cmd('ToggleTerm') end, {})
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
end
}

View File

@@ -0,0 +1,14 @@
return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
local configs = require('nvim-treesitter.configs')
configs.setup {
ensure_installed = { 'c', 'cpp', 'lua', 'vimdoc', 'luadoc', 'vim', 'markdown' },
sync_install = false,
highlight = { enable = true },
indent = { enable = false }
}
end
}