1
0
Fork 0

retabbing, conjure, minor refactors

This commit is contained in:
Luca Bilke 2023-01-28 19:06:51 +01:00
parent 5ea035ee06
commit d4cd8c5a74
37 changed files with 1693 additions and 1673 deletions

View file

@ -5,18 +5,7 @@ end, 0)
require('config.options')
require('funcs').bootstrap()
require('plugins')
require('config.autocmdlist')
require('config.filetypelist')
require('config.autocmds').setup()
require('config.filetypes').setup()
require('config.icons').setup()
require('funcs').map('general')
local icons = require('config.iconlist').diagnostics
local signs = {
DiagnosticSignError = icons.BoldError,
DiagnosticSignWarn = icons.BoldWarning,
DiagnosticSignHint = icons.BoldHint,
DiagnosticSignInfo = icons.BoldInformation
}
for type, icon in pairs(signs) do
local hl = type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end

View file

@ -1,120 +0,0 @@
local cmds = {
{ -- Handles the automatic line numeration changes
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
{
pattern = "*",
command = "if &nu && mode() != \"i\" | set rnu | endif"
}
},
{ -- Handles the automatic line numeration changes
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
{
pattern = "*",
command = "if &nu | set nornu | endif"
}
},
{
"BufWritePost",
{
pattern = { "bm-files", "bm-dirs" },
command = "!shortcuts"
}
},
{
{ "BufRead", "BufNewFile" },
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "set filetype=xdefaults"
}
},
{
"BufWritePost",
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "!xrdb %"
}
},
{
"BufWritePost",
{
pattern = "~/.local/src/dwmblocks/config.h",
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
}
},
{
"BufWritePost",
{
pattern = "*.java",
callback = function()
vim.lsp.codelens.refresh()
end
}
},
{
{ "BufDelete", "VimLeave" },
{
pattern = "*.tex",
command = "!texclear \"%:p\""
}
},
{ -- Use 'q' to quit from common plugins
'FileType',
{
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]]
end
}
},
{
'Filetype',
{
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
}
},
{ -- Automatically apply changes to plugins.lua
'BufWritePost',
{
group = 'packer_user_config',
pattern = { "plugins.lua", "pluginlist.lua" },
command = "source <afile> | PackerCompile"
}
},
{ -- Fix auto comment
'BufWinEnter',
{
callback = function()
vim.cmd("set formatoptions-=cro")
end
}
},
{ -- Highlight yanked text
'TextYankPost',
{
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end
}
}
}
vim.api.nvim_create_augroup('packer_user_config', { clear = true })
for _, entry in ipairs(cmds) do
local event = entry[1]
local opts = entry[2]
if type(opts.group) == "string" and opts.group ~= "" then
local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group })
if not exists then
vim.api.nvim_create_augroup(opts.group, {})
end
end
vim.api.nvim_create_autocmd(event, opts)
end

View file

@ -0,0 +1,124 @@
local M = {}
M.list = {
{ -- Handles the automatic line numeration changes
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
{
pattern = "*",
command = "if &nu && mode() != \"i\" | set rnu | endif"
}
},
{ -- Handles the automatic line numeration changes
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
{
pattern = "*",
command = "if &nu | set nornu | endif"
}
},
{
"BufWritePost",
{
pattern = { "bm-files", "bm-dirs" },
command = "!shortcuts"
}
},
{
{ "BufRead", "BufNewFile" },
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "set filetype=xdefaults"
}
},
{
"BufWritePost",
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "!xrdb %"
}
},
{
"BufWritePost",
{
pattern = "~/.local/src/dwmblocks/config.h",
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
}
},
{
"BufWritePost",
{
pattern = "*.java",
callback = function()
vim.lsp.codelens.refresh()
end
}
},
{
{ "BufDelete", "VimLeave" },
{
pattern = "*.tex",
command = "!texclear \"%:p\""
}
},
{ -- Use 'q' to quit from common plugins
'FileType',
{
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]]
end
}
},
{
'Filetype',
{
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
}
},
{ -- Automatically apply changes to plugins.lua
'BufWritePost',
{
group = 'packer_user_config',
pattern = { "plugins.lua", "pluginlist.lua" },
command = "source <afile> | PackerCompile"
}
},
{ -- Fix auto comment
'BufWinEnter',
{
callback = function()
vim.cmd("set formatoptions-=cro")
end
}
},
{ -- Highlight yanked text
'TextYankPost',
{
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end
}
}
}
M.setup = function()
vim.api.nvim_create_augroup('packer_user_config', { clear = true })
for _, entry in ipairs(M.list) do
local event = entry[1]
local opts = entry[2]
if type(opts.group) == "string" and opts.group ~= "" then
local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group })
if not exists then
vim.api.nvim_create_augroup(opts.group, {})
end
end
vim.api.nvim_create_autocmd(event, opts)
end
end
return M

View file

@ -1,28 +0,0 @@
local filetypes = {
{
extension = {
yml = function(path, bufnr)
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
{ type = 'directory', upward = true }) and
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
return 'yaml.ansible'
else
return 'yaml'
end
end,
yaml = function(path, bufnr)
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
{ type = 'directory', upward = true }) and
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
return 'yaml.ansible'
else
return 'yaml'
end
end
}
}
}
for _, entry in pairs(filetypes) do
vim.filetype.add(entry)
end

View file

@ -0,0 +1,33 @@
local M = {}
M.list = {
{
extension = {
yml = function(path, bufnr)
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
{ type = 'directory', upward = true }) and
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
return 'yaml.ansible'
else
return 'yaml'
end
end,
yaml = function(path, bufnr)
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
{ type = 'directory', upward = true }) and
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
return 'yaml.ansible'
else
return 'yaml'
end
end
}
}
}
M.setup = function()
for _, entry in pairs(M.list) do
vim.filetype.add(entry)
end
end
return M

View file

@ -1,157 +0,0 @@
return {
kind = {
Array = "",
Boolean = "",
Class = "",
Color = "",
Constant = "",
Constructor = "",
Enum = "",
EnumMember = "",
Event = "",
Field = "",
File = "",
Folder = "",
Function = "",
Interface = "",
Key = "",
Keyword = "",
Method = "",
Module = "",
Namespace = "",
Null = "",
Number = "",
Object = "",
Operator = "",
Package = "",
Property = "",
Reference = "",
Snippet = "",
String = "",
Struct = "",
Text = "",
TypeParameter = "",
Unit = "",
Value = "",
Variable = "",
},
git = {
LineAdded = "",
LineModified = "",
LineRemoved = "",
FileDeleted = "",
FileIgnored = "",
FileRenamed = "",
FileStaged = "S",
FileUnmerged = "",
FileUnstaged = "",
FileUntracked = "U",
Diff = "",
Repo = "",
Octoface = "",
Branch = "",
},
ui = {
ArrowCircleDown = "",
ArrowCircleLeft = "",
ArrowCircleRight = "",
ArrowCircleUp = "",
BoldArrowDown = "",
BoldArrowLeft = "",
BoldArrowRight = "",
BoldArrowUp = "",
BoldClose = "",
BoldDividerLeft = "",
BoldDividerRight = "",
BoldLineLeft = "",
BookMark = "",
BoxChecked = "",
Bug = "",
Stacks = "",
Scopes = "",
Watches = "",
DebugConsole = "",
Calendar = "",
Check = "",
ChevronRight = ">",
ChevronShortDown = "",
ChevronShortLeft = "",
ChevronShortRight = "",
ChevronShortUp = "",
Circle = "",
Close = "",
CloudDownload = "",
Code = "",
Comment = "",
Dashboard = "",
DividerLeft = "",
DividerRight = "",
DoubleChevronRight = "",
DoubleChevronLeft = "",
Ellipsis = "",
EmptyFolder = "",
EmptyFolderOpen = "",
File = "",
FileSymlink = "",
Files = "",
FindFile = "",
FindText = "",
Fire = "",
Folder = "",
FolderOpen = "",
FolderSymlink = "",
Forward = "",
Gear = "",
History = "",
Lightbulb = "",
LineLeft = "",
LineMiddle = "",
List = "",
Lock = "",
MinusCircle = "",
NewFile = "",
Note = "",
Package = "",
Pencil = "",
Plus = "",
Project = "",
Search = "",
SignIn = "",
SignOut = "",
Tab = "",
Table = "",
Target = "",
Telescope = "",
Text = "",
Tree = "",
Triangle = "",
TriangleShortArrowDown = "",
TriangleShortArrowLeft = "",
TriangleShortArrowRight = "",
TriangleShortArrowUp = "",
},
diagnostics = {
BoldError = "",
Error = "",
BoldWarning = "",
Warning = "",
BoldInformation = "",
Information = "",
BoldQuestion = "",
Question = "",
BoldHint = "",
Hint = "",
Debug = "",
Trace = "",
},
progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" },
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}

View file

@ -0,0 +1,173 @@
local M = {}
M.list = {
kind = {
Array = "",
Boolean = "",
Class = "",
Color = "",
Constant = "",
Constructor = "",
Enum = "",
EnumMember = "",
Event = "",
Field = "",
File = "",
Folder = "",
Function = "",
Interface = "",
Key = "",
Keyword = "",
Method = "",
Module = "",
Namespace = "",
Null = "",
Number = "",
Object = "",
Operator = "",
Package = "",
Property = "",
Reference = "",
Snippet = "",
String = "",
Struct = "",
Text = "",
TypeParameter = "",
Unit = "",
Value = "",
Variable = "",
},
git = {
LineAdded = "",
LineModified = "",
LineRemoved = "",
FileDeleted = "",
FileIgnored = "",
FileRenamed = "",
FileStaged = "S",
FileUnmerged = "",
FileUnstaged = "",
FileUntracked = "U",
Diff = "",
Repo = "",
Octoface = "",
Branch = "",
},
ui = {
ArrowCircleDown = "",
ArrowCircleLeft = "",
ArrowCircleRight = "",
ArrowCircleUp = "",
BoldArrowDown = "",
BoldArrowLeft = "",
BoldArrowRight = "",
BoldArrowUp = "",
BoldClose = "",
BoldDividerLeft = "",
BoldDividerRight = "",
BoldLineLeft = "",
BookMark = "",
BoxChecked = "",
Bug = "",
Stacks = "",
Scopes = "",
Watches = "",
DebugConsole = "",
Calendar = "",
Check = "",
ChevronRight = ">",
ChevronShortDown = "",
ChevronShortLeft = "",
ChevronShortRight = "",
ChevronShortUp = "",
Circle = "",
Close = "",
CloudDownload = "",
Code = "",
Comment = "",
Dashboard = "",
DividerLeft = "",
DividerRight = "",
DoubleChevronRight = "",
DoubleChevronLeft = "",
Ellipsis = "",
EmptyFolder = "",
EmptyFolderOpen = "",
File = "",
FileSymlink = "",
Files = "",
FindFile = "",
FindText = "",
Fire = "",
Folder = "",
FolderOpen = "",
FolderSymlink = "",
Forward = "",
Gear = "",
History = "",
Lightbulb = "",
LineLeft = "",
LineMiddle = "",
List = "",
Lock = "",
MinusCircle = "",
NewFile = "",
Note = "",
Package = "",
Pencil = "",
Plus = "",
Project = "",
Search = "",
SignIn = "",
SignOut = "",
Tab = "",
Table = "",
Target = "",
Telescope = "",
Text = "",
Tree = "",
Triangle = "",
TriangleShortArrowDown = "",
TriangleShortArrowLeft = "",
TriangleShortArrowRight = "",
TriangleShortArrowUp = "",
},
diagnostics = {
BoldError = "",
Error = "",
BoldWarning = "",
Warning = "",
BoldInformation = "",
Information = "",
BoldQuestion = "",
Question = "",
BoldHint = "",
Hint = "",
Debug = "",
Trace = "",
},
progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" },
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}
M.setup = function()
local icons = M.list.diagnostics
local signs = {
DiagnosticSignError = icons.BoldError,
DiagnosticSignWarn = icons.BoldWarning,
DiagnosticSignHint = icons.BoldHint,
DiagnosticSignInfo = icons.BoldInformation
}
for type, icon in pairs(signs) do
local hl = type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
end
return M

View file

@ -15,8 +15,8 @@ o.splitbelow = true
o.updatetime = 250
o.writebackup = false
o.expandtab = true
o.shiftwidth = 2
o.tabstop = 2
o.shiftwidth = 4
o.tabstop = 4
o.cursorline = true
o.signcolumn = "yes"
o.wrap = false

View file

@ -3,8 +3,8 @@ if not status_ok then
return
end
local dashboard = require 'alpha.themes.dashboard'
local icons = require 'config.iconlist'
local dashboard = require('alpha.themes.dashboard')
local icons = require('config.icons').list
local banner = {
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀",

View file

@ -5,7 +5,7 @@ if not status_ok then
return
end
local icons = require 'config.iconlist'
local icons = require('config.icons').list
local function is_ft(b, ft)
return vim.bo[b].filetype == ft

View file

@ -1,4 +1,4 @@
local icons = require('config.iconlist')
local icons = require('config.icons').list
local dap_status_ok, dap = pcall(require, 'dap')
if not dap_status_ok then

View file

@ -4,7 +4,7 @@ if not status_ok then
end
local colors = require('tokyonight.colors').setup({ transform = true })
local icons = require('config.iconlist')
local icons = require('config.icons').list
local conditions = {
buffer_not_empty = function()

View file

@ -3,7 +3,7 @@ if not status_ok then
return
end
local icons = require('config.iconlist')
local icons = require('config.icons').list
local settings = {
ui = {

View file

@ -3,7 +3,7 @@ if not status_ok then
return
end
local icons = require('config.iconlist')
local icons = require('config.icons').list
telescope.setup {
defaults = {

View file

@ -2,7 +2,7 @@ local status_ok, whichkey = pcall(require, 'which-key')
if not status_ok then
return
end
local icons = require('config.iconlist')
local icons = require('config.icons').list
whichkey.setup {
marks = false,

View file

@ -1,4 +1,4 @@
local icons = require "config.iconlist"
local icons = require('config.icons').list
local plugins = {
{ "wbthomason/packer.nvim",
config = function()
@ -161,6 +161,8 @@ local plugins = {
require('plugins.config.dap')
end,
},
{ "olical/aniseed" },
{ "olical/conjure" },
{ "rafamadriz/friendly-snippets",
event = "InsertEnter",
module = { "cmp", "cmp_nvim_lsp" },
@ -182,6 +184,10 @@ local plugins = {
{ "hrsh7th/cmp-nvim-lsp", after = "cmp-nvim-lua" },
{ "hrsh7th/cmp-buffer", after = "cmp-nvim-lsp" },
{ "hrsh7th/cmp-path", after = "cmp-buffer" },
{ "paterjason/cmp-conjure",
after = { "cmp-buffer", "conjure" },
ft = "fennel"
},
{ "onsails/lspkind.nvim" },
{ "windwp/nvim-autopairs",
after = "nvim-cmp",

View file