feat(nvim): use loaded, plugin format

This commit is contained in:
Price Hiller 2022-08-02 01:27:57 -05:00
parent a3c3656a91
commit b136610a22
25 changed files with 415 additions and 327 deletions

View File

@ -1,49 +1,53 @@
local cmp = require('cmp')
local types = require('cmp.types')
local str = require('cmp.utils.str')
local loaded, cmp = pcall(require, "cmp")
if not loaded then
return
end
local types = require("cmp.types")
local str = require("cmp.utils.str")
local compare = cmp.config.compare
local luasnip = require('luasnip')
local luasnip = require("luasnip")
local 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 = '',
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 = "",
}
-- Load Snippets
require('luasnip.loaders.from_vscode').lazy_load()
require("luasnip.loaders.from_vscode").lazy_load()
local border = {
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ '', 'CmpBorder' },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
{ "", "CmpBorder" },
}
cmp.setup({
@ -65,32 +69,33 @@ cmp.setup({
local max = 50
if string.len(word) >= max then
local before = string.sub(word, 1, math.floor((max - 3) / 2))
word = before .. '...'
word = before .. "..."
end
if entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet
and string.sub(vim_item.abbr, -1, -1) == '~'
if
entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet
and string.sub(vim_item.abbr, -1, -1) == "~"
then
word = word .. '~'
word = word .. "~"
end
vim_item.abbr = word
-- Kind icons
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
-- Source
vim_item.menu = ({
fuzzy_buffer = '[Buffer]',
nvim_lsp = '[Lsp]',
luasnip = '[LuaSnip]',
path = '[Path]',
calc = '[Calculator]',
neorg = '[Neorg]',
emoji = '[Emoji]',
zsh = '[Zsh]',
crates = '[Crates]',
cmdline_history = '[Cmd History]',
rg = '[Ripgrep]',
npm = '[Npm],',
conventionalcommits = '[Commit]',
fuzzy_buffer = "[Buffer]",
nvim_lsp = "[Lsp]",
luasnip = "[LuaSnip]",
path = "[Path]",
calc = "[Calculator]",
neorg = "[Neorg]",
emoji = "[Emoji]",
zsh = "[Zsh]",
crates = "[Crates]",
cmdline_history = "[Cmd History]",
rg = "[Ripgrep]",
npm = "[Npm],",
conventionalcommits = "[Commit]",
})[entry.source.name]
return vim_item
end,
@ -110,41 +115,41 @@ cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
['<C-Tab>'] = cmp.mapping(function(fallback)
["<CR>"] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-Tab>"] = cmp.mapping(function(fallback)
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<C-S-Tab>'] = cmp.mapping(function(fallback)
end, { "i", "s" }),
["<C-S-Tab>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
['<Tab>'] = cmp.mapping(function(fallback)
end, { "i", "s" }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
@ -152,21 +157,21 @@ cmp.setup({
else
fallback()
end
end, { 'i', 's' }),
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp', priority = 10 },
{ name = 'luasnip', priority = 9 }, -- For luasnip users.
{ name = 'fuzzy_buffer', priority = 8 },
{ name = 'rg', priority = 7 },
{ name = 'path', priority = 6 },
{ name = 'zsh', priority = 5 },
{ name = 'emoji', keyword_length = 2 },
{ name = 'neorg' },
{ name = 'calc' },
{ name = 'npm', keyword_length = 2 },
{ name = "nvim_lsp", priority = 10 },
{ name = "luasnip", priority = 9 }, -- For luasnip users.
{ name = "fuzzy_buffer", priority = 8 },
{ name = "rg", priority = 7 },
{ name = "path", priority = 6 },
{ name = "zsh", priority = 5 },
{ name = "emoji", keyword_length = 2 },
{ name = "neorg" },
{ name = "calc" },
{ name = "npm", keyword_length = 2 },
{
name = 'dictionary',
name = "dictionary",
keyword_length = 2,
},
}),
@ -176,7 +181,7 @@ cmp.setup({
compare.offset,
compare.recently_used,
compare.exact,
require('cmp_fuzzy_buffer.compare'),
require("cmp_fuzzy_buffer.compare"),
compare.kind,
compare.sort_text,
compare.length,
@ -186,55 +191,55 @@ cmp.setup({
})
-- Git Commit Completions
cmp.setup.filetype('gitcommit', {
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = 'conventionalcommits', priority = 20 },
{ name = "conventionalcommits", priority = 20 },
}),
})
cmp.setup.filetype('NeogitCommitMesssage', {
cmp.setup.filetype("NeogitCommitMesssage", {
sources = cmp.config.sources({
{ name = 'conventionalcommits', priority = 20 },
{ name = "conventionalcommits", priority = 20 },
}),
})
cmp.setup.filetype('toml', {
cmp.setup.filetype("toml", {
sources = cmp.config.sources({
{ name = 'crates' },
{ name = "crates" },
}),
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'fuzzy_buffer' },
{ name = 'cmdline_history' },
{ name = "fuzzy_buffer" },
{ name = "cmdline_history" },
}),
})
cmp.setup.cmdline('?', {
cmp.setup.cmdline("?", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'fuzzy_buffer' },
{ name = 'cmdline_history' },
{ name = "fuzzy_buffer" },
{ name = "cmdline_history" },
}),
})
cmp.setup.cmdline('@', {
cmp.setup.cmdline("@", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'fuzzy_buffer' },
{ name = 'cmdline_history' },
{ name = "fuzzy_buffer" },
{ name = "cmdline_history" },
}),
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
{ name = 'cmdline' },
{ name = 'cmdline_history' },
{ name = "path" },
{ name = "cmdline" },
{ name = "cmdline_history" },
}),
})

View File

@ -1,41 +1,44 @@
local dap = require('dap')
local async = require('plenary.async')
local loaded, dap = pcall(require, "dap")
if not loaded then
return
end
local async = require("plenary.async")
--- Gets a path for a given program in the environment
---@param program @The string of a program in the PATH
---@return @The full path to the program if found, or nil if not
local function get_program_path(program)
local home = os.getenv('HOME')
local program_path = home .. '/.local/share/nvim/mason/packages/' .. program .. '/' .. program
local home = os.getenv("HOME")
local program_path = home .. "/.local/share/nvim/mason/packages/" .. program .. "/" .. program
return program_path
end
local lldb_path = get_program_path('lldb-vscode')
local lldb_path = get_program_path("lldb-vscode")
-- Adapaters
dap.adapters.lldb = {
type = 'executable',
type = "executable",
command = lldb_path,
name = 'lldb',
name = "lldb",
}
dap.adapters.coreclr = {
type = 'executable',
command = get_program_path('netcoredbg'),
args = { '--interpreter=vscode' },
type = "executable",
command = get_program_path("netcoredbg"),
args = { "--interpreter=vscode" },
}
-- configurations
dap.configurations.cpp = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = '${workspaceFolder}',
cwd = "${workspaceFolder}",
stopOnEntry = false,
targetArchitecture = 'arm64',
targetArchitecture = "arm64",
args = {},
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
@ -57,11 +60,11 @@ dap.configurations.rust = dap.configurations.cpp
dap.configurations.cs = {
{
type = 'coreclr',
name = 'launch - netcoredbg',
request = 'launch',
type = "coreclr",
name = "launch - netcoredbg",
request = "launch",
program = function()
return vim.fn.input('Path to dll: ', vim.fn.getcwd() .. '/bin/Debug/', 'file')
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/bin/Debug/", "file")
end,
},
}

View File

@ -1,3 +1,7 @@
require('neoclip').setup({
local neoclip = pcall(require, "neoclip")
if not neoclip then
return
end
neoclip.setup({
enable_persistent_history = true,
})

View File

@ -1,49 +1,52 @@
local neorg = require('neorg')
local loaded, neorg = pcall(require, "neorg")
if not loaded then
return
end
neorg.setup({
load = {
['core.defaults'] = {},
['core.norg.concealer'] = {},
['core.norg.esupports.metagen'] = {
["core.defaults"] = {},
["core.norg.concealer"] = {},
["core.norg.esupports.metagen"] = {
config = {
type = 'auto',
type = "auto",
},
},
['core.integrations.nvim-cmp'] = {
["core.integrations.nvim-cmp"] = {
config = {},
},
['core.norg.completion'] = {
["core.norg.completion"] = {
config = {
engine = 'nvim-cmp',
engine = "nvim-cmp",
},
},
['core.keybinds'] = {
["core.keybinds"] = {
config = {
default_keybinds = true,
-- norg_leader = "-"
},
},
['core.norg.dirman'] = {
["core.norg.dirman"] = {
config = {
workspaces = {
default = '~/.notes', -- Format: <name_of_workspace> = <path_to_workspace_root>
default = "~/.notes", -- Format: <name_of_workspace> = <path_to_workspace_root>
},
autochdir = true, -- Automatically change the directory to the current workspace's root every time
index = 'index.norg', -- The name of the main (root) .norg file
last_workspace = vim.fn.stdpath('cache') .. '/neorg_last_workspace.txt', -- The location to write and read the workspace cache file
index = "index.norg", -- The name of the main (root) .norg file
last_workspace = vim.fn.stdpath("cache") .. "/neorg_last_workspace.txt", -- The location to write and read the workspace cache file
},
},
['core.integrations.telescope'] = {},
['core.norg.qol.toc'] = {},
['core.gtd.base'] = {
["core.integrations.telescope"] = {},
["core.norg.qol.toc"] = {},
["core.gtd.base"] = {
config = {
workspace = 'default',
workspace = "default",
},
},
['core.gtd.ui'] = {
["core.gtd.ui"] = {
config = {},
},
['core.gtd.helpers'] = {
["core.gtd.helpers"] = {
config = {},
},
},

View File

@ -1,18 +1,22 @@
require('stabilize').setup({
local loaded, stabilize = pcall(require, "stabilize")
if not loaded then
return
end
stabilize.setup({
-- stabilize window even when current cursor position will be hidden behind new window
force = true,
-- set context mark to register on force event which can be jumped to with '<forcemark>
forcemark = nil,
-- do not manage windows matching these file/buftypes
ignore = {
filetype = { 'packer', 'Dashboard', 'Trouble', 'TelescopePrompt' },
filetype = { "packer", "Dashboard", "Trouble", "TelescopePrompt" },
buftype = {
'packer',
'Dashboard',
'terminal',
'quickfix',
'loclist',
'LspInstall',
"packer",
"Dashboard",
"terminal",
"quickfix",
"loclist",
"LspInstall",
},
},
-- comma-separated list of autocmds that wil trigger the plugins window restore function

View File

@ -1,7 +0,0 @@
-- Load Animations
require('wlanimation')
-- Load a line (these include setup)
require('wlsample.bubble2')
-- In the future I may want to implement
-- my own, for now much too lazy for that

View File

@ -1,79 +1,82 @@
local alpha = require('alpha')
local startify = require('alpha.themes.startify')
local dashboard = require('alpha.themes.dashboard')
local loaded, alpha = pcall(require, "alpha")
if not loaded then
return
end
local startify = require("alpha.themes.startify")
local dashboard = require("alpha.themes.dashboard")
-- Set header
local header = {
type = 'text',
type = "text",
val = {
' ',
' ',
' ',
' ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ',
' ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ',
' ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ',
' ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ',
' ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ',
' ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ',
' ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ',
' ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ',
' ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ',
' ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ',
' ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ',
' ',
" ",
" ",
" ",
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
" ",
},
opts = {
position = 'center',
hl = 'Function',
position = "center",
hl = "Function",
},
}
-- Subheader, plugin count
local get_plugins = function()
local num_plugins_loaded = #vim.fn.globpath(vim.fn.stdpath('data') .. '/site/pack/packer/start', '*', 0, 1)
local num_plugins_loaded = #vim.fn.globpath(vim.fn.stdpath("data") .. "/site/pack/packer/start", "*", 0, 1)
local num_plugins_total = #vim.tbl_keys(packer_plugins)
if num_plugins_total <= 1 then
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugin  loaded'
return num_plugins_loaded .. " / " .. num_plugins_total .. " plugin  loaded"
else
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugins  loaded'
return num_plugins_loaded .. " / " .. num_plugins_total .. " plugins  loaded"
end
end
local plugin_count = {
type = 'text',
type = "text",
val = {
get_plugins(),
},
opts = {
hl = 'Comment',
position = 'center',
hl = "Comment",
position = "center",
},
}
-- Menu
local button = function(sc, txt, keybind)
local sc_ = sc:gsub('%s', ''):gsub('SPC', '<leader>')
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
local opts = {
position = 'center',
position = "center",
text = txt,
shortcut = sc,
cursor = 4,
width = 30,
align_shortcut = 'right',
hl_shortcut = 'Number',
hl = 'Function',
align_shortcut = "right",
hl_shortcut = "Number",
hl = "Function",
}
if keybind then
opts.keymap = { 'n', sc_, keybind, { noremap = true, silent = true } }
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
end
return {
type = 'button',
type = "button",
val = txt,
on_press = function()
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
vim.api.nvim_feedkeys(key, 'normal', false)
vim.api.nvim_feedkeys(key, "normal", false)
end,
opts = opts,
}
@ -81,14 +84,14 @@ end
-- Set menu
local buttons = {
type = 'group',
type = "group",
val = {
button('e', ' New File', ':ene <BAR> startinsert <CR>'),
button('f', ' Find File', ':Telescope find_files<CR>'),
button('r', ' Recent', ':Telescope oldfiles<CR>'),
button('s', ' Settings', ':e ~/.config/nvim/<CR>'),
button('u', ' Update Plugins', ':PackerSync<CR>'),
button('q', ' Quit', ':qa<CR>'),
button("e", " New File", ":ene <BAR> startinsert <CR>"),
button("f", " Find File", ":Telescope find_files<CR>"),
button("r", " Recent", ":Telescope oldfiles<CR>"),
button("s", " Settings", ":e ~/.config/nvim/<CR>"),
button("u", " Update Plugins", ":PackerSync<CR>"),
button("q", " Quit", ":qa<CR>"),
},
opts = {
spacing = 0,
@ -97,16 +100,16 @@ local buttons = {
-- Footer 2, fortune
local fortune = {
type = 'text',
val = require('alpha.fortune')(),
type = "text",
val = require("alpha.fortune")(),
opts = {
position = 'center',
hl = 'Comment',
position = "center",
hl = "Comment",
},
}
local padding = function()
return { type = 'padding', val = 4 }
return { type = "padding", val = 4 }
end
local opts = {
layout = {
@ -126,8 +129,8 @@ local opts = {
-- Send config to alpha
alpha.setup(opts)
vim.api.nvim_create_autocmd('FileType', {
pattern = 'alpha',
vim.api.nvim_create_autocmd("FileType", {
pattern = "alpha",
callback = function()
vim.opt_local.cursorline = false
end,

View File

@ -1,17 +1,20 @@
local bufferline = require('bufferline')
local loaded, bufferline = pcall(require, "bufferline")
if not loaded then
return
end
bufferline.setup({
options = {
numbers = function(opts)
return string.format('%s', opts.id)
return string.format("%s", opts.id)
end,
diagnostics = 'nvim_lsp',
diagnostics = "nvim_lsp",
offsets = {
{
filetype = 'NvimTree',
text = 'File Explorer',
highlight = 'Directory',
text_align = 'left',
filetype = "NvimTree",
text = "File Explorer",
highlight = "Directory",
text_align = "left",
},
},
},

View File

@ -1,10 +0,0 @@
-- Alias for vim.g
local g = vim.g
-- Run COQ on open
g.coq_settings = {
auto_start = 'shut-up',
limits = {
completion_manual_timeout = 2000,
},
}

View File

@ -1,9 +1,13 @@
local fn = vim.fn
require('dapui').setup({})
local loaded, dapui = pcall(require, "dapui")
if not loaded then
return
end
dapui.setup({})
fn.sign_define('DapBreakpoint', { text = '', texthl = 'DiagnosticSignError', linehl = '', numhl = '' })
fn.sign_define('DapBreakpointCondition', { text = '', texthl = 'DiagnosticSignWarn', linehl = '', numhl = '' })
fn.sign_define('DapLogPoint', { text = '', texthl = 'DiagnosticSignInfo', linehl = '', numhl = '' })
fn.sign_define('DapStopped', { text = '', texthl = 'DiagnosticSignWarn', linehl = '', numhl = '' })
fn.sign_define('DapBreakpointReject', { text = '', texthl = 'DiagnosticSignHint', linehl = '', numhl = '' })
fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
fn.sign_define("DapBreakpointCondition", { text = "", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" })
fn.sign_define("DapLogPoint", { text = "", texthl = "DiagnosticSignInfo", linehl = "", numhl = "" })
fn.sign_define("DapStopped", { text = "", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" })
fn.sign_define("DapBreakpointReject", { text = "", texthl = "DiagnosticSignHint", linehl = "", numhl = "" })

View File

@ -1,5 +1,13 @@
local colors = require('tokyonight.colors').setup()
require('scrollbar').setup({
local loaded, colors = pcall(require, "kanagawa.colors")
if not loaded then
return
end
local loaded, scrollbar = pcall(require, "scrollbar")
if not loaded then
return
end
scrollbar.setup({
handle = {
color = colors.bg_highlight,
},

View File

@ -1,8 +1,11 @@
local fidget = require('fidget')
local loaded, fidget = pcall(require, "fidget")
if not loaded then
return
end
fidget.setup({
text = {
spinner = 'dots',
spinner = "dots",
},
window = {
blend = 0,

View File

@ -1,4 +1,7 @@
local nvim_tree = require('nvim-tree.configs')
local loaded, nvim_tree = pcall(require, "nvim-tree.configs")
if not loaded then
return
end
nvim_tree.setup({
highlight = {
@ -6,7 +9,7 @@ nvim_tree.setup({
additional_vim_regex_highlighting = true,
disable = {
-- Ansible support reasons
'ansible.yaml',
"ansible.yaml",
},
},
matchup = {

View File

@ -1,26 +1,29 @@
local hydra = require('hydra')
local loaded, hydra = pcall(require, "hydra")
if not loaded then
return
end
-- Side Scroll
hydra({
name = 'Side scroll',
name = "Side scroll",
config = {
{
position = 'bottom-right',
border = 'rounded',
position = "bottom-right",
border = "rounded",
},
},
mode = 'n',
body = 'z',
mode = "n",
body = "z",
heads = {
{ 'h', '5zh' },
{ 'l', '5zl', { desc = '←/→' } },
{ 'H', 'zH' },
{ 'L', 'zL', { desc = 'half screen ←/→' } },
{ "h", "5zh" },
{ "l", "5zl", { desc = "←/→" } },
{ "H", "zH" },
{ "L", "zL", { desc = "half screen ←/→" } },
},
})
-- Git Integration
local gitsigns = require('gitsigns')
local gitsigns = require("gitsigns")
local hint = [[
_J_: next hunk _s_: stage hunk _d_: show deleted _b_: blame line
@ -33,11 +36,11 @@ local hint = [[
hydra({
hint = hint,
config = {
color = 'pink',
color = "pink",
invoke_on_body = true,
hint = {
position = 'bottom-right',
border = 'rounded',
position = "bottom-right",
border = "rounded",
},
on_enter = function()
vim.bo.modifiable = false
@ -50,68 +53,68 @@ hydra({
gitsigns.toggle_deleted(false)
end,
},
mode = { 'n', 'x' },
body = '<leader>G',
mode = { "n", "x" },
body = "<leader>G",
heads = {
{
'J',
"J",
function()
if vim.wo.diff then
return ']c'
return "]c"
end
vim.schedule(function()
gitsigns.next_hunk()
end)
return '<Ignore>'
return "<Ignore>"
end,
{ expr = true },
},
{
'K',
"K",
function()
if vim.wo.diff then
return '[c'
return "[c"
end
vim.schedule(function()
gitsigns.prev_hunk()
end)
return '<Ignore>'
return "<Ignore>"
end,
{ expr = true },
},
{ 's', ':Gitsigns stage_hunk<CR>', { silent = true } },
{ 'u', gitsigns.undo_stage_hunk },
{ 'S', gitsigns.stage_buffer },
{ 'p', gitsigns.preview_hunk },
{ 'd', gitsigns.toggle_deleted, { nowait = true } },
{ 'b', gitsigns.blame_line },
{ "s", ":Gitsigns stage_hunk<CR>", { silent = true } },
{ "u", gitsigns.undo_stage_hunk },
{ "S", gitsigns.stage_buffer },
{ "p", gitsigns.preview_hunk },
{ "d", gitsigns.toggle_deleted, { nowait = true } },
{ "b", gitsigns.blame_line },
{
'B',
"B",
function()
gitsigns.blame_line({ full = true })
end,
},
{ '/', gitsigns.show, { exit = true } }, -- show the base of the file
{ '<Enter>', '<cmd>Neogit<CR>', { exit = true } },
{ 'q', nil, { exit = true, nowait = true } },
{ "/", gitsigns.show, { exit = true } }, -- show the base of the file
{ "<Enter>", "<cmd>Neogit<CR>", { exit = true } },
{ "q", nil, { exit = true, nowait = true } },
},
})
-- Hydra to repeat expanding windows
hydra({
name = 'Window Sizing',
mode = 'n',
body = '<C-w>',
name = "Window Sizing",
mode = "n",
body = "<C-w>",
config = {
{
position = 'bottom-right',
border = 'rounded',
position = "bottom-right",
border = "rounded",
},
},
heads = {
{ '<', '2<C-w><' },
{ '>', '2<C-w>>', { desc = '←/→' } },
{ '+', '2<C-w>+' },
{ '-', '2<C-w>-', { desc = '↑/↓' } },
{ "<", "2<C-w><" },
{ ">", "2<C-w>>", { desc = "←/→" } },
{ "+", "2<C-w>+" },
{ "-", "2<C-w>-", { desc = "↑/↓" } },
},
})

View File

@ -1,24 +1,28 @@
local g = vim.g
g.indent_blankline_char = ''
g.indent_blankline_context_char = ''
g.indent_blankline_char = ""
g.indent_blankline_context_char = ""
-- Disable indent-blankline on these pages.
g.indent_blankline_filetype_exclude = {
'help',
'terminal',
'alpha',
'packer',
'lsp-installer',
'lspinfo',
'mason.nvim',
"help",
"terminal",
"alpha",
"packer",
"lsp-installer",
"lspinfo",
"mason.nvim",
}
g.indent_blankline_buftype_exclude = { 'terminal' }
g.indent_blankline_buftype_exclude = { "terminal" }
g.indent_blankline_show_trailing_blankline_indent = false
g.indent_blankline_show_first_indent_level = true
require('indent_blankline').setup({
local loaded, indent_blankline = pcall(require, "indent_blankline")
if not loaded then
return
end
indent_blankline.setup({
-- space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,

View File

@ -1,6 +1,42 @@
local mason_lspconfig = require("mason-lspconfig")
local lspconfig = require("lspconfig")
local async = require("plenary.async")
local loaded, mason_lspconfig = pcall(require, "mason-lspconfig")
if not loaded then
return
end
local lspconfig_loaded, lspconfig = pcall(require, "lspconfig")
if not lspconfig_loaded then
return
end
local plenary_loaded, async = pcall(require, "plenary.async")
if not plenary_loaded then
return
end
local cmp_nvim_lsp_loaded, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not cmp_nvim_lsp_loaded then
return
end
local rust_tools_loaded, rust_tools = pcall(require, "rust_tools")
if not rust_tools_loaded then
return
end
local lua_dev_loaded, lua_dev = pcall(require, "lua-dev")
if not lua_dev_loaded then
return
end
local sqls_loaded, sqls = pcall(require, "sqls")
if not sqls_loaded then
return
end
local chsarpls_extended_loaded, csharpls_extended = pcall(require, "csharpls_extended")
if not csharpls_extended_loaded then
return
end
-- NOTE: Keep this near top
mason_lspconfig.setup({
@ -18,7 +54,7 @@ local function on_attach(client, bufnr)
end)
end
local lsp_capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
local lsp_capabilities = cmp_nvim_lsp.update_capabilities(vim.lsp.protocol.make_client_capabilities())
local opts = {
capabilities = lsp_capabilities,
on_attach = on_attach,
@ -51,7 +87,7 @@ local rustopts = {
},
},
}
require("rust-tools").setup(rustopts)
rust_tools.setup(rustopts)
-- NOTE: ANSIBLE LSP
-- I use ansible a lot, define exceptions for servers that can use
@ -79,7 +115,7 @@ lspconfig.ansiblels.setup({
})
-- NOTE: LUA LSP
local luadev = require("lua-dev").setup({
local luadev = lua_dev.setup({
lspconfig = opts,
})
@ -88,7 +124,7 @@ lspconfig.sumneko_lua.setup(luadev)
-- NOTE: SQL LSP
lspconfig.sqls.setup({
on_attach = function(client, bufnr)
require("sqls").on_attach(client, bufnr)
sqls.on_attach(client, bufnr)
on_attach(client, bufnr)
end,
})
@ -157,7 +193,7 @@ lspconfig.yamlls.setup({
lspconfig.csharp_ls.setup({
handlers = {
["textDocument/definition"] = require("csharpls_extended").handler,
["textDocument/definition"] = csharpls_extended.handler,
},
capabilities = lsp_capabilities,
on_attach = on_attach,

View File

@ -1,4 +1,7 @@
local neotree = require('neo-tree')
local loaded, neotree = pcall(require, "neo-tree")
if not loaded then
return
end
vim.g.neo_tree_remove_legacy_commands = 1
neotree.setup({
@ -7,8 +10,8 @@ neotree.setup({
},
window = {
mappings = {
['/'] = 'noop',
['/'] = {},
["/"] = "noop",
["/"] = {},
},
},
})

View File

@ -1,9 +1,12 @@
local null_ls = require('null-ls')
local loaded, null_ls = pcall(require, "null-ls")
if not loaded then
return
end
null_ls.setup({
sources = {
null_ls.builtins.formatting.shfmt.with({
extra_args = { '-i 4' },
extra_args = { "-i 4" },
}),
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.code_actions.shellcheck,

View File

@ -1,3 +1,6 @@
local colorizer = require('colorizer')
local loaded, colorizer = pcall(require, "colorizer")
if not loaded then
return
end
colorizer.setup({})
vim.cmd('ColorizerAttachToBuffer')
vim.cmd("ColorizerAttachToBuffer")

View File

@ -1,6 +1,10 @@
require('notify').setup({
local loaded, notify = pcall(require, "notify")
if not loaded then
return
end
notify.setup({
-- Animation style (see below for details)
stages = 'fade_in_slide_out',
stages = "fade_in_slide_out",
-- Function called when a new window is opened, use for changing win settings/config
on_open = nil,
@ -9,26 +13,26 @@ require('notify').setup({
on_close = nil,
-- Render function for notifications. See notify-render()
render = 'default',
render = "default",
-- Default timeout for notifications
timeout = 5000,
-- For stages that change opacity this is treated as the highlight behind the window
-- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values
background_colour = '#000000',
background_colour = "#000000",
-- Minimum width for notification windows
minimum_width = 50,
-- Icons for the different levels
icons = {
ERROR = '',
WARN = '',
INFO = '',
DEBUG = '',
TRACE = '',
ERROR = "",
WARN = "",
INFO = "",
DEBUG = "",
TRACE = "",
},
})
vim.notify = require('notify')
vim.notify = require("notify")

View File

@ -1,3 +1,6 @@
local dap_python = require('dap-python')
dap_python.setup('~/.venvs/debugpy/bin/python')
dap_python.test_runner = 'pytest'
local loaded, dap_python = pcall(require, "dap-python")
if not loaded then
return
end
dap_python.setup("~/.venvs/debugpy/bin/python")
dap_python.test_runner = "pytest"

View File

@ -1,4 +1,7 @@
local telescope = require("telescope")
local loaded, telescope = pcall(require, "telescope")
if not loaded then
return
end
local actions = require("telescope.actions")
telescope.setup({

View File

@ -1 +1,5 @@
require('todo-comments').setup({})
local loaded, todo_comments = pcall(require, "todo-comments")
if not loaded then
return
end
todo_comments.setup({})

View File

@ -1,7 +0,0 @@
local g = vim.g
g.tokyonight_style = 'night'
g.tokyonight_transparent = true
g.tokyonight_transparent_sidebar = true
vim.cmd('colorscheme tokyonight')

View File

@ -1,13 +1,16 @@
local nvim_treesitter = require('nvim-treesitter.configs')
local loaded, nvim_treesitter = pcall(require, "nvim-treesitter.configs")
if not loaded then
return
end
nvim_treesitter.setup({
ensure_installed = {
'norg',
"norg",
},
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
disable = { 'yaml' },
disable = { "yaml" },
},
matchup = {
enable = true,