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,4 @@
setlocal shiftwidth=8
setlocal tabstop=8
set cinoptions+=g0

View File

@@ -0,0 +1,3 @@
setlocal expandtab
setlocal softtabstop=2
setlocal shiftwidth=2

View File

@@ -0,0 +1,2 @@
setlocal shiftwidth=4
setlocal tabstop=4

View File

@@ -0,0 +1,3 @@
setlocal expandtab
setlocal softtabstop=2
setlocal shiftwidth=2

6
nvim/init.lua Normal file
View File

@@ -0,0 +1,6 @@
require("config.globals")
require("config.lazy")
require("config.autocmd")
require("config.misc")
require("config.lsp")
require("config.keybinds")

31
nvim/lazy-lock.json Normal file
View File

@@ -0,0 +1,31 @@
{
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
"auto-dark-mode.nvim": { "branch": "master", "commit": "e300259ec777a40b4b9e3c8e6ade203e78d15881" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "fd3e882e56956675c620898bf1ffcf4fcbe7ec84" },
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
"hop.nvim": { "branch": "master", "commit": "1a1eceafe54b5081eae4cb91c723abd1d450f34b" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"llvm.vim": { "branch": "master", "commit": "0c5a25b1d79c939955e3fa52b086d0318b891b2b" },
"lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
"lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"neorg": { "branch": "main", "commit": "408fc04013a95da8f217cb0958a06b6a77c01743" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
"nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" },
"pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"telescope-ag": { "branch": "main", "commit": "7d25064da3c7689461bcfa89ad1f08548415193d" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"tmuxline.vim": { "branch": "master", "commit": "4119c553923212cc67f4e135e6f946dc3ec0a4d6" },
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
"vim-asciidoctor": { "branch": "master", "commit": "d45364d662489e0ffcad0e2bc6f41c859ba58799" },
"vim-pug": { "branch": "master", "commit": "ea39cd942cf3194230cf72bfb838901a5344d3b3" },
"vim-vsnip": { "branch": "master", "commit": "9bcfabea653abdcdac584283b5097c3f8760abaa" }
}

5
nvim/lsp/clangd.lua Normal file
View File

@@ -0,0 +1,5 @@
return {
cmd = { 'clangd' },
filetypes = { 'c', 'h', 'cpp', 'cc', 'hpp', 'm' },
root_markers = { 'build/' },
}

View File

@@ -0,0 +1,5 @@
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*" },
command = "%s/\\s\\+$//e"
})

View File

@@ -0,0 +1,7 @@
vim.opt.updatetime = 750
vim.opt.colorcolumn = "80"
vim.opt.conceallevel = 2
vim.opt.nuw = 6
vim.opt.number = true
vim.opt.cursorline = true
vim.opt.cursorlineopt = "number"

View File

@@ -0,0 +1,31 @@
-- Set leader key to Space
vim.g.mapleader = ' '
-- When lsp-signature (or any other vsnip snippet) is active, press TAB to jump
-- to the next placehol
--imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
--smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
--imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
--smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
-- Map semicolon to colon, so you don't have to press shift to enter commands
vim.keymap.set('n', ';', ':')
-- Map shift-space to underscore
--vim.keymap.set('i', '<S-Space>', '_')
vim.keymap.set('n', 'H', function() vim.cmd('wincmd h') end, { remap = true })
vim.keymap.set('n', 'J', function() vim.cmd('wincmd j') end, { remap = true })
vim.keymap.set('n', 'K', function() vim.cmd('wincmd k') end, { remap = true })
vim.keymap.set('n', 'L', function() vim.cmd('wincmd l') end, { remap = true })
vim.keymap.set('n', '<C-h>', function() vim.cmd('vertical resize -1') end, {})
vim.keymap.set('n', '<C-j>', function() vim.cmd('horizontal resize -1') end, {})
vim.keymap.set('n', '<C-k>', function() vim.cmd('horizontal resize +1') end, {})
vim.keymap.set('n', '<C-l>', function() vim.cmd('vertical resize +1') end, {})
--nmap <silent> <C-t> :ToggleTerm<CR>
--imap <silent> <C-t> :ToggleTerm<CR>
--nmap <silent> t :ToggleTerm<CR>

35
nvim/lua/config/lazy.lua Normal file
View File

@@ -0,0 +1,35 @@
-- 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
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- 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 = true },
})

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

@@ -0,0 +1,43 @@
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
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
})
vim.lsp.enable('clangd')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
vim.lsp.config('clangd', {
capabilities = capabilities
})

1
nvim/lua/config/misc.lua Normal file
View File

@@ -0,0 +1 @@
vim.cmd('syntax sync minlines=20')

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
}