style(neovim): format w/ stylua

This commit is contained in:
Price Hiller 2022-05-11 21:00:57 -05:00
parent 111afae147
commit 3f782e3337
48 changed files with 810 additions and 813 deletions

View File

@ -1,3 +1,3 @@
column_width = 120
indent_type = "Spaces"
quote_style = "AutoPreferSingle"
indent_type = 'Spaces'
quote_style = 'AutoPreferSingle'

View File

@ -1,4 +1,4 @@
local map = require("utils.funcs").map
local map = require('utils.funcs').map
map("n", "<leader>fge", ":Neorg gtd edit<CR>")
map("n", "<ledaer>fgv", ":Neorg gtd views<CR>")
map('n', '<leader>fge', ':Neorg gtd edit<CR>')
map('n', '<ledaer>fgv', ':Neorg gtd views<CR>')

View File

@ -1,13 +1,13 @@
local map = require("utils.funcs").map
local map = require('utils.funcs').map
map("n", "<leader>fr", ":RustRunnables<CR>")
map("n", "<leader>fd", ":RustDebuggables<CR>")
map("n", "<leader>fp", ":RustParentModule<CR>")
map("n", "<leader>fJ", ":RustJoinLines<CR>")
map("n", "<leader>fh", ":RustHoverActions<CR>")
map("n", "<leader>fH",":RustHoverRange<CR>")
map("n", "<leader>fi", ":RustToggleInlayHints<CR>")
map("n", "<leader>fm", ":RustExpandMacro<CR>")
map("n", "<leader>fc", ":RustOpenCargo<CR>")
map("n", "<leader>fk", ":RustMoveItemUp<CR>")
map("n", "<leader>fj", ":RustMoveItemDown<CR>")
map('n', '<leader>fr', ':RustRunnables<CR>')
map('n', '<leader>fd', ':RustDebuggables<CR>')
map('n', '<leader>fp', ':RustParentModule<CR>')
map('n', '<leader>fJ', ':RustJoinLines<CR>')
map('n', '<leader>fh', ':RustHoverActions<CR>')
map('n', '<leader>fH', ':RustHoverRange<CR>')
map('n', '<leader>fi', ':RustToggleInlayHints<CR>')
map('n', '<leader>fm', ':RustExpandMacro<CR>')
map('n', '<leader>fc', ':RustOpenCargo<CR>')
map('n', '<leader>fk', ':RustMoveItemUp<CR>')
map('n', '<leader>fj', ':RustMoveItemDown<CR>')

View File

@ -1,3 +1,3 @@
local opt = vim.opt
opt.foldmethod = "indent"
opt.foldmethod = 'indent'

View File

@ -1,2 +1,2 @@
pcall(require, "impatient")
require("main")
pcall(require, 'impatient')
require('main')

View File

@ -1,25 +1,25 @@
local M = {}
M.setup = function()
local disabled_built_ins = {
"gzip",
"zip",
"zipPlugin",
"tar",
"tarPlugin",
"getscript",
"getscriptPlugin",
"vimball",
"vimballPlugin",
"2html_plugin",
"logipat",
"rrhelper",
"spellfile_plugin",
"matchit",
}
local disabled_built_ins = {
'gzip',
'zip',
'zipPlugin',
'tar',
'tarPlugin',
'getscript',
'getscriptPlugin',
'vimball',
'vimballPlugin',
'2html_plugin',
'logipat',
'rrhelper',
'spellfile_plugin',
'matchit',
}
for _, plugin in pairs(disabled_built_ins) do
vim.g["loaded_" .. plugin] = 1
end
for _, plugin in pairs(disabled_built_ins) do
vim.g['loaded_' .. plugin] = 1
end
end
return M

View File

@ -1,5 +1,5 @@
require("core.disabled").setup()
require("core.options").setup()
require("core.mappings").setup()
require("core.globals").setup()
require("core.lsp").setup()
require('core.disabled').setup()
require('core.options').setup()
require('core.mappings').setup()
require('core.globals').setup()
require('core.lsp').setup()

View File

@ -1,15 +1,15 @@
local M = {}
M.setup = function()
local function lspSymbol(name, icon)
local hl = "DiagnosticSign" .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
local function lspSymbol(name, icon)
local hl = 'DiagnosticSign' .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
lspSymbol("Error", "")
lspSymbol("Warn", "")
lspSymbol("Info", "")
lspSymbol("Hint", "")
lspSymbol('Error', '')
lspSymbol('Warn', '')
lspSymbol('Info', '')
lspSymbol('Hint', '')
end
return M

View File

@ -1,29 +1,28 @@
local utils_func = require("utils.funcs")
local utils_func = require('utils.funcs')
local map = utils_func.map
local M = {}
M.setup = function()
-- set mapleader to space
vim.g.mapleader = " "
-- set mapleader to space
vim.g.mapleader = ' '
-- Get rid of highlight after search
map("n", "<esc>", ":noh<CR>")
-- Get rid of highlight after search
map('n', '<esc>', ':noh<CR>')
-- Spell Checking
map("n", "<leader>st",":set spell!<CR>")
map('n', '<leader>st', ':set spell!<CR>')
-- Better split movement
map("n", "<C-l>", "<C-w>l")
map("n", "<C-h>", "<C-w>h")
map("n", "<C-k>", "<C-w>k")
map("n", "<C-j>", "<C-w>j")
map('n', '<C-l>', '<C-w>l')
map('n', '<C-h>', '<C-w>h')
map('n', '<C-k>', '<C-w>k')
map('n', '<C-j>', '<C-w>j')
-- Better split closing
map("n", "<C-x>", "<C-w>c")
map('n', '<C-x>', '<C-w>c')
-- Set current focused file as cwd
map("n", "<leader>cd", ":cd %:p:h<CR>")
map('n', '<leader>cd', ':cd %:p:h<CR>')
end
return M

View File

@ -3,99 +3,99 @@ local opt = vim.opt
local M = {}
M.setup = function()
-- Number settings
opt.number = true
opt.numberwidth = 2
opt.relativenumber = false
-- Number settings
opt.number = true
opt.numberwidth = 2
opt.relativenumber = false
-- Scroll Offset
opt.scrolloff = 3
-- Scroll Offset
opt.scrolloff = 3
-- Disable showmode
opt.showmode = false
-- Disable showmode
opt.showmode = false
-- Set truecolor support
opt.termguicolors = true
vim.cmd("highlight Normal guibg=none")
-- Set truecolor support
opt.termguicolors = true
vim.cmd('highlight Normal guibg=none')
-- Enable system clipboard
opt.clipboard = "unnamedplus"
-- Enable system clipboard
opt.clipboard = 'unnamedplus'
-- Set mouse support for any mode
opt.mouse = "a"
-- Set mouse support for any mode
opt.mouse = 'a'
-- Allow hidden
opt.hidden = true
-- Allow hidden
opt.hidden = true
-- Useful defaults for tab, indentation, etc.
opt.tabstop = 4
opt.shiftwidth = 4
opt.smartindent = true
opt.breakindent = true
opt.expandtab = true
opt.smarttab = true
-- Useful defaults for tab, indentation, etc.
opt.tabstop = 4
opt.shiftwidth = 4
opt.smartindent = true
opt.breakindent = true
opt.expandtab = true
opt.smarttab = true
-- Search settings
opt.hlsearch = true
opt.incsearch = true
opt.ignorecase = true
opt.smartcase = true
-- Search settings
opt.hlsearch = true
opt.incsearch = true
opt.ignorecase = true
opt.smartcase = true
-- Better backspaces
opt.backspace = "indent,eol,start"
-- Better backspaces
opt.backspace = 'indent,eol,start'
-- Make new splits vertical
opt.splitright = true
-- Make new splits vertical
opt.splitright = true
-- Show line & column num of cursor
opt.ruler = true
-- Show line & column num of cursor
opt.ruler = true
-- Set timeouts
opt.ttimeoutlen = 20
opt.timeoutlen = 1000
opt.updatetime = 250
opt.signcolumn = "yes"
-- Set timeouts
opt.ttimeoutlen = 20
opt.timeoutlen = 1000
opt.updatetime = 250
opt.signcolumn = 'yes'
-- Enable persistent undo
opt.undodir = vim.fn.stdpath("cache") .. "/undo"
opt.undofile = true
-- Enable persistent undo
opt.undodir = vim.fn.stdpath('cache') .. '/undo'
opt.undofile = true
-- Better folding
opt.foldmethod = "expr"
opt.foldexpr = "nvim_treesitter#foldexpr()"
opt.fillchars = { fold = " " }
opt.foldlevel = 20
-- Better folding
opt.foldmethod = 'expr'
opt.foldexpr = 'nvim_treesitter#foldexpr()'
opt.fillchars = { fold = ' ' }
opt.foldlevel = 20
-- Concealment for nicer rendering
opt.conceallevel = 2
opt.concealcursor = "ic"
-- Concealment for nicer rendering
opt.conceallevel = 2
opt.concealcursor = 'ic'
-- Lazy Redraw to Speed Up Macros
opt.lazyredraw = true
-- Lazy Redraw to Speed Up Macros
opt.lazyredraw = true
-- Spell Settings
opt.spelllang = { "en_us" }
-- Spell Settings
opt.spelllang = { 'en_us' }
-- Better completion experience
opt.completeopt = "menuone,noselect"
-- Better completion experience
opt.completeopt = 'menuone,noselect'
-- Set max text width
opt.textwidth = 120
-- Set max text width
opt.textwidth = 120
-- Highlight cursor line
opt.cursorline = true
-- Highlight cursor line
opt.cursorline = true
-- Make statusline global
opt.laststatus = 3
-- Make statusline global
opt.laststatus = 3
-- Set listcharacters
opt.list = true
opt.listchars:append("tab:⭾⭾")
opt.listchars:append("lead:·")
opt.listchars:append("trail:·")
opt.listchars:append("extends:◣")
opt.listchars:append("precedes:◢")
opt.listchars:append("nbsp:○")
opt.listchars:append('tab:⭾⭾')
opt.listchars:append('lead:·')
opt.listchars:append('trail:·')
opt.listchars:append('extends:◣')
opt.listchars:append('precedes:◢')
opt.listchars:append('nbsp:○')
-- Remove end of boundry '~'
opt.fillchars:append('eob: ')

View File

@ -1 +1 @@
require("core.theme").setup()
require('core.theme').setup()

View File

@ -1,19 +1,19 @@
local M = {}
M.setup = function()
vim.g.tokyonight_style = "night"
vim.g.tokyonight_transparent = true
vim.g.tokyonight_transparent_sidebar = true
vim.g.tokyonight_style = 'night'
vim.g.tokyonight_transparent = true
vim.g.tokyonight_transparent_sidebar = true
local colorscheme_name = "tokyonight"
local loaded, _ = pcall(vim.cmd, "colorscheme " .. colorscheme_name)
local colorscheme_name = 'tokyonight'
local loaded, _ = pcall(vim.cmd, 'colorscheme ' .. colorscheme_name)
if not loaded then
vim.notify('Colorscheme "' .. colorscheme_name .. '" could not be loaded!', vim.lsp.log_levels.WARN, {
title = "Colorscheme",
})
end
if not loaded then
vim.notify('Colorscheme "' .. colorscheme_name .. '" could not be loaded!', vim.lsp.log_levels.WARN, {
title = 'Colorscheme',
})
end
vim.api.nvim_set_hl(0, "SpecialKey", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, 'SpecialKey', { fg = '#61AFEF' })
end
return M

View File

@ -4,14 +4,14 @@
-- INFO: SHOULD have a init.lua file associated with them.
-- INFO: init.lua is responsible for loading all configuration
-- INFO: related to that directory.
require("core.init")
require("plugins.init")
require("utils.init")
require('core.init')
require('plugins.init')
require('utils.init')
-- INFO: Post load, for things that need to setup keybindings etc after the fact
--
-- NOTE: All postload modules should be independent of each other, they shouldn't
-- NOTE: rely on each other's load order. That type of logic should be shifted
-- NOTE: into non-postload regions then handled in postload modules.
require("plugins.postload")
require("core.postload")
require('plugins.postload')
require('core.postload')

View File

@ -1,195 +1,195 @@
local cmp = require("cmp")
local cmp = require('cmp')
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").load()
require('luasnip.loaders.from_vscode').load()
cmp.setup({
formatting = {
format = function(entry, vim_item)
-- 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
-- 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],",
})[entry.source.name]
return vim_item
end,
},
window = {
documentation = {
border = { "", "", "", "", "", "", "", "" },
},
},
experimental = {
ghost_text = true,
native_menu = false,
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
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({
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)
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
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)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "emoji" },
{ name = "neorg" },
{ name = "luasnip" }, -- For luasnip users.
{ name = "calc" },
{ name = "zsh" },
{ name = "fuzzy_buffer" },
{ name = "rg" },
{ name = "npm", keyword_length = 2 },
{
name = "dictionary",
keyword_length = 2,
},
}),
sorting = {
priority_weight = 2,
comparators = {
formatting = {
format = function(entry, vim_item)
-- 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
-- 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],',
})[entry.source.name]
return vim_item
end,
},
window = {
documentation = {
border = { '', '', '', '', '', '', '', '' },
},
},
experimental = {
ghost_text = true,
native_menu = false,
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
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({
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)
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
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)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'emoji' },
{ name = 'neorg' },
{ name = 'luasnip' }, -- For luasnip users.
{ name = 'calc' },
{ name = 'zsh' },
{ name = 'fuzzy_buffer' },
{ name = 'rg' },
{ name = 'npm', keyword_length = 2 },
{
name = 'dictionary',
keyword_length = 2,
},
}),
sorting = {
priority_weight = 2,
comparators = {
compare.score,
compare.recently_used,
compare.exact,
require("cmp_fuzzy_buffer.compare"),
compare.offset,
require('cmp_fuzzy_buffer.compare'),
compare.offset,
compare.kind,
compare.sort_text,
compare.length,
compare.order,
},
},
compare.sort_text,
compare.length,
compare.order,
},
},
})
-- Git Commit Completions
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "conventionalcommits" },
{ name = "buffer" },
}),
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'conventionalcommits' },
{ name = 'buffer' },
}),
})
cmp.setup.filetype("toml", {
sources = cmp.config.sources({
{ name = "crates" },
}),
cmp.setup.filetype('toml', {
sources = cmp.config.sources({
{ name = 'crates' },
}),
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
-- { name = "buffer" },
{ name = "fuzzy_buffer" },
{ name = "cmdline_history" },
}),
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
-- { name = "buffer" },
{ name = 'fuzzy_buffer' },
{ name = 'cmdline_history' },
}),
})
cmp.setup.cmdline("?", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "fuzzy_buffer" },
{ name = "cmdline_history" },
}),
cmp.setup.cmdline('?', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'fuzzy_buffer' },
{ name = 'cmdline_history' },
}),
})
cmp.setup.cmdline("@", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "fuzzy_buffer" },
{ name = "cmdline_history" },
}),
cmp.setup.cmdline('@', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'fuzzy_buffer' },
{ name = 'cmdline_history' },
}),
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
{ name = "cmdline" },
{ name = "cmdline_history" },
}),
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
{ name = 'cmdline' },
{ name = 'cmdline_history' },
}),
})

View File

@ -1,59 +1,59 @@
local dap = require("dap")
local async = require("plenary.async")
local dap = require('dap')
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 fd = io.popen("which " .. program)
local program_path = fd:read("*all")
fd:close()
program_path = program_path.gsub(program_path, "\n", "")
local fd = io.popen('which ' .. program)
local program_path = fd:read('*all')
fd:close()
program_path = program_path.gsub(program_path, '\n', '')
if program_path == nil or program_path == "" then
async.run(function()
vim.notify.async(("Failed to find (%s) in your path"):format(program), "error", {
title = "DAP",
}).events.close()
end)
program_path = nil
end
return program_path
if program_path == nil or program_path == '' then
async.run(function()
vim.notify.async(('Failed to find (%s) in your path'):format(program), 'error', {
title = 'DAP',
}).events.close()
end)
program_path = nil
end
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",
command = lldb_path,
name = "lldb",
type = 'executable',
command = lldb_path,
name = 'lldb',
}
-- configurations
dap.configurations.cpp = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
targetArchitecture = "arm64",
args = {},
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
targetArchitecture = 'arm64',
args = {},
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
--
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
--
-- Otherwise you might get the following error:
--
-- Error on launch: Failed to attach to the target process
--
-- But you should be aware of the implications:
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
runInTerminal = false,
},
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
--
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
--
-- Otherwise you might get the following error:
--
-- Error on launch: Failed to attach to the target process
--
-- But you should be aware of the implications:
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
runInTerminal = false,
},
}
dap.configurations.c = dap.configurations.cpp

View File

@ -1,3 +1,3 @@
require("neoclip").setup({
enable_persistent_history = true
require('neoclip').setup({
enable_persistent_history = true,
})

View File

@ -1,50 +1,50 @@
local neorg = require("neorg")
local neorg = require('neorg')
neorg.setup({
load = {
["core.defaults"] = {},
["core.norg.concealer"] = {},
["core.norg.esupports.metagen"] = {
config = {
type = "auto",
}
},
["core.integrations.nvim-cmp"] = {
config = {}
},
["core.norg.completion"] = {
['core.defaults'] = {},
['core.norg.concealer'] = {},
['core.norg.esupports.metagen'] = {
config = {
engine = "nvim-cmp"
type = 'auto',
},
},
["core.keybinds"] = {
['core.integrations.nvim-cmp'] = {
config = {},
},
['core.norg.completion'] = {
config = {
engine = 'nvim-cmp',
},
},
['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"] = {
config = {}
['core.gtd.ui'] = {
config = {},
},
["core.gtd.helpers"] = {
config = {}
}
}
['core.gtd.helpers'] = {
config = {},
},
},
})

View File

@ -1,20 +1,20 @@
require("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" },
buftype = {
"packer",
"Dashboard",
"terminal",
"quickfix",
"loclist",
"LspInstall"
},
},
-- comma-separated list of autocmds that wil trigger the plugins window restore function
nested = nil,
require('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' },
buftype = {
'packer',
'Dashboard',
'terminal',
'quickfix',
'loclist',
'LspInstall',
},
},
-- comma-separated list of autocmds that wil trigger the plugins window restore function
nested = nil,
})

View File

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

View File

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

View File

@ -1 +1 @@
map("n", "<leader>ls", ":SymbolsOutline<CR>")
map('n', '<leader>ls', ':SymbolsOutline<CR>')

View File

@ -3,8 +3,8 @@ local g = vim.g
-- Run COQ on open
g.coq_settings = {
auto_start = "shut-up",
auto_start = 'shut-up',
limits = {
completion_manual_timeout = 2000,
}
},
}

View File

@ -1,9 +1,9 @@
local fn = vim.fn
require("dapui").setup({})
require('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,40 +1,40 @@
local g = vim.g
local fn = vim.fn
local plugins_count = fn.len(fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
local plugins_count = fn.len(fn.globpath('~/.local/share/nvim/site/pack/packer/start', '*', 0, 1))
g.dashboard_disable_statusline = 1
g.dashboard_default_executive = "telescope"
g.dashboard_default_executive = 'telescope'
g.dashboard_custom_header = {
" ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗",
" ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║",
" ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║",
" ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║",
" ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║",
" ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝",
' ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗',
' ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║',
' ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║',
' ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║',
' ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║',
' ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝',
}
g.dashboard_custom_section = {
a = { description = { " Find File SPC t f" }, command = "Telescope find_files" },
b = { description = { " Find directory SPC t d" }, command = "Telescope find_directories" },
c = { description = { " Recents SPC t o" }, command = "Telescope oldfiles" },
d = { description = { " Find Word SPC t w" }, command = "Telescope live_grep" },
a = { description = { ' Find File SPC t f' }, command = 'Telescope find_files' },
b = { description = { ' Find directory SPC t d' }, command = 'Telescope find_directories' },
c = { description = { ' Recents SPC t o' }, command = 'Telescope oldfiles' },
d = { description = { ' Find Word SPC t w' }, command = 'Telescope live_grep' },
}
g.dashboard_custom_footer = {
"Loaded " .. plugins_count .. " plugins!  ",
'Loaded ' .. plugins_count .. ' plugins!  ',
}
-- Disable statusline and cursorline in dashboard.
vim.api.nvim_create_autocmd("BufEnter", {
callback = function ()
if vim.bo.filetype == "dashboard" then
vim.api.nvim_create_autocmd('BufEnter', {
callback = function()
if vim.bo.filetype == 'dashboard' then
vim.opt.laststatus = 0
vim.opt.cursorline = false
else
vim.opt.laststatus = 3
vim.opt.cursorline = true
end
end
end,
})

View File

@ -1,18 +1,18 @@
local colors = require("tokyonight.colors").setup()
require("scrollbar").setup({
handle = {
color = colors.bg_highlight,
},
marks = {
Search = { color = colors.orange },
Error = { color = colors.error },
Warn = { color = colors.warning },
Info = { color = colors.info },
Hint = { color = colors.hint },
Misc = { color = colors.purple },
},
handlers = {
diagnostic = true,
search = true,
},
local colors = require('tokyonight.colors').setup()
require('scrollbar').setup({
handle = {
color = colors.bg_highlight,
},
marks = {
Search = { color = colors.orange },
Error = { color = colors.error },
Warn = { color = colors.warning },
Info = { color = colors.info },
Hint = { color = colors.hint },
Misc = { color = colors.purple },
},
handlers = {
diagnostic = true,
search = true,
},
})

View File

@ -1,10 +1,10 @@
local fidget = require("fidget")
local fidget = require('fidget')
fidget.setup({
text = {
spinner = "dots"
spinner = 'dots',
},
window = {
blend = 0,
}
},
})

View File

@ -1,18 +1,18 @@
local treesitter = require("nvim-tree.configs")
local treesitter = require('nvim-tree.configs')
treesitter.setup({
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
disable = {
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
disable = {
-- Ansible support reasons
"ansible.yaml",
'ansible.yaml',
},
},
matchup = {
enable = true,
},
autotag = {
enable = true,
},
},
matchup = {
enable = true,
},
autotag = {
enable = true,
},
})

View File

@ -1,24 +1,24 @@
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",
"dashboard",
"packer",
"lsp-installer",
"lspinfo",
'help',
'terminal',
'dashboard',
'packer',
'lsp-installer',
'lspinfo',
}
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({
-- space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,
require('indent_blankline').setup({
-- space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,
})

View File

@ -19,7 +19,7 @@ local required_servers = {
'html',
'vimls',
'clangd',
'omnisharp'
'omnisharp',
}
for _, name in pairs(required_servers) do
@ -74,7 +74,7 @@ local rustopts = {
inlay_hints = {
parameter_hints_prefix = '',
other_hints_prefix = '',
}
},
},
}
require('rust-tools').setup(rustopts)
@ -132,7 +132,7 @@ for _, server in ipairs({
'vimls',
'clangd',
'cmake',
'omnisharp'
'omnisharp',
}) do
lspconfig[server].setup(opts)
end

View File

@ -1,30 +1,29 @@
local function lspSymbol(name, icon)
local hl = "DiagnosticSign" .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
local hl = 'DiagnosticSign' .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
lspSymbol("Error", "")
lspSymbol("Warn", "")
lspSymbol("Info", "")
lspSymbol("Hint", "")
lspSymbol('Error', '')
lspSymbol('Warn', '')
lspSymbol('Info', '')
lspSymbol('Hint', '')
local border = {
{"🭽", "FloatBorder"},
{"", "FloatBorder"},
{"🭾", "FloatBorder"},
{"", "FloatBorder"},
{"🭿", "FloatBorder"},
{"", "FloatBorder"},
{"🭼", "FloatBorder"},
{"", "FloatBorder"},
{ '🭽', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '🭾', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '🭿', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '🭼', 'FloatBorder' },
{ '', 'FloatBorder' },
}
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
-- vim.o.updatetime = 100
@ -35,6 +34,6 @@ vim.diagnostic.config({
severity_sort = true,
update_in_insert = false,
float = {
source = "always"
}
source = 'always',
},
})

View File

@ -1,8 +1,8 @@
vim.cmd[[
vim.cmd([[
let g:neoformat_python_black = {
\ 'exe': 'black',
\ 'stdin': 1,
\ 'args': ['-q', '-'],
\ }
let g:neoformat_enabled_python = ['black']
]]
]])

View File

@ -1,8 +1,8 @@
local neotree = require("neo-tree")
local neotree = require('neo-tree')
vim.g.neo_tree_remove_legacy_commands = 1
neotree.setup({
filesystem = {
use_libuv_file_watcher = true,
},
filesystem = {
use_libuv_file_watcher = true,
},
})

View File

@ -1,10 +1,10 @@
local null_ls = require("null-ls")
local null_ls = require('null-ls')
null_ls.setup({
sources = {
null_ls.builtins.formatting.shfmt,
null_ls.builtins.diagnostics.hadolint,
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.diagnostics.ansiblelint
null_ls.builtins.diagnostics.ansiblelint,
},
})

View File

@ -1,3 +1,3 @@
local colorizer = require("colorizer")
local colorizer = require('colorizer')
colorizer.setup({})
vim.cmd("ColorizerAttachToBuffer")
vim.cmd('ColorizerAttachToBuffer')

View File

@ -1,34 +1,34 @@
require("notify").setup({
-- Animation style (see below for details)
stages = "fade_in_slide_out",
require('notify').setup({
-- Animation style (see below for details)
stages = 'fade_in_slide_out',
-- Function called when a new window is opened, use for changing win settings/config
on_open = nil,
-- Function called when a new window is opened, use for changing win settings/config
on_open = nil,
-- Function called when a window is closed
on_close = nil,
-- Function called when a window is closed
on_close = nil,
-- Render function for notifications. See notify-render()
render = "default",
-- Render function for notifications. See notify-render()
render = 'default',
-- Default timeout for notifications
timeout = 5000,
-- 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",
-- 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',
-- Minimum width for notification windows
minimum_width = 50,
-- Minimum width for notification windows
minimum_width = 50,
-- Icons for the different levels
icons = {
ERROR = "",
WARN = "",
INFO = "",
DEBUG = "",
TRACE = "",
},
-- Icons for the different levels
icons = {
ERROR = '',
WARN = '',
INFO = '',
DEBUG = '',
TRACE = '',
},
})
vim.notify = require("notify")
vim.notify = require('notify')

View File

@ -1,3 +1,3 @@
local dap_python = require("dap-python")
dap_python.setup("~/.venvs/debugpy/bin/python")
dap_python.test_runner = "pytest"
local dap_python = require('dap-python')
dap_python.setup('~/.venvs/debugpy/bin/python')
dap_python.test_runner = 'pytest'

View File

@ -1,43 +1,43 @@
local present, lualine = pcall(require, "lualine")
local present, lualine = pcall(require, 'lualine')
if not present then
return
return
end
local left_pad = ""
local right_pad = ""
local left_pad = ''
local right_pad = ''
lualine.setup({
options = {
icons_enabled = true,
theme = "auto",
component_separators = "|",
section_separators = { left = left_pad, right = right_pad },
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = {
{
"filename",
file_status = true,
path = 1,
},
},
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = { "fugitive", "fzf" },
options = {
icons_enabled = true,
theme = 'auto',
component_separators = '|',
section_separators = { left = left_pad, right = right_pad },
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = {
{
'filename',
file_status = true,
path = 1,
},
},
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = { 'fugitive', 'fzf' },
})

View File

@ -1,64 +1,64 @@
local telescope = require("telescope")
local telescope = require('telescope')
telescope.setup({
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "flex",
layout_config = {
vertical = {
prompt_position = "top",
width = 0.90,
height = 0.98,
preview_height = 0.65,
},
horizontal = {
prompt_position = "top",
width = 0.90,
height = 0.98,
preview_width = 0.70,
},
flex = {
flip_cloumns = 120,
},
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" },
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
extensions = {
media_files = {
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg",
},
},
defaults = {
vimgrep_arguments = {
'rg',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case',
},
prompt_prefix = '',
selection_caret = ' ',
entry_prefix = ' ',
initial_mode = 'insert',
selection_strategy = 'reset',
sorting_strategy = 'ascending',
layout_strategy = 'flex',
layout_config = {
vertical = {
prompt_position = 'top',
width = 0.90,
height = 0.98,
preview_height = 0.65,
},
horizontal = {
prompt_position = 'top',
width = 0.90,
height = 0.98,
preview_width = 0.70,
},
flex = {
flip_cloumns = 120,
},
},
file_sorter = require('telescope.sorters').get_fuzzy_file,
generic_sorter = require('telescope.sorters').get_generic_fuzzy_sorter,
path_display = { 'truncate' },
winblend = 0,
border = {},
borderchars = { '', '', '', '', '', '', '', '' },
color_devicons = true,
use_less = true,
set_env = { ['COLORTERM'] = 'truecolor' },
file_previewer = require('telescope.previewers').vim_buffer_cat.new,
grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new,
qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new,
buffer_previewer_maker = require('telescope.previewers').buffer_previewer_maker,
},
extensions = {
media_files = {
filetypes = { 'png', 'webp', 'jpg', 'jpeg' },
find_cmd = 'rg',
},
},
})
telescope.load_extension("media_files")
telescope.load_extension("find_directories")
telescope.load_extension("file_browser")
telescope.load_extension("notify")
telescope.load_extension("fzf")
telescope.load_extension('media_files')
telescope.load_extension('find_directories')
telescope.load_extension('file_browser')
telescope.load_extension('notify')
telescope.load_extension('fzf')

View File

@ -1 +1 @@
require("todo-comments").setup({})
require('todo-comments').setup({})

View File

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

View File

@ -1,23 +1,23 @@
local nvim_treesitter = require("nvim-treesitter.configs")
local nvim_treesitter = require('nvim-treesitter.configs')
nvim_treesitter.setup({
ensure_installed = {
"norg",
"norg_meta",
"norg_table",
},
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
disable = { "yaml" },
},
matchup = {
enable = true,
},
autotag = {
enable = true,
},
yati = {
enable = true,
},
ensure_installed = {
'norg',
'norg_meta',
'norg_table',
},
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
disable = { 'yaml' },
},
matchup = {
enable = true,
},
autotag = {
enable = true,
},
yati = {
enable = true,
},
})

View File

@ -1,5 +1,5 @@
require("plugins.plugins")
local found, _ = pcall(require, "packer_compiled")
require('plugins.plugins')
local found, _ = pcall(require, 'packer_compiled')
if not found then
vim.notify("Unable to locate packer_compiled!")
vim.notify('Unable to locate packer_compiled!')
end

View File

@ -1,5 +1,5 @@
local utils = require('utils.funcs')
local async = require("plenary.async")
local async = require('plenary.async')
local map = utils.map
-- Telescope mappings
@ -92,48 +92,47 @@ map('n', '<leader>zm', ':ZenMode<CR>')
-- SnipRun Mappings
local run_snip = function()
async.run(function ()
async.run(function()
vim.notify.async('Running snippet, saving current buffer.', 'info', {
title = 'SnipRun'
title = 'SnipRun',
})
end)
vim.cmd('w')
vim.cmd('SnipRun')
end
map('n', '<leader>sr', '', {
callback = run_snip
callback = run_snip,
})
map('v', '<leader>sr', '', {
callback = run_snip
callback = run_snip,
})
-- Packer Mappings
local packer = require("packer")
local packer_sync = function ()
async.run(function ()
local packer = require('packer')
local packer_sync = function()
async.run(function()
vim.notify.async('Syncing packer.', 'info', {
title = 'Packer'
title = 'Packer',
})
end)
local snap_shot_time = os.date("!%Y-%m-%dT%TZ")
local snap_shot_time = os.date('!%Y-%m-%dT%TZ')
packer.snapshot(snap_shot_time)
packer.sync()
end
local packer_compile = function ()
async.run(function ()
local packer_compile = function()
async.run(function()
vim.notify.async('Compiling packer.', 'info', {
title = 'Packer'
title = 'Packer',
})
end)
packer.compile()
end
map('n', '<leader>ps', '', {
callback = packer_sync
callback = packer_sync,
})
map('n', '<leader>pc', '', {
callback = packer_compile
callback = packer_compile,
})

View File

@ -119,7 +119,7 @@ return packer.startup({
['ac'] = '@class.outer',
['ic'] = '@class.inner',
['ib'] = '@block.inner',
['ab'] = '@block.outer'
['ab'] = '@block.outer',
},
},
move = {

View File

@ -1,3 +1,3 @@
-- Anything that needs to be loaded LAST
-- needs to required here
require("plugins.mappings")
require('plugins.mappings')

View File

@ -1,6 +1,6 @@
-- Highlight yanked text
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
end,
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
})

View File

@ -1,126 +1,126 @@
local U = {}
U.map = function(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
U.close_buffer = function(force)
-- Yanked from NvChad, thanks to them. This saves
-- a lot of pain
-- Yanked from NvChad, thanks to them. This saves
-- a lot of pain
-- This is a modification of a NeoVim plugin from
-- Author: ojroques - Olivier Roques
-- Src: https://github.com/ojroques/nvim-bufdel
-- This is a modification of a NeoVim plugin from
-- Author: ojroques - Olivier Roques
-- Src: https://github.com/ojroques/nvim-bufdel
-- Options
local opts = {
next = "cycle", -- how to retrieve the next buffer
quit = false, -- exit when last buffer is deleted
--TODO make this a chadrc flag/option
}
-- Options
local opts = {
next = 'cycle', -- how to retrieve the next buffer
quit = false, -- exit when last buffer is deleted
--TODO make this a chadrc flag/option
}
-- ----------------
-- Helper functions
-- ----------------
-- ----------------
-- Helper functions
-- ----------------
-- Switch to buffer 'buf' on each window from list 'windows'
local function switch_buffer(windows, buf)
local cur_win = vim.fn.winnr()
for _, winid in ipairs(windows) do
vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
vim.cmd(string.format("buffer %d", buf))
end
vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window
end
-- Switch to buffer 'buf' on each window from list 'windows'
local function switch_buffer(windows, buf)
local cur_win = vim.fn.winnr()
for _, winid in ipairs(windows) do
vim.cmd(string.format('%d wincmd w', vim.fn.win_id2win(winid)))
vim.cmd(string.format('buffer %d', buf))
end
vim.cmd(string.format('%d wincmd w', cur_win)) -- return to original window
end
-- Select the first buffer with a number greater than given buffer
local function get_next_buf(buf)
local next = vim.fn.bufnr("#")
if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then
return next
end
for i = 0, vim.fn.bufnr("$") - 1 do
next = (buf + i) % vim.fn.bufnr("$") + 1 -- will loop back to 1
if vim.fn.buflisted(next) == 1 then
return next
end
end
end
-- Select the first buffer with a number greater than given buffer
local function get_next_buf(buf)
local next = vim.fn.bufnr('#')
if opts.next == 'alternate' and vim.fn.buflisted(next) == 1 then
return next
end
for i = 0, vim.fn.bufnr('$') - 1 do
next = (buf + i) % vim.fn.bufnr('$') + 1 -- will loop back to 1
if vim.fn.buflisted(next) == 1 then
return next
end
end
end
-- ----------------
-- End helper functions
-- ----------------
-- ----------------
-- End helper functions
-- ----------------
local buf = vim.fn.bufnr()
if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
vim.cmd("close")
return
end
local buf = vim.fn.bufnr()
if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
vim.cmd('close')
return
end
if #vim.fn.getbufinfo({ buflisted = 1 }) < 2 then
if opts.quit then
-- exit when there is only one buffer left
if force then
vim.cmd("qall!")
else
vim.cmd("confirm qall")
end
return
end
if #vim.fn.getbufinfo({ buflisted = 1 }) < 2 then
if opts.quit then
-- exit when there is only one buffer left
if force then
vim.cmd('qall!')
else
vim.cmd('confirm qall')
end
return
end
local chad_term, _ = pcall(function()
return vim.api.nvim_buf_get_var(buf, "term_type")
end)
local chad_term, _ = pcall(function()
return vim.api.nvim_buf_get_var(buf, 'term_type')
end)
if chad_term then
-- Must be a window type
vim.cmd(string.format("setlocal nobl", buf))
vim.cmd("enew")
return
end
-- don't exit and create a new empty buffer
vim.cmd("enew")
vim.cmd("bp")
end
if chad_term then
-- Must be a window type
vim.cmd(string.format('setlocal nobl', buf))
vim.cmd('enew')
return
end
-- don't exit and create a new empty buffer
vim.cmd('enew')
vim.cmd('bp')
end
local next_buf = get_next_buf(buf)
local windows = vim.fn.getbufinfo(buf)[1].windows
local next_buf = get_next_buf(buf)
local windows = vim.fn.getbufinfo(buf)[1].windows
-- force deletion of terminal buffers to avoid the prompt
if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then
local chad_term, type = pcall(function()
return vim.api.nvim_buf_get_var(buf, "term_type")
end)
-- force deletion of terminal buffers to avoid the prompt
if force or vim.fn.getbufvar(buf, '&buftype') == 'terminal' then
local chad_term, type = pcall(function()
return vim.api.nvim_buf_get_var(buf, 'term_type')
end)
-- TODO this scope is error prone, make resilient
if chad_term then
if type == "wind" then
-- hide from bufferline
vim.cmd(string.format("%d bufdo setlocal nobl", buf))
-- swtich to another buff
-- TODO switch to next bufffer, this works too
vim.cmd("BufferLineCycleNext")
else
local cur_win = vim.fn.winnr()
-- we can close this window
vim.cmd(string.format("%d wincmd c", cur_win))
return
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format("bd! %d", buf))
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format("silent! confirm bd %d", buf))
end
-- revert buffer switches if user has canceled deletion
if vim.fn.buflisted(buf) == 1 then
switch_buffer(windows, buf)
end
-- TODO this scope is error prone, make resilient
if chad_term then
if type == 'wind' then
-- hide from bufferline
vim.cmd(string.format('%d bufdo setlocal nobl', buf))
-- swtich to another buff
-- TODO switch to next bufffer, this works too
vim.cmd('BufferLineCycleNext')
else
local cur_win = vim.fn.winnr()
-- we can close this window
vim.cmd(string.format('%d wincmd c', cur_win))
return
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format('bd! %d', buf))
end
else
switch_buffer(windows, next_buf)
vim.cmd(string.format('silent! confirm bd %d', buf))
end
-- revert buffer switches if user has canceled deletion
if vim.fn.buflisted(buf) == 1 then
switch_buffer(windows, buf)
end
end
return U

View File

@ -1 +1 @@
require("utils.cmd")
require('utils.cmd')