1
0
Fork 0

retabbing, conjure, minor refactors

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

View file

@ -1,22 +1,11 @@
vim.defer_fn(function() vim.defer_fn(function()
pcall(require, "impatient") pcall(require, "impatient")
end, 0) end, 0)
require('config.options') require('config.options')
require('funcs').bootstrap() require('funcs').bootstrap()
require('plugins') require('plugins')
require('config.autocmdlist') require('config.autocmds').setup()
require('config.filetypelist') require('config.filetypes').setup()
require('config.icons').setup()
require('funcs').map('general') 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

@ -1,228 +1,228 @@
local M = {} local M = {}
M.maps = { M.maps = {
general = { general = {
n = { -- normal mode n = { -- normal mode
-- Better window navigation -- Better window navigation
{ "<C-h>", "<C-w>h" }, { "<C-h>", "<C-w>h" },
{ "<C-j>", "<C-w>j" }, { "<C-j>", "<C-w>j" },
{ "<C-k>", "<C-w>k" }, { "<C-k>", "<C-w>k" },
{ "<C-l>", "<C-w>l" }, { "<C-l>", "<C-w>l" },
-- Resize with arrows -- Resize with arrows
{ "<C-Up>", ":resize -2<CR>" }, { "<C-Up>", ":resize -2<CR>" },
{ "<C-Down>", ":resize +2<CR>" }, { "<C-Down>", ":resize +2<CR>" },
{ "<C-Left>", ":vertical resize -2<CR>" }, { "<C-Left>", ":vertical resize -2<CR>" },
{ "<C-Right>", ":vertical resize +2<CR>" }, { "<C-Right>", ":vertical resize +2<CR>" },
-- Navigate buffers -- Navigate buffers
{ "<TAB>", ":bnext<CR>" }, { "<TAB>", ":bnext<CR>" },
{ "<S-TAB>", ":bprevious<CR>" }, { "<S-TAB>", ":bprevious<CR>" },
-- lsp -- lsp
{ "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>" }, { "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>" },
{ "gd", "<cmd>lua vim.lsp.buf.definition()<CR>" }, { "gd", "<cmd>lua vim.lsp.buf.definition()<CR>" },
{ "K", "<cmd>lua vim.lsp.buf.hover()<CR>" }, { "K", "<cmd>lua vim.lsp.buf.hover()<CR>" },
{ "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>" }, { "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>" },
{ "gr", "<cmd>lua vim.lsp.buf.references()<CR>" }, { "gr", "<cmd>lua vim.lsp.buf.references()<CR>" },
{ "gl", "<cmd>lua vim.diagnostic.open_float()<CR>" }, { "gl", "<cmd>lua vim.diagnostic.open_float()<CR>" },
},
i = { -- insert mode
-- Delete last word with ctrl + del
{ "<C-BS>", "<C-W>" },
},
v = { -- visual mode
-- Better paste
{ "p", '"_dP' },
-- Stay in indent mode
{ "<", "<gv" },
{ ">", ">gv" },
}
}, },
i = { -- insert mode illuminate = {
-- Delete last word with ctrl + del n = {
{ "<C-BS>", "<C-W>" }, { "<a-n>", "<cmd>lua require('illuminate').next_reference{wrap=true}<CR>" },
{ "<a-p>", "<cmd>lua require('illuminate').next_reference{reverse=true,wrap=true}<CR>" },
}
}, },
v = { -- visual mode
-- Better paste
{ "p", '"_dP' },
-- Stay in indent mode
{ "<", "<gv" },
{ ">", ">gv" },
}
},
illuminate = {
n = {
{ "<a-n>", "<cmd>lua require('illuminate').next_reference{wrap=true}<CR>" },
{ "<a-p>", "<cmd>lua require('illuminate').next_reference{reverse=true,wrap=true}<CR>" },
}
},
} }
M.whichkey = { M.whichkey = {
general = { general = {
n = { n = {
["w"] = { "<cmd>w!<CR>", "Save" }, ["w"] = { "<cmd>w!<CR>", "Save" },
["q"] = { function() require("funcs").buf_kill() end, "Close" }, ["q"] = { function() require("funcs").buf_kill() end, "Close" },
["f"] = { function() require("lf").start("~") end, "File Picker" }, ["f"] = { function() require("lf").start("~") end, "File Picker" },
["h"] = { "<cmd>nohlsearch<CR>", "Clear Highlights" }, ["h"] = { "<cmd>nohlsearch<CR>", "Clear Highlights" },
u = { u = {
name = "Utility", name = "Utility",
c = { "<cmd>w!<CR><cmd>!compiler \"%:p\"<CR>", "Compile" }, c = { "<cmd>w!<CR><cmd>!compiler \"%:p\"<CR>", "Compile" },
}, },
l = { l = {
name = "LSP", name = "LSP",
a = { function() vim.lsp.buf.code_action() end, "Code Action" }, a = { function() vim.lsp.buf.code_action() end, "Code Action" },
f = { function() require("funcs").format { async = true } end, "Format" }, f = { function() require("funcs").format { async = true } end, "Format" },
j = { function() vim.diagnostic.goto_next() end, "Next Diagnostic" }, j = { function() vim.diagnostic.goto_next() end, "Next Diagnostic" },
k = { function() vim.diagnostic.goto_prev() end, "Prev Diagnostic" }, k = { function() vim.diagnostic.goto_prev() end, "Prev Diagnostic" },
l = { function() vim.lsp.codelens.run() end, "CodeLens Action" }, l = { function() vim.lsp.codelens.run() end, "CodeLens Action" },
q = { function() vim.diagnostic.setloclist() end, "Quickfix" }, q = { function() vim.diagnostic.setloclist() end, "Quickfix" },
r = { function() vim.lsp.buf.rename() end, "Rename" }, r = { function() vim.lsp.buf.rename() end, "Rename" },
} }
} }
},
lspconfig = {
n = {
l = {
name = "LSP",
i = { "<cmd>LspInfo<cr>", "Info" },
}
}
},
mason = {
n = {
l = {
name = "LSP",
I = { "<cmd>Mason<cr>", "Mason Info" },
}
}
},
dap = {
n = {
d = {
name = "DAP",
b = { function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint" },
c = { function() require("dap").continue() end, "Continue" },
i = { function() require("dap").step_into() end, "Step Into" },
o = { function() require("dap").step_over() end, "Step Over" },
O = { function() require("dap").step_out() end, "Step Out" },
r = { function() require("dap").repl.toggle() end, "Toggle REPL" },
l = { function() require("dap").run_last() end, "Run Last" },
t = { function() require("dap").terminate() end, "Stop Debugger" },
u = { function() require("dapui").toggle() end, "Toggle DAP UI" },
}
}
},
telescope = {
n = {
b = {
name = "Buffers",
f = { "<cmd>Telescope buffers<CR>", "Find" },
},
g = {
name = "Git",
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
C = { "<cmd>Telescope git_bcommits<cr>", "Checkout commit(for current file)" },
},
l = {
name = "LSP",
d = { "<cmd>Telescope diagnostics bufnr=0 theme=get_ivy<cr>", "Buffer Diagnostics" },
w = { "<cmd>Telescope diagnostics<cr>", "Diagnostics" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
S = { "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols" },
e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" },
},
s = {
name = "Search",
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
f = { "<cmd>Telescope find_files<cr>", "Find File" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
H = { "<cmd>Telescope highlights<cr>", "Find highlight groups" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
t = { "<cmd>Telescope live_grep<cr>", "Text" },
T = { "<cmd>TodoTelescope<cr>", "Todo Comments" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
}
}
},
blankline = {
n = {
c = {
function()
local ok, start = require("indent_blankline.utils").get_current_context(
vim.g.indent_blankline_context_patterns,
vim.g.indent_blankline_use_treesitter_scope
)
if ok then
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
vim.cmd [[normal! _]]
end
end,
"Jump to current_context",
}
}
},
bufferline = {
n = {
b = {
name = "Buffers",
j = { "<cmd>BufferLinePick<CR>", "Jump" },
b = { "<cmd>BufferLineCyclePrev<CR>", "Previous" },
n = { "<cmd>BufferLineCycleNext<CR>", "Next" },
e = { "<cmd>BufferLinePickClose<CR>", "Pick which buffer to close" },
h = { "<cmd>BufferLineCloseLeft<CR>", "Close all to the left" },
l = { "<cmd>BufferLineCloseRight<CR>", "Close all to the right" },
D = { "<cmd>BufferLineSortByDirectory<CR>", "Sort by directory" },
L = { "<cmd>BufferLineSortByExtension<CR>", "Sort by language" },
},
}
},
packer = {
n = {
p = {
name = "Packer",
c = { "<cmd>PackerCompile<CR>", "Compile" },
C = { "<cmd>PackerClean<CR>", "Clean" },
i = { "<cmd>PackerInstall<CR>", "Install" },
s = { "<cmd>PackerSync<CR>", "Sync" },
S = { "<cmd>PackerStatus<CR>", "Status" },
u = { "<cmd>PackerUpdate<CR>", "Update" },
},
}
},
lf = {
n = {
["e"] = { function() require("lf").start() end, "File Picker" },
}
},
alpha = {
n = {
[";"] = { "<cmd>Alpha<CR>", "Dashboard" },
}
},
treesitter = {
n = {
T = {
name = "Treesitter",
i = { "<cmd>TSConfigInfo<cr>", "Info" },
},
}
},
comment = {
n = {
["/"] = { "<Plug>(comment_toggle_linewise_current)", "Comment toggle current line" },
}, },
v = { lspconfig = {
["/"] = { "<Plug>(comment_toggle_linewise_visual)", "Comment toggle linewise" }, n = {
l = {
name = "LSP",
i = { "<cmd>LspInfo<cr>", "Info" },
}
}
}, },
}, mason = {
gitsigns = { n = {
n = { l = {
g = { name = "LSP",
name = "Git", I = { "<cmd>Mason<cr>", "Mason Info" },
j = { function() require("gitsigns").next_hunk() end, "Next Hunk" }, }
k = { function() require("gitsigns").prev_hunk() end, "Prev Hunk" }, }
l = { function() require("gitsigns").blame_line() end, "Blame" }, },
p = { function() require("gitsigns").preview_hunk() end, "Preview Hunk" }, dap = {
r = { function() require("gitsigns").reset_hunk() end, "Reset Hunk" }, n = {
R = { function() require("gitsigns").reset_buffer() end, "Reset Buffer" }, d = {
s = { function() require("gitsigns").stage_hunk() end, "Stage Hunk" }, name = "DAP",
u = { function() require("gitsigns").undo_stage_hunk() end, "Undo Stage Hunk" }, b = { function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint" },
d = { "<cmd>Gitsigns diffthis HEAD<cr>", "Git Diff" }, c = { function() require("dap").continue() end, "Continue" },
}, i = { function() require("dap").step_into() end, "Step Into" },
o = { function() require("dap").step_over() end, "Step Over" },
O = { function() require("dap").step_out() end, "Step Out" },
r = { function() require("dap").repl.toggle() end, "Toggle REPL" },
l = { function() require("dap").run_last() end, "Run Last" },
t = { function() require("dap").terminate() end, "Stop Debugger" },
u = { function() require("dapui").toggle() end, "Toggle DAP UI" },
}
}
},
telescope = {
n = {
b = {
name = "Buffers",
f = { "<cmd>Telescope buffers<CR>", "Find" },
},
g = {
name = "Git",
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
C = { "<cmd>Telescope git_bcommits<cr>", "Checkout commit(for current file)" },
},
l = {
name = "LSP",
d = { "<cmd>Telescope diagnostics bufnr=0 theme=get_ivy<cr>", "Buffer Diagnostics" },
w = { "<cmd>Telescope diagnostics<cr>", "Diagnostics" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
S = { "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols" },
e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" },
},
s = {
name = "Search",
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
f = { "<cmd>Telescope find_files<cr>", "Find File" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
H = { "<cmd>Telescope highlights<cr>", "Find highlight groups" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
t = { "<cmd>Telescope live_grep<cr>", "Text" },
T = { "<cmd>TodoTelescope<cr>", "Todo Comments" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
}
}
},
blankline = {
n = {
c = {
function()
local ok, start = require("indent_blankline.utils").get_current_context(
vim.g.indent_blankline_context_patterns,
vim.g.indent_blankline_use_treesitter_scope
)
if ok then
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
vim.cmd [[normal! _]]
end
end,
"Jump to current_context",
}
}
},
bufferline = {
n = {
b = {
name = "Buffers",
j = { "<cmd>BufferLinePick<CR>", "Jump" },
b = { "<cmd>BufferLineCyclePrev<CR>", "Previous" },
n = { "<cmd>BufferLineCycleNext<CR>", "Next" },
e = { "<cmd>BufferLinePickClose<CR>", "Pick which buffer to close" },
h = { "<cmd>BufferLineCloseLeft<CR>", "Close all to the left" },
l = { "<cmd>BufferLineCloseRight<CR>", "Close all to the right" },
D = { "<cmd>BufferLineSortByDirectory<CR>", "Sort by directory" },
L = { "<cmd>BufferLineSortByExtension<CR>", "Sort by language" },
},
}
},
packer = {
n = {
p = {
name = "Packer",
c = { "<cmd>PackerCompile<CR>", "Compile" },
C = { "<cmd>PackerClean<CR>", "Clean" },
i = { "<cmd>PackerInstall<CR>", "Install" },
s = { "<cmd>PackerSync<CR>", "Sync" },
S = { "<cmd>PackerStatus<CR>", "Status" },
u = { "<cmd>PackerUpdate<CR>", "Update" },
},
}
},
lf = {
n = {
["e"] = { function() require("lf").start() end, "File Picker" },
}
},
alpha = {
n = {
[";"] = { "<cmd>Alpha<CR>", "Dashboard" },
}
},
treesitter = {
n = {
T = {
name = "Treesitter",
i = { "<cmd>TSConfigInfo<cr>", "Info" },
},
}
},
comment = {
n = {
["/"] = { "<Plug>(comment_toggle_linewise_current)", "Comment toggle current line" },
},
v = {
["/"] = { "<Plug>(comment_toggle_linewise_visual)", "Comment toggle linewise" },
},
},
gitsigns = {
n = {
g = {
name = "Git",
j = { function() require("gitsigns").next_hunk() end, "Next Hunk" },
k = { function() require("gitsigns").prev_hunk() end, "Prev Hunk" },
l = { function() require("gitsigns").blame_line() end, "Blame" },
p = { function() require("gitsigns").preview_hunk() end, "Preview Hunk" },
r = { function() require("gitsigns").reset_hunk() end, "Reset Hunk" },
R = { function() require("gitsigns").reset_buffer() end, "Reset Buffer" },
s = { function() require("gitsigns").stage_hunk() end, "Stage Hunk" },
u = { function() require("gitsigns").undo_stage_hunk() end, "Undo Stage Hunk" },
d = { "<cmd>Gitsigns diffthis HEAD<cr>", "Git Diff" },
},
}
} }
}
} }
return M return M

View file

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

View file

@ -1,197 +1,197 @@
local M = {} local M = {}
function M.lazy_load(tb) function M.lazy_load(tb)
vim.api.nvim_create_autocmd(tb.events, { vim.api.nvim_create_autocmd(tb.events, {
group = vim.api.nvim_create_augroup(tb.augroup_name, {}), group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
callback = function() callback = function()
if tb.condition() then if tb.condition() then
vim.api.nvim_del_augroup_by_name(tb.augroup_name) vim.api.nvim_del_augroup_by_name(tb.augroup_name)
-- dont defer for treesitter as it will show slow highlighting -- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename" -- This deferring only happens only when we do "nvim filename"
if tb.plugin ~= "nvim-treesitter" then if tb.plugin ~= "nvim-treesitter" then
vim.defer_fn(function() vim.defer_fn(function()
require("packer").loader(tb.plugin) require("packer").loader(tb.plugin)
if tb.plugin == "nvim-lspconfig" then if tb.plugin == "nvim-lspconfig" then
vim.cmd "silent! do FileType" vim.cmd "silent! do FileType"
end
end, 0)
else
require("packer").loader(tb.plugin)
end
end end
end, 0) end,
else })
require("packer").loader(tb.plugin)
end
end
end,
})
end end
function M.on_file_open(plugin_name) function M.on_file_open(plugin_name)
M.lazy_load { M.lazy_load {
events = { "BufRead", "BufWinEnter", "BufNewFile" }, events = { "BufRead", "BufWinEnter", "BufNewFile" },
augroup_name = "BeLazyOnFileOpen" .. plugin_name, augroup_name = "BeLazyOnFileOpen" .. plugin_name,
plugin = plugin_name, plugin = plugin_name,
condition = function() condition = function()
local file = vim.fn.expand "%" local file = vim.fn.expand "%"
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
end, end,
} }
end end
function M.gitsigns() function M.gitsigns()
vim.api.nvim_create_autocmd({ "BufRead" }, { vim.api.nvim_create_autocmd({ "BufRead" }, {
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }), group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
callback = function() callback = function()
vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h") vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h")
if vim.v.shell_error == 0 then if vim.v.shell_error == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad" vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function() vim.schedule(function()
require("packer").loader "gitsigns.nvim" require("packer").loader "gitsigns.nvim"
end) end)
end end
end, end,
}) })
end end
function M.bootstrap() function M.bootstrap()
local fn = vim.fn local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
print "Cloning Packer..." print "Cloning Packer..."
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
vim.cmd "packadd packer.nvim" vim.cmd "packadd packer.nvim"
require "plugins" require "plugins"
vim.cmd "PackerSync" vim.cmd "PackerSync"
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd("User", {
pattern = "PackerComplete", pattern = "PackerComplete",
callback = function() callback = function()
vim.cmd "bw | silent! MasonInstallAll" -- close packer window vim.cmd "bw | silent! MasonInstallAll" -- close packer window
require("packer").loader "nvim-treesitter" require("packer").loader "nvim-treesitter"
end, end,
}) })
end end
end end
function M.map(section) function M.map(section)
local maps = require('config.keymaplist').maps[section] local maps = require('config.keymaplist').maps[section]
if maps then if maps then
for mode, binds in pairs(maps) do for mode, binds in pairs(maps) do
for _, bind in pairs(binds) do for _, bind in pairs(binds) do
local key = bind[1] local key = bind[1]
local cmd = bind[2] local cmd = bind[2]
local opt = { silent = true, noremap = true } local opt = { silent = true, noremap = true }
vim.api.nvim_set_keymap(mode, key, cmd, opt) vim.api.nvim_set_keymap(mode, key, cmd, opt)
end end
end
end end
end
local wk_ok, whichkey = pcall(require, 'which-key') local wk_ok, whichkey = pcall(require, 'which-key')
if wk_ok then if wk_ok then
local wkmaps = require('config.keymaplist').whichkey[section] local wkmaps = require('config.keymaplist').whichkey[section]
if wkmaps then if wkmaps then
for mode, binds in pairs(wkmaps) do for mode, binds in pairs(wkmaps) do
whichkey.register(binds, { whichkey.register(binds, {
mode = mode, mode = mode,
prefix = "<leader>", prefix = "<leader>",
buffer = nil, buffer = nil,
silent = true, silent = true,
noremap = true, noremap = true,
nowait = true, nowait = true,
}) })
end end
end
end end
end
end end
function M.format_filter(client) function M.format_filter(client)
local filetype = vim.bo.filetype local filetype = vim.bo.filetype
local n = require "null-ls" local n = require "null-ls"
local s = require "null-ls.sources" local s = require "null-ls.sources"
local method = n.methods.FORMATTING local method = n.methods.FORMATTING
local available_formatters = s.get_available(filetype, method) local available_formatters = s.get_available(filetype, method)
if #available_formatters > 0 then if #available_formatters > 0 then
return client.name == "null-ls" return client.name == "null-ls"
elseif client.supports_method "textDocument/formatting" then elseif client.supports_method "textDocument/formatting" then
return true return true
else else
return false return false
end end
end end
function M.format(opts) function M.format(opts)
opts = opts or {} opts = opts or {}
opts.filter = opts.filter or M.format_filter opts.filter = opts.filter or M.format_filter
return vim.lsp.buf.format(opts) return vim.lsp.buf.format(opts)
end end
-- Modified version of a function stolen from LunarVim -- Modified version of a function stolen from LunarVim
function M.buf_kill(kill_command, bufnr, force) function M.buf_kill(kill_command, bufnr, force)
kill_command = kill_command or "bd" kill_command = kill_command or "bd"
local bo = vim.bo local bo = vim.bo
local api = vim.api local api = vim.api
local fmt = string.format local fmt = string.format
local fnamemodify = vim.fn.fnamemodify local fnamemodify = vim.fn.fnamemodify
if bufnr == 0 or bufnr == nil then if bufnr == 0 or bufnr == nil then
bufnr = api.nvim_get_current_buf() bufnr = api.nvim_get_current_buf()
end
local bufname = api.nvim_buf_get_name(bufnr)
if not force then
local warning
if bo[bufnr].modified then
warning = fmt([[No write since last change for (%s)]], fnamemodify(bufname, ":t"))
elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then
warning = fmt([[Terminal %s will be killed]], bufname)
end end
if warning then
vim.ui.input({
prompt = string.format([[%s. Close it anyway? [y]es or [n]o (default: no): ]], warning),
}, function(choice)
if choice:match "ye?s?" then force = true end
end)
if not force then return end
end
end
-- Get list of windows IDs with the buffer to close local bufname = api.nvim_buf_get_name(bufnr)
local windows = vim.tbl_filter(function(win)
return api.nvim_win_get_buf(win) == bufnr
end, api.nvim_list_wins())
if #windows == 0 then return end if not force then
local warning
if force then if bo[bufnr].modified then
kill_command = kill_command .. "!" warning = fmt([[No write since last change for (%s)]], fnamemodify(bufname, ":t"))
end elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then
warning = fmt([[Terminal %s will be killed]], bufname)
-- Get list of active buffers end
local buffers = vim.tbl_filter(function(buf) if warning then
return api.nvim_buf_is_valid(buf) and bo[buf].buflisted vim.ui.input({
end, api.nvim_list_bufs()) prompt = string.format([[%s. Close it anyway? [y]es or [n]o (default: no): ]], warning),
}, function(choice)
-- If there is only one buffer (which has to be the current one), vim will if choice:match "ye?s?" then force = true end
-- create a new buffer on :bd. end)
-- For more than one buffer, pick the previous buffer (wrapping around if necessary) if not force then return end
if #buffers > 1 then
for i, v in ipairs(buffers) do
if v == bufnr then
local prev_buf_idx = i == 1 and (#buffers - 1) or (i - 1)
local prev_buffer = buffers[prev_buf_idx]
for _, win in ipairs(windows) do
api.nvim_win_set_buf(win, prev_buffer)
end end
end
end end
else
vim.cmd('q!')
end
-- Check if buffer still exists, to ensure the target buffer wasn't killed -- Get list of windows IDs with the buffer to close
-- due to options like bufhidden=wipe. local windows = vim.tbl_filter(function(win)
if api.nvim_buf_is_valid(bufnr) and bo[bufnr].buflisted then return api.nvim_win_get_buf(win) == bufnr
vim.cmd(string.format("%s %d", kill_command, bufnr)) end, api.nvim_list_wins())
end
if #windows == 0 then return end
if force then
kill_command = kill_command .. "!"
end
-- Get list of active buffers
local buffers = vim.tbl_filter(function(buf)
return api.nvim_buf_is_valid(buf) and bo[buf].buflisted
end, api.nvim_list_bufs())
-- If there is only one buffer (which has to be the current one), vim will
-- create a new buffer on :bd.
-- For more than one buffer, pick the previous buffer (wrapping around if necessary)
if #buffers > 1 then
for i, v in ipairs(buffers) do
if v == bufnr then
local prev_buf_idx = i == 1 and (#buffers - 1) or (i - 1)
local prev_buffer = buffers[prev_buf_idx]
for _, win in ipairs(windows) do
api.nvim_win_set_buf(win, prev_buffer)
end
end
end
else
vim.cmd('q!')
end
-- Check if buffer still exists, to ensure the target buffer wasn't killed
-- due to options like bufhidden=wipe.
if api.nvim_buf_is_valid(bufnr) and bo[bufnr].buflisted then
vim.cmd(string.format("%s %d", kill_command, bufnr))
end
end end
return M return M

View file

@ -1,49 +1,49 @@
local status_ok, alpha = pcall(require, 'alpha') local status_ok, alpha = pcall(require, 'alpha')
if not status_ok then if not status_ok then
return return
end end
local dashboard = require 'alpha.themes.dashboard' local dashboard = require('alpha.themes.dashboard')
local icons = require 'config.iconlist' local icons = require('config.icons').list
local banner = { local banner = {
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀",
"⠀⣀⣴⣶⣶⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀", "⠀⣀⣴⣶⣶⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀",
"⣰⣿⣿⠿⠛⠿⢿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀", "⣰⣿⣿⠿⠛⠿⢿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀",
"⣿⣿⡇⠀⠀⠀⠀⠈⠛⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀", "⣿⣿⡇⠀⠀⠀⠀⠈⠛⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀",
"⠹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠀⢀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀", "⠹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠀⢀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀",
"⠀⠙⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣤⣶⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀", "⠀⠙⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣤⣶⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠉⠻⠷⡄⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⢀⣠⣤⣤⣄⡀⠀⠀", "⠀⠀⠀⠉⠻⠷⡄⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⢀⣠⣤⣤⣄⡀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣷⡀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣷⡀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⣿⠟⠉⠉⠙⢿⣿⣿⣷", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⣿⠟⠉⠉⠙⢿⣿⣿⣷",
"⠀⠀⠀⣀⣠⣤⣤⣤⣶⣶⣶⣤⣤⠀⣴⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠉⠀⠀⠀⢀⣼⣿⣿⡿", "⠀⠀⠀⣀⣠⣤⣤⣤⣶⣶⣶⣤⣤⠀⣴⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠉⠀⠀⠀⢀⣼⣿⣿⡿",
"⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠛⠻⠏⣼⣿⣿⡿⣋⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣀⣠⣴⣾⣿⣿⡿⠁", "⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠛⠻⠏⣼⣿⣿⡿⣋⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣀⣠⣴⣾⣿⣿⡿⠁",
"⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠋⠘⠿⠟⠛⠛⢻⣿⣿⣿⠋⠁⠈⠉⢿⣿⣿⣧⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀", "⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠋⠘⠿⠟⠛⠛⢻⣿⣿⣿⠋⠁⠈⠉⢿⣿⣿⣧⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀",
"⠙⣷⣤⣀⠀⠀⠀⢀⣀⣤⣶⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡟⠀⠀⠀⢠⣿⣿⣿⡟⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀", "⠙⣷⣤⣀⠀⠀⠀⢀⣀⣤⣶⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡟⠀⠀⠀⢠⣿⣿⣿⡟⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀",
"⠀⠈⠛⠿⢿⣿⣿⣿⠿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡀⠀⢠⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠈⠛⠿⢿⣿⣿⣿⠿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡀⠀⢠⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣷⣶⣶⣶⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣷⣶⣶⣶⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢶⣦⣤⣶⣾⣿⣿⡶⠈⠉⠛⠿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢶⣦⣤⣶⣾⣿⣿⡶⠈⠉⠛⠿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣶⡿⠿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣶⡿⠿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
} }
if vim.o.lines < 36 then if vim.o.lines < 36 then
banner = vim.list_slice(banner, 16, 22) banner = vim.list_slice(banner, 16, 22)
end end
dashboard.section.header.val = banner dashboard.section.header.val = banner
dashboard.section.buttons.val = { dashboard.section.buttons.val = {
dashboard.button("f", icons.ui.FindFile .. " Find file", ":Telescope find_files<CR>"), dashboard.button("f", icons.ui.FindFile .. " Find file", ":Telescope find_files<CR>"),
dashboard.button("n", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert<CR>"), dashboard.button("n", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert<CR>"),
dashboard.button("p", icons.ui.Project .. " Find project", ":Telescope projects<CR>"), dashboard.button("p", icons.ui.Project .. " Find project", ":Telescope projects<CR>"),
dashboard.button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles<CR>"), dashboard.button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles<CR>"),
dashboard.button("t", icons.ui.FindText .. " Find text", ":Telescope live_grep<CR>"), dashboard.button("t", icons.ui.FindText .. " Find text", ":Telescope live_grep<CR>"),
dashboard.button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"), dashboard.button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"),
} }
dashboard.section.footer.val = "Behold: a Snail's Vim" dashboard.section.footer.val = "Behold: a Snail's Vim"

View file

@ -1,33 +1,33 @@
local status_ok, autopairs = pcall(require, "nvim-autopairs") local status_ok, autopairs = pcall(require, "nvim-autopairs")
if not status_ok then if not status_ok then
return return
end end
autopairs.setup({ autopairs.setup({
check_ts = true, check_ts = true,
disable_filetype = { "TelescopePrompt", "vim" }, disable_filetype = { "TelescopePrompt", "vim" },
ts_config = { ts_config = {
lua = { "string", "source" }, lua = { "string", "source" },
javascript = { "string", "template_string" }, javascript = { "string", "template_string" },
java = false, java = false,
}, },
fast_wrap = { fast_wrap = {
map = "<M-e>", map = "<M-e>",
chars = { "{", "[", "("}, chars = { "{", "[", "(" },
-- chars = { "{", "[", "(", '"', "'" }, -- chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, offset = 0,
end_key = "$", end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl", keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true, check_comma = true,
highlight = "PmenuSel", highlight = "PmenuSel",
highlight_grey = "LineNr", highlight_grey = "LineNr",
}, },
}) })
local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_status_ok, cmp = pcall(require, "cmp") local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then if not cmp_status_ok then
return return
end end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())

View file

@ -2,143 +2,143 @@ local colors = require('tokyonight.colors').setup({ transform = true })
local status_ok, bufferline = pcall(require, "bufferline") local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then if not status_ok then
return return
end end
local icons = require 'config.iconlist' local icons = require('config.icons').list
local function is_ft(b, ft) local function is_ft(b, ft)
return vim.bo[b].filetype == ft return vim.bo[b].filetype == ft
end end
local function diagnostics_indicator(_, _, diagnostics, _) local function diagnostics_indicator(_, _, diagnostics, _)
local result = {} local result = {}
local symbols = { local symbols = {
error = icons.diagnostics.Error, error = icons.diagnostics.Error,
warning = icons.diagnostics.Warning, warning = icons.diagnostics.Warning,
info = icons.diagnostics.Information, info = icons.diagnostics.Information,
} }
for name, count in pairs(diagnostics) do for name, count in pairs(diagnostics) do
if symbols[name] and count > 0 then if symbols[name] and count > 0 then
table.insert(result, symbols[name] .. " " .. count) table.insert(result, symbols[name] .. " " .. count)
end
end end
end result = table.concat(result, " ")
result = table.concat(result, " ") return #result > 0 and result or ""
return #result > 0 and result or ""
end end
local function custom_filter(buf, buf_nums) local function custom_filter(buf, buf_nums)
local logs = vim.tbl_filter(function(b) local logs = vim.tbl_filter(function(b)
return is_ft(b, "log") return is_ft(b, "log")
end, buf_nums) end, buf_nums)
if vim.tbl_isempty(logs) then if vim.tbl_isempty(logs) then
return true return true
end end
local tab_num = vim.fn.tabpagenr() local tab_num = vim.fn.tabpagenr()
local last_tab = vim.fn.tabpagenr "$" local last_tab = vim.fn.tabpagenr "$"
local is_log = is_ft(buf, "log") local is_log = is_ft(buf, "log")
if last_tab == 1 then if last_tab == 1 then
return true return true
end end
-- only show log buffers in secondary tabs -- only show log buffers in secondary tabs
return (tab_num == last_tab and is_log) or (tab_num ~= last_tab and not is_log) return (tab_num == last_tab and is_log) or (tab_num ~= last_tab and not is_log)
end end
local config = { local config = {
highlights = { highlights = {
background = { background = {
italic = true, italic = true,
bold = false, bold = false,
},
buffer_selected = {
italic = false,
bold = true,
},
}, },
buffer_selected = { options = {
italic = false, mode = "buffers", -- set to "tabs" to only show tabpages instead
bold = true, numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
indicator = {
-- icon = icons.ui.DoubleChevronRight, -- this should be omitted if indicator style is not 'icon'
style = "none", -- can also be 'underline'|'none',
},
buffer_close_icon = icons.ui.Close,
modified_icon = icons.ui.Circle,
close_icon = icons.ui.BoldClose,
left_trunc_marker = icons.ui.ArrowCircleLeft,
right_trunc_marker = icons.ui.ArrowCircleRight,
--- name_formatter can be used to change the buffer's label in the bufferline.
--- Please note some names can/will break the
--- bufferline so use this at your discretion knowing that it has
--- some limitations that will *NOT* be fixed.
name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
-- remove extension from markdown files for example
if buf.name:match "%.md" then
return vim.fn.fnamemodify(buf.name, ":t:r")
end
end,
max_name_length = 18,
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
truncate_names = true, -- whether or not tab names should be truncated
tab_size = 18,
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = false,
diagnostics_indicator = diagnostics_indicator,
-- NOTE: this will be called a lot so don't do any heavy processing here
custom_filter = custom_filter,
offsets = {
{
filetype = "undotree",
text = "Undotree",
highlight = "PanelHeading",
padding = 1,
},
{
filetype = "NvimTree",
text = "Explorer",
highlight = "PanelHeading",
padding = 1,
},
{
filetype = "DiffviewFiles",
text = "Diff View",
highlight = "PanelHeading",
padding = 1,
},
{
filetype = "flutterToolsOutline",
text = "Flutter Outline",
highlight = "PanelHeading",
},
{
filetype = "packer",
text = "Packer",
highlight = "PanelHeading",
padding = 1,
},
},
color_icons = true, -- whether or not to add the filetype icon highlights
show_buffer_icons = true, -- disable filetype icons for buffers
show_buffer_close_icons = false,
show_close_icon = false,
show_tab_indicators = true,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
-- can also be a table containing 2 custom separators
-- [focused and unfocused]. eg: { '|', '|' }
separator_style = { '', '' },
enforce_regular_tabs = false,
always_show_bufferline = false,
hover = {
enabled = false, -- requires nvim 0.8+
delay = 200,
reveal = { "close" },
},
sort_by = "id",
}, },
},
options = {
mode = "buffers", -- set to "tabs" to only show tabpages instead
numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
indicator = {
-- icon = icons.ui.DoubleChevronRight, -- this should be omitted if indicator style is not 'icon'
style = "none", -- can also be 'underline'|'none',
},
buffer_close_icon = icons.ui.Close,
modified_icon = icons.ui.Circle,
close_icon = icons.ui.BoldClose,
left_trunc_marker = icons.ui.ArrowCircleLeft,
right_trunc_marker = icons.ui.ArrowCircleRight,
--- name_formatter can be used to change the buffer's label in the bufferline.
--- Please note some names can/will break the
--- bufferline so use this at your discretion knowing that it has
--- some limitations that will *NOT* be fixed.
name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
-- remove extension from markdown files for example
if buf.name:match "%.md" then
return vim.fn.fnamemodify(buf.name, ":t:r")
end
end,
max_name_length = 18,
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
truncate_names = true, -- whether or not tab names should be truncated
tab_size = 18,
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = false,
diagnostics_indicator = diagnostics_indicator,
-- NOTE: this will be called a lot so don't do any heavy processing here
custom_filter = custom_filter,
offsets = {
{
filetype = "undotree",
text = "Undotree",
highlight = "PanelHeading",
padding = 1,
},
{
filetype = "NvimTree",
text = "Explorer",
highlight = "PanelHeading",
padding = 1,
},
{
filetype = "DiffviewFiles",
text = "Diff View",
highlight = "PanelHeading",
padding = 1,
},
{
filetype = "flutterToolsOutline",
text = "Flutter Outline",
highlight = "PanelHeading",
},
{
filetype = "packer",
text = "Packer",
highlight = "PanelHeading",
padding = 1,
},
},
color_icons = true, -- whether or not to add the filetype icon highlights
show_buffer_icons = true, -- disable filetype icons for buffers
show_buffer_close_icons = false,
show_close_icon = false,
show_tab_indicators = true,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
-- can also be a table containing 2 custom separators
-- [focused and unfocused]. eg: { '|', '|' }
separator_style = { '', '' },
enforce_regular_tabs = false,
always_show_bufferline = false,
hover = {
enabled = false, -- requires nvim 0.8+
delay = 200,
reveal = { "close" },
},
sort_by = "id",
},
} }
bufferline.setup(config) bufferline.setup(config)

View file

@ -1,98 +1,98 @@
local cmp_status_ok, cmp = pcall(require, 'cmp') local cmp_status_ok, cmp = pcall(require, 'cmp')
if not cmp_status_ok then if not cmp_status_ok then
return return
end end
local luasnip_status_ok, luasnip = pcall(require, 'luasnip') local luasnip_status_ok, luasnip = pcall(require, 'luasnip')
if not luasnip_status_ok then if not luasnip_status_ok then
return return
end end
local has_words_before = function() local has_words_before = function()
unpack = unpack or table.unpack unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
local cmp_window = require "cmp.utils.window" local cmp_window = require "cmp.utils.window"
cmp_window.info_ = cmp_window.info cmp_window.info_ = cmp_window.info
cmp_window.info = function(self) cmp_window.info = function(self)
local info = self:info_() local info = self:info_()
info.scrollable = false info.scrollable = false
return info return info
end end
cmp.setup({ cmp.setup({
window = { window = {
completion = { completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = -3, col_offset = -3,
side_padding = 0, side_padding = 0,
},
}, },
}, formatting = {
formatting = { fields = { "kind", "abbr", "menu" },
fields = { "kind", "abbr", "menu" }, format = function(entry, vim_item)
format = function(entry, vim_item) local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item) local strings = vim.split(kind.kind, "%s", { trimempty = true })
local strings = vim.split(kind.kind, "%s", { trimempty = true }) kind.kind = " " .. (strings[1] or "") .. " "
kind.kind = " " .. (strings[1] or "") .. " " kind.menu = " (" .. (strings[2] or "") .. ")"
kind.menu = " (" .. (strings[2] or "") .. ")"
return kind return kind
end, end,
}, },
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
end, end,
}, },
mapping = { mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(), ["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(), ["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-e>"] = cmp.mapping({ ["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(), i = cmp.mapping.abort(),
c = cmp.mapping.close(), c = cmp.mapping.close(),
}), }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region -- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
elseif has_words_before() then elseif has_words_before() then
cmp.complete() cmp.complete()
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
}, },
sources = { sources = {
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "nvim_lua" }, { name = "nvim_lua" },
{ name = "luasnip" }, { name = "luasnip" },
{ name = "buffer" }, { name = "buffer" },
{ name = "path" }, { name = "path" },
}, },
experimental = { experimental = {
ghost_text = true, ghost_text = true,
}, },
confirm_opts = { confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,
} }
}) })

View file

@ -1,11 +1,11 @@
local status_ok, comment = pcall(require, "Comment") local status_ok, comment = pcall(require, "Comment")
if not status_ok then if not status_ok then
return return
end end
comment.setup({ comment.setup({
mappings = { mappings = {
basic = false, basic = false,
extra = false extra = false
} }
}) })

View file

@ -1,25 +1,25 @@
local icons = require('config.iconlist') local icons = require('config.icons').list
local dap_status_ok, dap = pcall(require, 'dap') local dap_status_ok, dap = pcall(require, 'dap')
if not dap_status_ok then if not dap_status_ok then
return return
end end
local dap_ui_status_ok, dapui = pcall(require, 'dapui') local dap_ui_status_ok, dapui = pcall(require, 'dapui')
if not dap_ui_status_ok then if not dap_ui_status_ok then
return return
end end
vim.fn.sign_define("DapBreakpoint", { text = icons.ui.Bug, texthl = "DiagnosticSignError", linehl = "", numhl = "" }) vim.fn.sign_define("DapBreakpoint", { text = icons.ui.Bug, texthl = "DiagnosticSignError", linehl = "", numhl = "" })
dap.listeners.after.event_initialized["dapui_config"] = function() dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open() dapui.open()
end end
dap.listeners.before.event_terminated["dapui_config"] = function() dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close() dapui.close()
end end
dap.listeners.before.event_exited["dapui_config"] = function() dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close() dapui.close()
end end

View file

@ -1,27 +1,27 @@
local dap_ui_status_ok, dapui = pcall(require, 'nvim-dap-ui') local dap_ui_status_ok, dapui = pcall(require, 'nvim-dap-ui')
if not dap_ui_status_ok then if not dap_ui_status_ok then
return return
end end
dapui.setup { dapui.setup {
layouts = { layouts = {
{ {
elements = { elements = {
'scopes', 'scopes',
'breakpoints', 'breakpoints',
'stacks', 'stacks',
'watches', 'watches',
}, },
size = 40, size = 40,
position = 'left', position = 'left',
},
{
elements = {
'repl',
'console',
},
size = 10,
position = 'bottom',
},
}, },
{
elements = {
'repl',
'console',
},
size = 10,
position = 'bottom',
},
},
} }

View file

@ -1,36 +1,36 @@
local status_ok, gitsigns = pcall(require, "gitsigns") local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then if not status_ok then
return return
end end
gitsigns.setup { gitsigns.setup {
signs = { signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
}, },
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
watch_gitdir = { watch_gitdir = {
interval = 1000, interval = 1000,
follow_files = true, follow_files = true,
}, },
attach_to_untracked = true, attach_to_untracked = true,
current_line_blame_opts = { current_line_blame_opts = {
virt_text = true, virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000, delay = 1000,
}, },
sign_priority = 6, sign_priority = 6,
update_debounce = 100, update_debounce = 100,
status_formatter = nil, -- Use default status_formatter = nil, -- Use default
preview_config = { preview_config = {
-- Options passed to nvim_open_win -- Options passed to nvim_open_win
border = "single", border = "single",
style = "minimal", style = "minimal",
relative = "cursor", relative = "cursor",
row = 0, row = 0,
col = 1, col = 1,
}, },
} }

View file

@ -1,36 +1,36 @@
local status_ok, illuminate = pcall(require, "illuminate") local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then if not status_ok then
return return
end end
vim.g.Illuminate_ftblacklist = { 'alpha', 'NvimTree' } vim.g.Illuminate_ftblacklist = { 'alpha', 'NvimTree' }
illuminate.configure { illuminate.configure {
providers = { providers = {
"lsp", "lsp",
"treesitter", "treesitter",
"regex", "regex",
}, },
delay = 200, delay = 200,
filetypes_denylist = { filetypes_denylist = {
"dirvish", "dirvish",
"fugitive", "fugitive",
"alpha", "alpha",
"NvimTree", "NvimTree",
"packer", "packer",
"neogitstatus", "neogitstatus",
"Trouble", "Trouble",
"lir", "lir",
"Outline", "Outline",
"spectre_panel", "spectre_panel",
"toggleterm", "toggleterm",
"DressingSelect", "DressingSelect",
"TelescopePrompt", "TelescopePrompt",
}, },
filetypes_allowlist = {}, filetypes_allowlist = {},
modes_denylist = {}, modes_denylist = {},
modes_allowlist = {}, modes_allowlist = {},
providers_regex_syntax_denylist = {}, providers_regex_syntax_denylist = {},
providers_regex_syntax_allowlist = {}, providers_regex_syntax_allowlist = {},
under_cursor = true, under_cursor = true,
} }

View file

@ -1,7 +1,7 @@
-- This file is currently not used anywhere -- This file is currently not used anywhere
local status_ok, impatient = pcall(require, "impatient") local status_ok, impatient = pcall(require, "impatient")
if not status_ok then if not status_ok then
return return
end end
impatient.enable_profile() impatient.enable_profile()

View file

@ -1,20 +1,20 @@
local status_ok, indent_blankline = pcall(require, "indent_blankline") local status_ok, indent_blankline = pcall(require, "indent_blankline")
if not status_ok then if not status_ok then
return return
end end
indent_blankline.setup { indent_blankline.setup {
char = "", char = "",
context_char = "", context_char = "",
show_trailing_blankline_indent = false, show_trailing_blankline_indent = false,
show_first_indent_level = true, show_first_indent_level = true,
use_treesitter = true, use_treesitter = true,
show_current_context = false, show_current_context = false,
show_end_of_line = false, show_end_of_line = false,
buftype_exclude = { "terminal", "nofile" }, buftype_exclude = { "terminal", "nofile" },
filetype_exclude = { filetype_exclude = {
"help", "help",
"packer", "packer",
"NvimTree", "NvimTree",
}, },
} }

View file

@ -1,9 +1,9 @@
-- Defaults -- Defaults
require("lf").setup({ require("lf").setup({
winblend = 0, winblend = 0,
highlights = { highlights = {
border = "Normal", border = "Normal",
background = "Normal", background = "Normal",
}, },
border = "rounded", border = "rounded",
}) })

View file

@ -1,11 +1,11 @@
local mason_lspconfig_status_ok, mason_lspconfig = pcall(require, 'mason-lspconfig') local mason_lspconfig_status_ok, mason_lspconfig = pcall(require, 'mason-lspconfig')
if not mason_lspconfig_status_ok then if not mason_lspconfig_status_ok then
return return
end end
local lspconfig_status_ok, lspconfig = pcall(require, 'lspconfig') local lspconfig_status_ok, lspconfig = pcall(require, 'lspconfig')
if not lspconfig_status_ok then if not lspconfig_status_ok then
return return
end end
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
@ -13,78 +13,78 @@ end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem = { capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" }, documentationFormat = { "markdown", "plaintext" },
snippetSupport = true, snippetSupport = true,
preselectSupport = true, preselectSupport = true,
insertReplaceSupport = true, insertReplaceSupport = true,
labelDetailsSupport = true, labelDetailsSupport = true,
deprecatedSupport = true, deprecatedSupport = true,
commitCharactersSupport = true, commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } }, tagSupport = { valueSet = { 1 } },
resolveSupport = { resolveSupport = {
properties = { properties = {
"documentation", "documentation",
"detail", "detail",
"additionalTextEdits", "additionalTextEdits",
},
}, },
},
} }
local opts = { local opts = {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities capabilities = capabilities
} }
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = {}, ensure_installed = {},
automatic_installation = true, automatic_installation = true,
}) })
mason_lspconfig.setup_handlers({ mason_lspconfig.setup_handlers({
function(server_name) function(server_name)
lspconfig[server_name].setup(opts) lspconfig[server_name].setup(opts)
end, end,
["intelephense"] = function() ["intelephense"] = function()
opts = { opts = {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
init_options = { init_options = {
storagePath = vim.fn.expand "$XDG_CACHE_HOME" .. "/intelephense", storagePath = vim.fn.expand "$XDG_CACHE_HOME" .. "/intelephense",
globalStoragePath = vim.fn.expand "$XDG_DATA_HOME" .. "/intelephense" globalStoragePath = vim.fn.expand "$XDG_DATA_HOME" .. "/intelephense"
},
settings = {
intelephense = {
telemetry = {
enable = false,
}
}
}
}
lspconfig["intelephense"].setup(opts)
end,
["sumneko_lua"] = function()
opts = {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true
}, },
}, settings = {
telemetry = { intelephense = {
enable = false, telemetry = {
}, enable = false,
maxPreload = 100000, }
preloadFileSize = 10000, }
}, }
}, }
} lspconfig["intelephense"].setup(opts)
lspconfig["sumneko_lua"].setup(opts) end,
end ["sumneko_lua"] = function()
opts = {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true
},
},
telemetry = {
enable = false,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
}
lspconfig["sumneko_lua"].setup(opts)
end
}) })

View file

@ -1,199 +1,199 @@
local status_ok, lualine = pcall(require, 'lualine') local status_ok, lualine = pcall(require, 'lualine')
if not status_ok then if not status_ok then
return return
end end
local colors = require('tokyonight.colors').setup({ transform = true }) local colors = require('tokyonight.colors').setup({ transform = true })
local icons = require('config.iconlist') local icons = require('config.icons').list
local conditions = { local conditions = {
buffer_not_empty = function() buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end, end,
hide_in_width = function() hide_in_width = function()
return vim.fn.winwidth(0) > 80 return vim.fn.winwidth(0) > 80
end, end,
check_git_workspace = function() check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h') local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';') local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath return gitdir and #gitdir > 0 and #gitdir < #filepath
end, end,
} }
local config = { local config = {
options = { options = {
component_separators = '', component_separators = '',
section_separators = '', section_separators = '',
-- theme = { -- theme = {
-- normal = { c = { fg = colors.fg, bg = colors.bg } }, -- normal = { c = { fg = colors.fg, bg = colors.bg } },
-- inactive = { c = { fg = colors.fg, bg = colors.bg } }, -- inactive = { c = { fg = colors.fg, bg = colors.bg } },
-- }, -- },
disabled_filetypes = { disabled_filetypes = {
statusline = { 'alpha' } statusline = { 'alpha' }
},
ignore_focus = { 'toggleterm', 'NvimTree' },
globalstatus = true,
}, },
ignore_focus = { 'toggleterm', 'NvimTree' }, sections = {
globalstatus = true, lualine_a = {},
}, lualine_b = {},
sections = { lualine_y = {},
lualine_a = {}, lualine_z = {},
lualine_b = {}, lualine_c = {},
lualine_y = {}, lualine_x = {},
lualine_z = {}, },
lualine_c = {}, inactive_sections = {
lualine_x = {}, lualine_a = {},
}, lualine_b = {},
inactive_sections = { lualine_y = {},
lualine_a = {}, lualine_z = {},
lualine_b = {}, lualine_c = {},
lualine_y = {}, lualine_x = {},
lualine_z = {}, }
lualine_c = {},
lualine_x = {},
}
} }
local function ins_left(component) local function ins_left(component)
table.insert(config.sections.lualine_c, component) table.insert(config.sections.lualine_c, component)
end end
local function ins_right(component) local function ins_right(component)
table.insert(config.sections.lualine_x, component) table.insert(config.sections.lualine_x, component)
end end
local function mode_color() local function mode_color()
local color = { local color = {
n = colors.red, n = colors.red,
i = colors.green, i = colors.green,
v = colors.magenta, v = colors.magenta,
[''] = colors.magenta, [''] = colors.magenta,
V = colors.magenta, V = colors.magenta,
c = colors.blue, c = colors.blue,
no = colors.red, no = colors.red,
s = colors.orange, s = colors.orange,
S = colors.orange, S = colors.orange,
[''] = colors.orange, [''] = colors.orange,
ic = colors.yellow, ic = colors.yellow,
R = colors.violet, R = colors.violet,
Rv = colors.violet, Rv = colors.violet,
cv = colors.red, cv = colors.red,
ce = colors.red, ce = colors.red,
r = colors.cyan, r = colors.cyan,
rm = colors.cyan, rm = colors.cyan,
['r?'] = colors.cyan, ['r?'] = colors.cyan,
['!'] = colors.red, ['!'] = colors.red,
t = colors.red, t = colors.red,
} }
return { fg = color[vim.fn.mode()] } return { fg = color[vim.fn.mode()] }
end end
ins_left { ins_left {
function() function()
return '' return ''
end, end,
color = function() color = function()
return mode_color() return mode_color()
end, end,
padding = { right = 1 }, padding = { right = 1 },
} }
ins_left { ins_left {
function() function()
local msg = 'No Active Lsp' local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients() local clients = vim.lsp.get_active_clients()
if next(clients) == nil then if next(clients) == nil then
return msg return msg
end end
for _, client in ipairs(clients) do for _, client in ipairs(clients) do
local filetypes = client.config.filetypes local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name return client.name
end end
end end
return msg return msg
end, end,
icon = ' LSP:', icon = ' LSP:',
color = { fg = colors.white }, color = { fg = colors.white },
} }
ins_left { ins_left {
'diagnostics', 'diagnostics',
sources = { 'nvim_diagnostic' }, sources = { 'nvim_diagnostic' },
symbols = { error = icons.diagnostics.BoldError .. ' ', warn = icons.diagnostics.BoldWarning .. ' ', symbols = { error = icons.diagnostics.BoldError .. ' ', warn = icons.diagnostics.BoldWarning .. ' ',
info = icons.diagnostics.BoldInformation }, info = icons.diagnostics.BoldInformation },
diagnostics_color = { diagnostics_color = {
color_error = { fg = colors.red }, color_error = { fg = colors.red },
color_warn = { fg = colors.yellow }, color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan }, color_info = { fg = colors.cyan },
}, },
} }
ins_left { ins_left {
function() function()
return '%=' return '%='
end, end,
} }
ins_left { ins_left {
'filename', 'filename',
color = { fg = colors.magenta, gui = 'bold' }, color = { fg = colors.magenta, gui = 'bold' },
} }
ins_left { ins_left {
function() function()
local current_line = vim.fn.line "." local current_line = vim.fn.line "."
local total_lines = vim.fn.line "$" local total_lines = vim.fn.line "$"
local chars = icons.progress local chars = icons.progress
local line_ratio = current_line / total_lines local line_ratio = current_line / total_lines
local index = math.ceil(line_ratio * #chars) local index = math.ceil(line_ratio * #chars)
return chars[index] return chars[index]
end, end,
color = { fg = colors.yellow } color = { fg = colors.yellow }
} }
ins_left { ins_left {
'%04l:%04c', '%04l:%04c',
} }
ins_right { ins_right {
'o:encoding', 'o:encoding',
fmt = string.upper, fmt = string.upper,
cond = conditions.hide_in_width, cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' }, color = { fg = colors.green, gui = 'bold' },
} }
ins_right { ins_right {
'fileformat', 'fileformat',
fmt = string.upper, fmt = string.upper,
icons_enabled = false, icons_enabled = false,
color = { fg = colors.green, gui = 'bold' }, color = { fg = colors.green, gui = 'bold' },
} }
ins_right { ins_right {
'branch', 'branch',
icon = icons.git.Branch, icon = icons.git.Branch,
color = { fg = colors.violet, gui = 'bold' }, color = { fg = colors.violet, gui = 'bold' },
} }
ins_right { ins_right {
'diff', 'diff',
symbols = { added = '', modified = '', removed = '' }, symbols = { added = '', modified = '', removed = '' },
diff_color = { diff_color = {
added = { fg = colors.green }, added = { fg = colors.green },
modified = { fg = colors.orange }, modified = { fg = colors.orange },
removed = { fg = colors.red }, removed = { fg = colors.red },
}, },
cond = conditions.hide_in_width, cond = conditions.hide_in_width,
} }
ins_right { ins_right {
function() function()
return '' return ''
end, end,
color = function() color = function()
return mode_color() return mode_color()
end, end,
padding = { left = 1 }, padding = { left = 1 },
} }
lualine.setup(config) lualine.setup(config)

View file

@ -1,11 +1,11 @@
local status_ok, luasnip = pcall(require, "LuaSnip") local status_ok, luasnip = pcall(require, "LuaSnip")
if not status_ok then if not status_ok then
return return
end end
local options = { local options = {
history = true, history = true,
updateevents = "TextChanged,TextChangedI", updateevents = "TextChanged,TextChangedI",
} }
luasnip.config.set_config(options) luasnip.config.set_config(options)
@ -13,11 +13,11 @@ require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_pat
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
vim.api.nvim_create_autocmd("InsertLeave", { vim.api.nvim_create_autocmd("InsertLeave", {
callback = function() callback = function()
if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active and not require("luasnip").session.jump_active
then then
require("luasnip").unlink_current() require("luasnip").unlink_current()
end end
end, end,
}) })

View file

@ -1,21 +1,21 @@
local status_ok, mason = pcall(require, 'mason') local status_ok, mason = pcall(require, 'mason')
if not status_ok then if not status_ok then
return return
end end
local icons = require('config.iconlist') local icons = require('config.icons').list
local settings = { local settings = {
ui = { ui = {
border = "none", border = "none",
icons = { icons = {
package_installed = icons.ui.Check, package_installed = icons.ui.Check,
package_pending = icons.ui.BoldArrowRight, package_pending = icons.ui.BoldArrowRight,
package_uninstalled = icons.ui.BoldClose, package_uninstalled = icons.ui.BoldClose,
},
}, },
}, log_level = vim.log.levels.INFO,
log_level = vim.log.levels.INFO, max_concurrent_installers = 4,
max_concurrent_installers = 4,
} }
mason.setup(settings) mason.setup(settings)

View file

@ -1,6 +1,6 @@
local null_ls_status_ok, null_ls = pcall(require, 'null-ls') local null_ls_status_ok, null_ls = pcall(require, 'null-ls')
if not null_ls_status_ok then if not null_ls_status_ok then
return return
end end
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
@ -12,10 +12,10 @@ local diagnostics = null_ls.builtins.diagnostics
-- https://github.com/LunarVim/LunarVim/blob/master/lua/lvim/lsp/utils.lua#L172 -- https://github.com/LunarVim/LunarVim/blob/master/lua/lvim/lsp/utils.lua#L172
null_ls.setup { null_ls.setup {
debug = false, debug = false,
sources = { sources = {
formatting.black.with { extra_args = { "--fast" } }, formatting.black.with { extra_args = { "--fast" } },
-- formatting.stylua, -- formatting.stylua,
-- diagnostics.flake8, -- diagnostics.flake8,
}, },
} }

View file

@ -1,13 +1,13 @@
local status_ok, colorizer = pcall(require, 'colorizer') local status_ok, colorizer = pcall(require, 'colorizer')
if not status_ok then if not status_ok then
return return
end end
colorizer.setup({ '*' }, { colorizer.setup({ '*' }, {
RGB = true, -- #RGB hex codes RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes RRGGBB = true, -- #RRGGBB hex codes
RRGGBBAA = true, -- #RRGGBBAA hex codes RRGGBBAA = true, -- #RRGGBBAA hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
}) })

View file

@ -1,18 +1,18 @@
local status_ok, project = pcall(require, 'project_nvim') local status_ok, project = pcall(require, 'project_nvim')
if not status_ok then if not status_ok then
return return
end end
project.setup({ project.setup({
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
detection_methods = { "pattern" }, detection_methods = { "pattern" },
-- patterns used to detect root dir, when **"pattern"** is in detection_methods -- patterns used to detect root dir, when **"pattern"** is in detection_methods
patterns = { ".git", "Makefile", "package.json" }, patterns = { ".git", "Makefile", "package.json" },
}) })
local tele_status_ok, telescope = pcall(require, 'telescope') local tele_status_ok, telescope = pcall(require, 'telescope')
if not tele_status_ok then if not tele_status_ok then
return return
end end
telescope.load_extension('projects') telescope.load_extension('projects')

View file

@ -1,67 +1,67 @@
local status_ok, telescope = pcall(require, 'telescope') local status_ok, telescope = pcall(require, 'telescope')
if not status_ok then if not status_ok then
return return
end end
local icons = require('config.iconlist') local icons = require('config.icons').list
telescope.setup { telescope.setup {
defaults = { defaults = {
prompt_prefix = icons.ui.Telescope, prompt_prefix = icons.ui.Telescope,
selection_caret = icons.ui.Forward, selection_caret = icons.ui.Forward,
file_ignore_patterns = { ".git/", "node_modules" }, file_ignore_patterns = { ".git/", "node_modules" },
}, },
} }
telescope.setup { telescope.setup {
defaults = { defaults = {
vimgrep_arguments = { vimgrep_arguments = {
"rg", "rg",
"-L", "-L",
"--color=never", "--color=never",
"--no-heading", "--no-heading",
"--with-filename", "--with-filename",
"--line-number", "--line-number",
"--column", "--column",
"--smart-case", "--smart-case",
},
prompt_prefix = " " .. icons.ui.Search .. " ",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { ".git/", "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
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,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
}, },
prompt_prefix = " " .. icons.ui.Search .. " ",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { ".git/", "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
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,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
} }

View file

@ -1,10 +1,10 @@
local status_ok, todo_comments = pcall(require, 'todo-comments') local status_ok, todo_comments = pcall(require, 'todo-comments')
if not status_ok then if not status_ok then
return return
end end
todo_comments.setup({ todo_comments.setup({
highlight = { highlight = {
multiline = false, multiline = false,
comments_only = false comments_only = false
} }
}) })

View file

@ -1,33 +1,33 @@
local status_ok, toggleterm = pcall(require, 'toggleterm') local status_ok, toggleterm = pcall(require, 'toggleterm')
if not status_ok then if not status_ok then
return return
end end
toggleterm.setup({ toggleterm.setup({
size = 20, size = 20,
open_mapping = [[<c-\>]], open_mapping = [[<c-\>]],
hide_numbers = true, hide_numbers = true,
shade_terminals = true, shade_terminals = true,
shading_factor = 2, shading_factor = 2,
start_in_insert = true, start_in_insert = true,
insert_mappings = true, insert_mappings = true,
persist_size = true, persist_size = true,
direction = "float", direction = "float",
close_on_exit = true, close_on_exit = true,
shell = vim.o.shell, shell = vim.o.shell,
float_opts = { float_opts = {
winblend = 0, winblend = 0,
highlights = { highlights = {
border = "Normal", border = "Normal",
background = "Normal", background = "Normal",
},
border = "rounded",
}, },
border = "rounded",
},
}) })
local Terminal = require("toggleterm.terminal").Terminal local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
function _LAZYGIT_TOGGLE() function _LAZYGIT_TOGGLE()
lazygit:toggle() lazygit:toggle()
end end

View file

@ -1,12 +1,12 @@
local status_ok, tokyonight = pcall(require, 'tokyonight') local status_ok, tokyonight = pcall(require, 'tokyonight')
if not status_ok then if not status_ok then
return return
end end
tokyonight.setup({ tokyonight.setup({
transparent = true, transparent = true,
terminal_colors = true, terminal_colors = true,
dim_inactive = true, dim_inactive = true,
lualine_bold = true, lualine_bold = true,
}) })
vim.cmd [[colorscheme tokyonight]] vim.cmd [[colorscheme tokyonight]]

View file

@ -1,15 +1,15 @@
local status_ok, configs = pcall(require, 'nvim-treesitter.configs') local status_ok, configs = pcall(require, 'nvim-treesitter.configs')
if not status_ok then if not status_ok then
return return
end end
configs.setup({ configs.setup({
ensure_installed = { "lua", "bash", "c" }, ensure_installed = { "lua", "bash", "c" },
auto_install = true, auto_install = true,
autopairs = { autopairs = {
enable = false, enable = false,
}, },
context_commentstring = { context_commentstring = {
enable = true, enable = true,
enable_autocmd = false, enable_autocmd = false,
}, },
}) })

View file

@ -1,51 +1,51 @@
local status_ok, whichkey = pcall(require, 'which-key') local status_ok, whichkey = pcall(require, 'which-key')
if not status_ok then if not status_ok then
return return
end end
local icons = require('config.iconlist') local icons = require('config.icons').list
whichkey.setup { whichkey.setup {
marks = false, marks = false,
registers = false, registers = false,
presets = { presets = {
operators = false, operators = false,
motions = false, motions = false,
text_objects = false, text_objects = false,
windows = false, windows = false,
nav = false, nav = false,
z = false, z = false,
g = false, g = false,
}, },
spelling = { spelling = {
enabled = false, enabled = false,
suggestions = 20, suggestions = 20,
}, },
icons = { icons = {
breadcrumb = icons.ui.DoubleChevronRight, breadcrumb = icons.ui.DoubleChevronRight,
separator = icons.ui.BoldArrowRight, separator = icons.ui.BoldArrowRight,
group = icons.ui.Plus, group = icons.ui.Plus,
}, },
popup_mappings = { popup_mappings = {
scroll_down = "<c-d>", scroll_down = "<c-d>",
scroll_up = "<c-u>", scroll_up = "<c-u>",
}, },
window = { window = {
border = "single", border = "single",
position = "bottom", position = "bottom",
margin = { 1, 0, 1, 0 }, margin = { 1, 0, 1, 0 },
padding = { 2, 2, 2, 2 }, padding = { 2, 2, 2, 2 },
winblend = 0, winblend = 0,
}, },
layout = { layout = {
height = { min = 4, max = 25 }, height = { min = 4, max = 25 },
width = { min = 20, max = 50 }, width = { min = 20, max = 50 },
spacing = 3, spacing = 3,
align = "left", align = "left",
}, },
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
triggers = "auto", triggers = "auto",
triggers_blacklist = { triggers_blacklist = {
i = { "j", "k" }, i = { "j", "k" },
v = { "j", "k", "c", "y", "d", "v" }, v = { "j", "k", "c", "y", "d", "v" },
}, },
} }

View file

@ -1,244 +1,250 @@
local icons = require "config.iconlist" local icons = require('config.icons').list
local plugins = { local plugins = {
{ "wbthomason/packer.nvim", { "wbthomason/packer.nvim",
config = function() config = function()
require('funcs').map("packer") require('funcs').map("packer")
end end
}, },
{ "nvim-lua/plenary.nvim" }, { "nvim-lua/plenary.nvim" },
{ "lewis6991/impatient.nvim" }, { "lewis6991/impatient.nvim" },
{ "tpope/vim-surround", { "tpope/vim-surround",
setup = function() setup = function()
require('funcs').on_file_open("vim-surround") require('funcs').on_file_open("vim-surround")
end end
}, },
{ "tpope/vim-repeat", { "tpope/vim-repeat",
setup = function() setup = function()
require('funcs').on_file_open("vim-repeat") require('funcs').on_file_open("vim-repeat")
end end
}, },
{ "fladson/vim-kitty", { "fladson/vim-kitty",
ft = "kitty" ft = "kitty"
}, },
{ "kyazdani42/nvim-web-devicons" }, { "kyazdani42/nvim-web-devicons" },
{ "felipec/vim-sanegx", { "felipec/vim-sanegx",
setup = function() setup = function()
require('funcs').on_file_open("vim-sanegx") require('funcs').on_file_open("vim-sanegx")
end end
}, },
{ "folke/which-key.nvim", { "folke/which-key.nvim",
config = function() config = function()
require('plugins.config.whichkey') require('plugins.config.whichkey')
end, end,
}, },
{ "folke/tokyonight.nvim", { "folke/tokyonight.nvim",
config = function() config = function()
require('plugins.config.tokyonight') require('plugins.config.tokyonight')
end end
}, },
{ "folke/todo-comments.nvim", { "folke/todo-comments.nvim",
setup = function() setup = function()
require('funcs').on_file_open("todo-comments.nvim") require('funcs').on_file_open("todo-comments.nvim")
end, end,
config = function() config = function()
require('plugins.config.todo-comments') require('plugins.config.todo-comments')
end end
}, },
{ "akinsho/bufferline.nvim", { "akinsho/bufferline.nvim",
setup = function() setup = function()
require('funcs').on_file_open("bufferline.nvim") require('funcs').on_file_open("bufferline.nvim")
require('funcs').map("bufferline") require('funcs').map("bufferline")
end, end,
config = function() config = function()
require('plugins.config.bufferline') require('plugins.config.bufferline')
end, end,
}, },
{ "nvim-lualine/lualine.nvim", { "nvim-lualine/lualine.nvim",
setup = function() setup = function()
require('funcs').on_file_open("lualine.nvim") require('funcs').on_file_open("lualine.nvim")
end, end,
config = function() config = function()
require('plugins.config.lualine') require('plugins.config.lualine')
end, end,
}, },
{ "akinsho/toggleterm.nvim", { "akinsho/toggleterm.nvim",
config = function() config = function()
require('plugins.config.toggleterm') require('plugins.config.toggleterm')
end, end,
}, },
{ "lukas-reineke/indent-blankline.nvim", { "lukas-reineke/indent-blankline.nvim",
after = "nvim-treesitter", after = "nvim-treesitter",
setup = function() setup = function()
require('funcs').on_file_open("indent-blankline.nvim") require('funcs').on_file_open("indent-blankline.nvim")
require('funcs').map("blankline") require('funcs').map("blankline")
end, end,
config = function() config = function()
require('plugins.config.indent-blankline') require('plugins.config.indent-blankline')
end, end,
}, },
{ "norcalli/nvim-colorizer.lua", { "norcalli/nvim-colorizer.lua",
setup = function() setup = function()
require('funcs').on_file_open("nvim-colorizer.lua") require('funcs').on_file_open("nvim-colorizer.lua")
end, end,
config = function() config = function()
require('plugins.config.nvim-colorizer') require('plugins.config.nvim-colorizer')
end, end,
}, },
{ "RRethy/vim-illuminate", { "RRethy/vim-illuminate",
setup = function() setup = function()
require('funcs').on_file_open("vim-illuminate") require('funcs').on_file_open("vim-illuminate")
require('funcs').map("illuminate") require('funcs').map("illuminate")
end, end,
config = function() config = function()
require('plugins.config.illuminate') require('plugins.config.illuminate')
end, end,
}, },
{ "nvim-treesitter/nvim-treesitter", { "nvim-treesitter/nvim-treesitter",
setup = function() setup = function()
require('funcs').on_file_open("nvim-treesitter") require('funcs').on_file_open("nvim-treesitter")
end, end,
cmd = { cmd = {
"TSInstall", "TSInstall",
"TSBufEnable", "TSBufEnable",
"TSBufDisable", "TSBufDisable",
"TSEnable", "TSEnable",
"TSDisable", "TSDisable",
"TSModuleInfo" "TSModuleInfo"
},
run = ":TSUpdate",
config = function()
require('plugins.config.treesitter')
end,
},
{ "lewis6991/gitsigns.nvim",
ft = "gitcommit",
setup = function()
require('funcs').gitsigns()
end,
config = function()
require('plugins.config.gitsigns')
end,
},
{ "williamboman/mason.nvim",
setup = function()
require('funcs').map("mason")
end,
config = function()
require "plugins.config.mason"
end,
},
{ "williamboman/mason-lspconfig.nvim" },
{ "neovim/nvim-lspconfig",
after = "mason-lspconfig.nvim",
setup = function()
require('funcs').on_file_open("nvim-lspconfig")
require('funcs').map("lspconfig")
end,
config = function()
require('plugins.config.lspconfig')
end,
},
{ "jose-elias-alvarez/null-ls.nvim",
config = function()
require('plugins.config.null-ls')
end,
},
{ "rcarriga/nvim-dap-ui",
after = "nvim-dap",
setup = function()
require('funcs').on_file_open("nvim-dap-ui")
end,
config = function()
require('plugins.config.dapui')
end,
},
{ "mfussenegger/nvim-dap",
setup = function()
require('funcs').on_file_open("nvim-dap")
require('funcs').map("dap")
end,
config = function()
require('plugins.config.dap')
end,
},
{ "olical/aniseed" },
{ "olical/conjure" },
{ "rafamadriz/friendly-snippets",
event = "InsertEnter",
module = { "cmp", "cmp_nvim_lsp" },
},
{ "hrsh7th/nvim-cmp",
after = "friendly-snippets",
config = function()
require('plugins.config.cmp')
end,
},
{ "L3MON4D3/LuaSnip",
after = "nvim-cmp",
config = function()
require('plugins.config.luasnip')
end,
},
{ "saadparwaiz1/cmp_luasnip", after = "LuaSnip" },
{ "hrsh7th/cmp-nvim-lua", after = "cmp_luasnip" },
{ "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",
config = function()
require('plugins.config.autopairs')
end,
},
{ "goolord/alpha-nvim",
config = function()
require('plugins.config.alpha')
end,
},
{ "numToStr/Comment.nvim",
config = function()
require('plugins.config.comment')
end,
setup = function()
require('funcs').on_file_open("Comment.nvim")
require('funcs').map("comment")
end,
},
{ "lmburns/lf.nvim",
config = function()
require('plugins.config.lf')
require('funcs').map("lf")
end
},
{ "nvim-telescope/telescope.nvim",
config = function()
require('plugins.config.telescope')
require('funcs').map("telescope")
end,
},
{ "ahmedkhalf/project.nvim",
after = "telescope.nvim",
config = function()
require('plugins.config.project')
end,
}, },
run = ":TSUpdate",
config = function()
require('plugins.config.treesitter')
end,
},
{ "lewis6991/gitsigns.nvim",
ft = "gitcommit",
setup = function()
require('funcs').gitsigns()
end,
config = function()
require('plugins.config.gitsigns')
end,
},
{ "williamboman/mason.nvim",
setup = function()
require('funcs').map("mason")
end,
config = function()
require "plugins.config.mason"
end,
},
{ "williamboman/mason-lspconfig.nvim" },
{ "neovim/nvim-lspconfig",
after = "mason-lspconfig.nvim",
setup = function()
require('funcs').on_file_open("nvim-lspconfig")
require('funcs').map("lspconfig")
end,
config = function()
require('plugins.config.lspconfig')
end,
},
{ "jose-elias-alvarez/null-ls.nvim",
config = function()
require('plugins.config.null-ls')
end,
},
{ "rcarriga/nvim-dap-ui",
after = "nvim-dap",
setup = function()
require('funcs').on_file_open("nvim-dap-ui")
end,
config = function()
require('plugins.config.dapui')
end,
},
{ "mfussenegger/nvim-dap",
setup = function()
require('funcs').on_file_open("nvim-dap")
require('funcs').map("dap")
end,
config = function()
require('plugins.config.dap')
end,
},
{ "rafamadriz/friendly-snippets",
event = "InsertEnter",
module = { "cmp", "cmp_nvim_lsp" },
},
{ "hrsh7th/nvim-cmp",
after = "friendly-snippets",
config = function()
require('plugins.config.cmp')
end,
},
{ "L3MON4D3/LuaSnip",
after = "nvim-cmp",
config = function()
require('plugins.config.luasnip')
end,
},
{ "saadparwaiz1/cmp_luasnip", after = "LuaSnip" },
{ "hrsh7th/cmp-nvim-lua", after = "cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp", after = "cmp-nvim-lua" },
{ "hrsh7th/cmp-buffer", after = "cmp-nvim-lsp" },
{ "hrsh7th/cmp-path", after = "cmp-buffer" },
{ "onsails/lspkind.nvim" },
{ "windwp/nvim-autopairs",
after = "nvim-cmp",
config = function()
require('plugins.config.autopairs')
end,
},
{ "goolord/alpha-nvim",
config = function()
require('plugins.config.alpha')
end,
},
{ "numToStr/Comment.nvim",
config = function()
require('plugins.config.comment')
end,
setup = function()
require('funcs').on_file_open("Comment.nvim")
require('funcs').map("comment")
end,
},
{ "lmburns/lf.nvim",
config = function()
require('plugins.config.lf')
require('funcs').map("lf")
end
},
{ "nvim-telescope/telescope.nvim",
config = function()
require('plugins.config.telescope')
require('funcs').map("telescope")
end,
},
{ "ahmedkhalf/project.nvim",
after = "telescope.nvim",
config = function()
require('plugins.config.project')
end,
},
} }
local status_ok, packer = pcall(require, "packer") local status_ok, packer = pcall(require, "packer")
if not status_ok then if not status_ok then
return return
end end
vim.cmd "packadd packer.nvim" vim.cmd "packadd packer.nvim"
packer.init { packer.init {
git = { clone_timeout = 6000 }, git = { clone_timeout = 6000 },
display = { display = {
working_sym = icons.misc.Watch, working_sym = icons.misc.Watch,
error_sym = icons.ui.Close, error_sym = icons.ui.Close,
done_sym = icons.ui.Check, done_sym = icons.ui.Check,
removed_sym = icons.ui.MinusCircle, removed_sym = icons.ui.MinusCircle,
moved_sym = icons.ui.Forward, moved_sym = icons.ui.Forward,
open_fn = function() open_fn = function()
return require('packer.util').float { border = "single" } return require('packer.util').float { border = "single" }
end end
} }
} }
packer.startup { plugins } packer.startup { plugins }

View file