add neovim back to this repo
fix nvim directory
This commit is contained in:
parent
d913a78447
commit
3ab8308615
43 changed files with 2263 additions and 1 deletions
|
@ -1 +0,0 @@
|
|||
Subproject commit 5d5148ee33960877240faf91ec63ae986f4987be
|
7
.config/nvim/init.lua
Normal file
7
.config/nvim/init.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
vim.loader.enable()
|
||||
require('config.options')
|
||||
require('lazy-init')
|
||||
require('config.autocmds')
|
||||
require('config.filetypes')
|
||||
require('config.keymaps')
|
||||
require('funcs').set_title()
|
37
.config/nvim/lazy-lock.json
Normal file
37
.config/nvim/lazy-lock.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "cab667e2674881001a86a7478fff7dc7791c63f5" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "9e8d2f695dd50ab6821a6a53a840c32d2067a78a" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "5fc573f2d2a49aec74dd6dc977e8b137429d1897" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||
"lf.nvim": { "branch": "master", "commit": "69ab1efcffee6928bf68ac9bd0c016464d9b2c8b" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3d9e06ca604185ea5675d3c2ffd4284e0c2c7ffc" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "5b4db7c0d6873436b42bcda0ba7cd4efa9206745" },
|
||||
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
|
||||
"nvim-dap": { "branch": "master", "commit": "e154fdb6d70b3765d71f296e718b29d8b7026a63" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "553c4e0e667167640c5398573f6f3a488ff8047a" },
|
||||
"nvim-surround": { "branch": "main", "commit": "0855a89e00a5822c3a482a82e5223fcf2e9ede13" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "71bdf97bf6dafc776ad957169533f2f669a8c562" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "cdbcca210cf3655aa9b31ebf2422763ecd85ee5c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "fb0c365534e7ee327b30205beff3f3a708dcba33" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" },
|
||||
"vimtex": { "branch": "master", "commit": "283252ffe38bbd79dfa08366552abada824cbdda" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
|
||||
"wiki.vim": { "branch": "master", "commit": "65b67f3669a0db078dab2750d3c51c680ee14df1" }
|
||||
}
|
109
.config/nvim/lua/config/autocmds.lua
Normal file
109
.config/nvim/lua/config/autocmds.lua
Normal file
|
@ -0,0 +1,109 @@
|
|||
local autocmds = {
|
||||
{ -- 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 = { "*/bookmarks/files", "*/bookmarks/directories" },
|
||||
command = "!shortcuts"
|
||||
}
|
||||
},
|
||||
{
|
||||
{ "BufRead", "BufNewFile" },
|
||||
{
|
||||
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
|
||||
command = "set filetype=xdefaults"
|
||||
}
|
||||
},
|
||||
{
|
||||
"BufWritePost",
|
||||
{
|
||||
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
|
||||
command = "!xrdb %"
|
||||
}
|
||||
},
|
||||
{
|
||||
"BufWritePost",
|
||||
{
|
||||
pattern = "*/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,
|
||||
}
|
||||
},
|
||||
{ -- Fix auto comment
|
||||
'BufWinEnter',
|
||||
{
|
||||
command = "set formatoptions-=cro"
|
||||
}
|
||||
},
|
||||
{ -- Highlight yanked text
|
||||
'TextYankPost',
|
||||
{
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.api.nvim_create_augroup('user_config', { clear = true })
|
||||
for _, entry in ipairs(autocmds) 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
|
16
.config/nvim/lua/config/dirs.lua
Normal file
16
.config/nvim/lua/config/dirs.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
h = '/home/luca',
|
||||
ch = '/home/luca/.cache',
|
||||
cf = '/home/luca/.config',
|
||||
dt = '/home/luca/.local/share',
|
||||
sr = '/home/luca/.local/src',
|
||||
it = '/home/luca/.local/src/git',
|
||||
sc = '/home/luca/.local/bin',
|
||||
mn = '/mnt',
|
||||
dl = '/home/luca/Downloads',
|
||||
dm = '/home/luca/Documents',
|
||||
ms = '/home/luca/Music',
|
||||
pc = '/home/luca/Pictures',
|
||||
vd = '/home/luca/Videos',
|
||||
dot = '/home/luca/.local/share/stow/dots',
|
||||
}
|
21
.config/nvim/lua/config/filetypes.lua
Normal file
21
.config/nvim/lua/config/filetypes.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
local ansible_test = function(path, bufnr)
|
||||
local find = { 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars', 'ansible.cfg', '.ansible-lint' }
|
||||
local opts = { stop = os.getenv("HOME"), upward = true, limit = 1, path = path }
|
||||
if (next(vim.fs.find(find, opts)) ~= nil) then
|
||||
return 'yaml.ansible'
|
||||
else
|
||||
return 'yaml'
|
||||
end
|
||||
end
|
||||
local filetypes = {
|
||||
{
|
||||
extension = {
|
||||
yml = ansible_test,
|
||||
yaml = ansible_test
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, entry in pairs(filetypes) do
|
||||
vim.filetype.add(entry)
|
||||
end
|
162
.config/nvim/lua/config/icons.lua
Normal file
162
.config/nvim/lua/config/icons.lua
Normal file
|
@ -0,0 +1,162 @@
|
|||
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 = "",
|
||||
CMD = "",
|
||||
Code = "",
|
||||
Comment = "",
|
||||
Dashboard = "",
|
||||
DividerLeft = "",
|
||||
DividerRight = "",
|
||||
DoubleChevronRight = "",
|
||||
DoubleChevronLeft = "",
|
||||
Ellipsis = "…",
|
||||
EmptyFolder = "",
|
||||
EmptyFolderOpen = "",
|
||||
File = "",
|
||||
FileSymlink = "",
|
||||
Files = "",
|
||||
FindFile = "",
|
||||
FindText = "",
|
||||
Fire = "",
|
||||
Folder = "",
|
||||
FolderOpen = "",
|
||||
FolderSymlink = "",
|
||||
Forward = "",
|
||||
Gear = "",
|
||||
History = "",
|
||||
Import = "",
|
||||
Keyboard = "",
|
||||
Lightbulb = "",
|
||||
LineLeft = "▏",
|
||||
LineMiddle = "│",
|
||||
List = "",
|
||||
Lock = "",
|
||||
MinusCircle = "",
|
||||
NewFile = "",
|
||||
Note = "",
|
||||
Package = "",
|
||||
Pencil = "",
|
||||
Plus = "",
|
||||
Project = "",
|
||||
Search = "",
|
||||
SignIn = "",
|
||||
SignOut = "",
|
||||
Sleep = "",
|
||||
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 = "",
|
||||
Vim = "",
|
||||
},
|
||||
}
|
72
.config/nvim/lua/config/keymaps.lua
Normal file
72
.config/nvim/lua/config/keymaps.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
local maps = {
|
||||
n = {
|
||||
-- Navigate buffers
|
||||
{ "<C-l>", ":bnext<CR>" },
|
||||
{ "<C-h>", ":bprevious<CR>" },
|
||||
-- lsp
|
||||
{ "gD", vim.lsp.buf.declaration },
|
||||
{ "gd", vim.lsp.buf.definition },
|
||||
{ "K", vim.lsp.buf.hover },
|
||||
{ "gI", vim.lsp.buf.implementation },
|
||||
{ "gr", vim.lsp.buf.references },
|
||||
{ "gl", vim.diagnostic.open_float },
|
||||
},
|
||||
i = {
|
||||
-- Delete last word with ctrl + del
|
||||
{ "<C-BS>", "<C-W>" },
|
||||
},
|
||||
v = {
|
||||
-- Better paste
|
||||
{ "p", '"_dP' },
|
||||
},
|
||||
}
|
||||
|
||||
local wkmaps = {
|
||||
n = {
|
||||
["w"] = { "<cmd>w!<CR>", "Save" },
|
||||
["q"] = { require("funcs").buf_kill, "Close" },
|
||||
["h"] = { "<cmd>nohlsearch<CR>", "Clear Highlights" },
|
||||
["n"] = { "<cmd>ene<CR>", "New File" },
|
||||
u = {
|
||||
name = "Utility",
|
||||
c = { "<cmd>w!<CR><cmd>!compiler \"%:p\"<CR>", "Compile" },
|
||||
},
|
||||
l = {
|
||||
name = "LSP",
|
||||
a = { vim.lsp.buf.code_action, "Code Action" },
|
||||
f = { function() require("funcs").format({ async = true }) end, "Format" },
|
||||
j = { vim.diagnostic.goto_next, "Next Diagnostic" },
|
||||
k = { vim.diagnostic.goto_prev, "Prev Diagnostic" },
|
||||
l = { vim.lsp.codelens.run, "CodeLens Action" },
|
||||
q = { vim.diagnostic.setloclist, "Quickfix" },
|
||||
r = { vim.lsp.buf.rename, "Rename" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local whichkey = require('which-key')
|
||||
|
||||
for mode, binds in pairs(maps) do
|
||||
for _, bind in pairs(binds) do
|
||||
local key = bind[1]
|
||||
local cmd = ""
|
||||
local opt = { silent = true, noremap = true }
|
||||
if type(bind[2]) == "string" then
|
||||
cmd = bind[2]
|
||||
elseif type(bind[2]) == "function" then
|
||||
opt["callback"] = bind[2]
|
||||
end
|
||||
vim.api.nvim_set_keymap(mode, key, cmd, opt)
|
||||
end
|
||||
end
|
||||
|
||||
for mode, binds in pairs(wkmaps) do
|
||||
whichkey.register(binds, {
|
||||
mode = mode,
|
||||
prefix = "<leader>",
|
||||
buffer = nil,
|
||||
silent = true,
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
})
|
||||
end
|
45
.config/nvim/lua/config/options.lua
Normal file
45
.config/nvim/lua/config/options.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
local g = vim.g
|
||||
local o = vim.opt
|
||||
local d = vim.diagnostic.config
|
||||
|
||||
g.mapleader = " "
|
||||
g.maplocalleader = " "
|
||||
|
||||
o.undodir = vim.fn.stdpath "cache" .. "/undo"
|
||||
o.clipboard = "unnamedplus"
|
||||
o.conceallevel = 0
|
||||
o.numberwidth = 3
|
||||
o.hlsearch = true
|
||||
o.ignorecase = true
|
||||
o.showmode = false
|
||||
o.smartindent = true
|
||||
o.splitbelow = true
|
||||
o.splitbelow = true
|
||||
o.splitbelow = true
|
||||
o.updatetime = 250
|
||||
o.writebackup = false
|
||||
o.expandtab = true
|
||||
o.shiftwidth = 4
|
||||
o.tabstop = 4
|
||||
o.cursorline = true
|
||||
o.signcolumn = "yes"
|
||||
o.wrap = false
|
||||
o.scrolloff = 8
|
||||
o.sidescrolloff = 8
|
||||
o.undofile = true
|
||||
o.title = true
|
||||
o.mouse = ""
|
||||
|
||||
o.termguicolors = true
|
||||
o.timeoutlen = 500
|
||||
o.foldmethod = "expr"
|
||||
o.foldlevelstart = 99
|
||||
o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.laststatus = 3
|
||||
o.modeline = true
|
||||
o.modelines = 3
|
||||
o.listchars = "eol:$,tab:>-,trail:~,extends:>,precedes:<"
|
||||
|
||||
d({ virtual_text = false })
|
111
.config/nvim/lua/funcs.lua
Normal file
111
.config/nvim/lua/funcs.lua
Normal file
|
@ -0,0 +1,111 @@
|
|||
local M = {}
|
||||
|
||||
function M.set_title()
|
||||
local title = " %t"
|
||||
local f = io.popen([[zsh -c '
|
||||
source $XDG_CONFIG_HOME/zsh/configs/autogenerated/hashes
|
||||
print -Pn "$USER@$HOST [%3~] "
|
||||
']])
|
||||
if f ~= nil then
|
||||
title = f:read("*a") or ""
|
||||
title = title .. " %t"
|
||||
f:close()
|
||||
end
|
||||
vim.opt.titlestring = title
|
||||
end
|
||||
|
||||
function M.format_filter(client)
|
||||
local filetype = vim.bo.filetype
|
||||
local n = require "null-ls"
|
||||
local s = require "null-ls.sources"
|
||||
local method = n.methods.FORMATTING
|
||||
local available_formatters = s.get_available(filetype, method)
|
||||
|
||||
if #available_formatters > 0 then
|
||||
return client.name == "null-ls"
|
||||
elseif client.supports_method "textDocument/formatting" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function M.format(opts)
|
||||
opts = opts or {}
|
||||
opts.filter = opts.filter or M.format_filter
|
||||
return vim.lsp.buf.format(opts)
|
||||
end
|
||||
|
||||
-- Modified version of a function stolen from LunarVim
|
||||
function M.buf_kill(kill_command, bufnr, force)
|
||||
kill_command = kill_command or "bd"
|
||||
|
||||
local bo = vim.bo
|
||||
local api = vim.api
|
||||
local fmt = string.format
|
||||
local fnamemodify = vim.fn.fnamemodify
|
||||
|
||||
if bufnr == 0 or bufnr == nil then
|
||||
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
|
||||
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 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 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
|
||||
|
||||
return M
|
13
.config/nvim/lua/lazy-init.lua
Normal file
13
.config/nvim/lua/lazy-init.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
require("lazy").setup('plugins', require('plugins.lazy').opts)
|
122
.config/nvim/lua/plugins/cmp/cmp.lua
Normal file
122
.config/nvim/lua/plugins/cmp/cmp.lua
Normal file
|
@ -0,0 +1,122 @@
|
|||
local M = { "hrsh7th/nvim-cmp" }
|
||||
|
||||
M.dependencies = {
|
||||
{ "onsails/lspkind.nvim" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
"LuaSnip",
|
||||
"nvim-autopairs",
|
||||
}
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
local opts = function()
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local cmp_window = require('cmp.utils.window')
|
||||
cmp_window.info_ = cmp_window.info
|
||||
cmp_window.info = function(self)
|
||||
local info = self:info_()
|
||||
info.scrollable = false
|
||||
return info
|
||||
end
|
||||
|
||||
local luasnip = require('luasnip')
|
||||
local cmp = require('cmp')
|
||||
|
||||
return {
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||
col_offset = -3,
|
||||
side_padding = 0,
|
||||
},
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(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 })
|
||||
kind.kind = " " .. (strings[1] or "") .. " "
|
||||
kind.menu = " (" .. (strings[2] or "") .. ")"
|
||||
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-j>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-k>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<CR>"] = cmp.mapping({
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm({ select = true }),
|
||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
}),
|
||||
["<C-e>"] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
M.config = function()
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
local cmp = require('cmp')
|
||||
cmp.setup(opts())
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
4
.config/nvim/lua/plugins/cmp/init.lua
Normal file
4
.config/nvim/lua/plugins/cmp/init.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
require('plugins.cmp.luasnip'),
|
||||
require('plugins.cmp.cmp'),
|
||||
}
|
47
.config/nvim/lua/plugins/cmp/luasnip.lua
Normal file
47
.config/nvim/lua/plugins/cmp/luasnip.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
local M = { "L3MON4D3/LuaSnip" }
|
||||
|
||||
M.build = "make install_jsregexp"
|
||||
|
||||
local opts = function()
|
||||
local luasnip = require('luasnip')
|
||||
local f = luasnip.function_node
|
||||
return {
|
||||
history = true,
|
||||
enable_autosnippets = true,
|
||||
update_events = { "TextChanged", "TextChangedI" },
|
||||
snip_env = {
|
||||
s = function(...)
|
||||
local snip = luasnip.s(...)
|
||||
table.insert(getfenv(2).ls_file_snippets, snip)
|
||||
end,
|
||||
parse = function(...)
|
||||
local snip = luasnip.parser.parse_snippet(...)
|
||||
table.insert(getfenv(2).ls_file_snippets, snip)
|
||||
end,
|
||||
reference = function(node)
|
||||
return f(function(args, _) return args[1][1] end, node)
|
||||
end,
|
||||
capture = function(index)
|
||||
return f(function(_, snip, user_arg1) return snip.captures[user_arg1] end, nil, { user_args = { index } })
|
||||
end
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.config = function()
|
||||
require('luasnip').setup(opts())
|
||||
require('luasnip.loaders.from_lua').load({ paths = os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua/snippets" })
|
||||
--require('luasnip.loaders.from_vscode').load({ paths = os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua/snippets" })
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
local luasnip = require('luasnip')
|
||||
if luasnip.session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
and not luasnip.session.jump_active
|
||||
then
|
||||
luasnip.unlink_current()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
25
.config/nvim/lua/plugins/dap/dap-ui.lua
Normal file
25
.config/nvim/lua/plugins/dap/dap-ui.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local M = { "rcarriga/nvim-dap-ui" }
|
||||
|
||||
local opts = {}
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>du", function() require("dapui").toggle({}) end, desc = "Dap UI" },
|
||||
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = { "n", "v" } },
|
||||
}
|
||||
|
||||
M.config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
dapui.setup(opts)
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open({})
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
112
.config/nvim/lua/plugins/dap/dap.lua
Normal file
112
.config/nvim/lua/plugins/dap/dap.lua
Normal file
|
@ -0,0 +1,112 @@
|
|||
local M = { "mfussenegger/nvim-dap" }
|
||||
|
||||
M.dependencies = {
|
||||
"mason-nvim-dap.nvim",
|
||||
"nvim-dap-ui",
|
||||
}
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<leader>dB",
|
||||
function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end,
|
||||
desc = "Breakpoint Condition"
|
||||
},
|
||||
{
|
||||
"<leader>db",
|
||||
function() require("dap").toggle_breakpoint() end,
|
||||
desc = "Toggle Breakpoint"
|
||||
},
|
||||
{
|
||||
"<leader>dc",
|
||||
function() require("dap").continue() end,
|
||||
desc = "Continue"
|
||||
},
|
||||
{
|
||||
"<leader>dC",
|
||||
function() require("dap").run_to_cursor() end,
|
||||
desc = "Run to Cursor"
|
||||
},
|
||||
{
|
||||
"<leader>dg",
|
||||
function() require("dap").goto_() end,
|
||||
desc = "Go to line (no execute)"
|
||||
},
|
||||
{
|
||||
"<leader>di",
|
||||
function() require("dap").step_into() end,
|
||||
desc = "Step Into"
|
||||
},
|
||||
{
|
||||
"<leader>dj",
|
||||
function() require("dap").down() end,
|
||||
desc = "Down"
|
||||
},
|
||||
{
|
||||
"<leader>dk",
|
||||
function() require("dap").up() end,
|
||||
desc = "Up"
|
||||
},
|
||||
{
|
||||
"<leader>dl",
|
||||
function() require("dap").run_last() end,
|
||||
desc = "Run Last"
|
||||
},
|
||||
{
|
||||
"<leader>do",
|
||||
function() require("dap").step_out() end,
|
||||
desc = "Step Out"
|
||||
},
|
||||
{
|
||||
"<leader>dO",
|
||||
function() require("dap").step_over() end,
|
||||
desc = "Step Over"
|
||||
},
|
||||
{
|
||||
"<leader>dp",
|
||||
function() require("dap").pause() end,
|
||||
desc = "Pause"
|
||||
},
|
||||
{
|
||||
"<leader>dr",
|
||||
function() require("dap").repl.toggle() end,
|
||||
desc = "Toggle REPL"
|
||||
},
|
||||
{
|
||||
"<leader>ds",
|
||||
function() require("dap").session() end,
|
||||
desc = "Session"
|
||||
},
|
||||
{
|
||||
"<leader>dt",
|
||||
function() require("dap").terminate() end,
|
||||
desc = "Terminate"
|
||||
},
|
||||
{
|
||||
"<leader>dw",
|
||||
function() require("dap.ui.widgets").hover() end,
|
||||
desc = "Widgets"
|
||||
},
|
||||
}
|
||||
|
||||
M.config = function()
|
||||
local icons = require('config.icons')
|
||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpoint",
|
||||
{
|
||||
text = icons.ui.Bug,
|
||||
texthl = "DiagnosticSignError",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
}
|
||||
)
|
||||
require('which-key').register({
|
||||
d = {
|
||||
name = "+debug",
|
||||
},
|
||||
}, { prefix = "<leader>" })
|
||||
end
|
||||
|
||||
return M
|
5
.config/nvim/lua/plugins/dap/init.lua
Normal file
5
.config/nvim/lua/plugins/dap/init.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
require('plugins.dap.dap'),
|
||||
require('plugins.dap.dap-ui'),
|
||||
require('plugins.dap.mason-dap'),
|
||||
}
|
10
.config/nvim/lua/plugins/dap/mason-dap.lua
Normal file
10
.config/nvim/lua/plugins/dap/mason-dap.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local M = { "jay-babu/mason-nvim-dap.nvim" }
|
||||
|
||||
M.opts = {
|
||||
-- ensure_installed = {},
|
||||
-- handlers = {},
|
||||
}
|
||||
|
||||
M.cmd = { "DapInstall", "DapUninstall" }
|
||||
|
||||
return M
|
42
.config/nvim/lua/plugins/lazy.lua
Normal file
42
.config/nvim/lua/plugins/lazy.lua
Normal file
|
@ -0,0 +1,42 @@
|
|||
local M = { "folke/lazy.nvim" }
|
||||
|
||||
local icons = require('config.icons')
|
||||
|
||||
M.opts = {
|
||||
ui = {
|
||||
border = "single",
|
||||
icons = {
|
||||
cmd = icons.ui.CMD .. " ",
|
||||
config = icons.ui.Gear,
|
||||
event = icons.misc.Bolt,
|
||||
ft = icons.ui.File .. " ",
|
||||
init = icons.ui.Gear .. " ",
|
||||
import = icons.ui.Import .. " ",
|
||||
keys = icons.ui.Keyboard .. " ",
|
||||
lazy = icons.ui.Sleep .. " ",
|
||||
loaded = icons.ui.CircleFull,
|
||||
not_loaded = icons.ui.CircleEmpty,
|
||||
plugin = icons.misc.Package,
|
||||
runtime = icons.misc.Vim .. " ",
|
||||
source = icons.ui.Code .. " ",
|
||||
start = icons.ui.Start,
|
||||
task = icons.ui.Check .. " ",
|
||||
list = {
|
||||
icons.ui.CircleFull,
|
||||
icons.ui.BoldArrowRight,
|
||||
icons.misc.Star,
|
||||
icons.ui.LineHorizontal,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- M.keys = {
|
||||
-- { "<leader>pu", require("lazy").check, desc = "Check for updates" },
|
||||
-- { "<leader>pc", require("lazy").clear, desc = "Clear finished tasks" },
|
||||
-- { "<leader>pd", require("lazy").debug, desc = "Show debug information" },
|
||||
-- { "<leader>pp", require("lazy").profile, desc = "Show profiling information" },
|
||||
-- { "<leader>ps", require("lazy").sync, desc = "Install, clean and update plugins" },
|
||||
-- }
|
||||
|
||||
return M
|
6
.config/nvim/lua/plugins/lsp/init.lua
Normal file
6
.config/nvim/lua/plugins/lsp/init.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
require('plugins.lsp.mason'),
|
||||
require('plugins.lsp.mason-lspconfig'),
|
||||
require('plugins.lsp.null-ls'),
|
||||
}
|
82
.config/nvim/lua/plugins/lsp/mason-lspconfig.lua
Normal file
82
.config/nvim/lua/plugins/lsp/mason-lspconfig.lua
Normal file
|
@ -0,0 +1,82 @@
|
|||
local M = { "williamboman/mason-lspconfig.nvim" }
|
||||
|
||||
M.dependencies = { "mason.nvim" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>li", "<cmd>LspInfo<cr>", desc = "LSP Info" },
|
||||
{ "<leader>la", vim.lsp.buf.code_action, desc = "Code Action" },
|
||||
{
|
||||
"<leader>lf",
|
||||
function()
|
||||
require("funcs").format({ async = true })
|
||||
end,
|
||||
desc = "Format",
|
||||
},
|
||||
{ "<leader>lj", vim.diagnostic.goto_next, desc = "Next Diagnostic" },
|
||||
{ "<leader>lk", vim.diagnostic.goto_prev, desc = "Prev Diagnostic" },
|
||||
{ "<leader>ll", vim.lsp.codelens.run, desc = "CodeLens Action" },
|
||||
{ "<leader>lq", vim.diagnostic.setloclist, desc = "Quickfix" },
|
||||
{ "<leader>lr", vim.lsp.buf.rename, desc = "Rename" },
|
||||
}
|
||||
|
||||
local opts = {
|
||||
ensure_installed = { "lua_ls" },
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({})
|
||||
end,
|
||||
["intelephense"] = function()
|
||||
require("lspconfig")["intelephense"].setup({
|
||||
init_options = {
|
||||
storagePath = os.getenv('XDG_CACHE_HOME') .. '/intelephense',
|
||||
globalStoragePath = os.getenv('XDG_CONFIG_HOME') .. '/intelephense',
|
||||
licenceKey = os.getenv('XDG_CONFIG_HOME') .. '/intelephense/licence.txt',
|
||||
}
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
require("lspconfig")["lua_ls"].setup({
|
||||
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,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
M.config = function()
|
||||
local icons = require("config.icons").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
|
||||
|
||||
local mlsp = require('mason-lspconfig')
|
||||
mlsp.setup({ ensure_installed = opts.ensure_installed })
|
||||
mlsp.setup_handlers(opts.handlers)
|
||||
end
|
||||
|
||||
return M
|
20
.config/nvim/lua/plugins/lsp/mason.lua
Normal file
20
.config/nvim/lua/plugins/lsp/mason.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local M = { "williamboman/mason.nvim" }
|
||||
|
||||
local icons = require('config.icons')
|
||||
|
||||
M.keys = { { "<leader>lI", "<cmd>Mason<cr>", desc = "Mason" } }
|
||||
|
||||
M.opts = {
|
||||
ui = {
|
||||
border = "none",
|
||||
icons = {
|
||||
package_installed = icons.ui.Check,
|
||||
package_pending = icons.ui.BoldArrowRight,
|
||||
package_uninstalled = icons.ui.BoldClose,
|
||||
},
|
||||
},
|
||||
log_level = vim.log.levels.INFO,
|
||||
max_concurrent_installers = 4,
|
||||
}
|
||||
|
||||
return M
|
20
.config/nvim/lua/plugins/lsp/null-ls.lua
Normal file
20
.config/nvim/lua/plugins/lsp/null-ls.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local M = { "jose-elias-alvarez/null-ls.nvim" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.dependencies = { "mason.nvim" }
|
||||
|
||||
M.opts = function()
|
||||
local nls = require("null-ls")
|
||||
return {
|
||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
|
||||
sources = {
|
||||
--nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.shfmt,
|
||||
nls.builtins.formatting.black,
|
||||
--nls.builtins.diagnostics.flake8,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
54
.config/nvim/lua/plugins/misc/alpha.lua
Normal file
54
.config/nvim/lua/plugins/misc/alpha.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local M = { "goolord/alpha-nvim" }
|
||||
|
||||
M.opts = function()
|
||||
local dashboard = require('alpha.themes.dashboard')
|
||||
local icons = require('config.icons')
|
||||
|
||||
local banner = {
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀",
|
||||
"⠀⣀⣴⣶⣶⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀",
|
||||
"⣰⣿⣿⠿⠛⠿⢿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀",
|
||||
"⣿⣿⡇⠀⠀⠀⠀⠈⠛⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀",
|
||||
"⠹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠀⢀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀",
|
||||
"⠀⠙⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣤⣶⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠉⠻⠷⡄⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⢀⣠⣤⣤⣄⡀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣷⡀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⣿⠟⠉⠉⠙⢿⣿⣿⣷",
|
||||
"⠀⠀⠀⣀⣠⣤⣤⣤⣶⣶⣶⣤⣤⠀⣴⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠉⠀⠀⠀⢀⣼⣿⣿⡿",
|
||||
"⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠛⠻⠏⣼⣿⣿⡿⣋⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣀⣠⣴⣾⣿⣿⡿⠁",
|
||||
"⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠋⠘⠿⠟⠛⠛⢻⣿⣿⣿⠋⠁⠈⠉⢿⣿⣿⣧⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀",
|
||||
"⠙⣷⣤⣀⠀⠀⠀⢀⣀⣤⣶⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡟⠀⠀⠀⢠⣿⣿⣿⡟⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠈⠛⠿⢿⣿⣿⣿⠿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡀⠀⢠⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣷⣶⣶⣶⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢶⣦⣤⣶⣾⣿⣿⡶⠈⠉⠛⠿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣶⡿⠿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
}
|
||||
|
||||
if vim.o.lines < 36 then
|
||||
banner = vim.list_slice(banner, 16, 22)
|
||||
end
|
||||
|
||||
dashboard.section.header.val = banner
|
||||
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", icons.ui.NewFile .. " New file", "<CMD>ene<CR>"),
|
||||
dashboard.button("e", icons.ui.FindFile .. " Open file", "<CMD>Lf<CR>"),
|
||||
dashboard.button("q", icons.ui.SignOut .. " Quit", "<CMD>qa<CR>"),
|
||||
}
|
||||
|
||||
dashboard.section.footer.val = "Behold: a Snail's Vim"
|
||||
|
||||
dashboard.section.footer.opts.hl = "Type"
|
||||
dashboard.section.header.opts.hl = "Include"
|
||||
dashboard.section.buttons.opts.hl = "Keyword"
|
||||
|
||||
-- dashboard.opts.opts.noautocmd = true
|
||||
return dashboard.opts
|
||||
end
|
||||
|
||||
return M
|
15
.config/nvim/lua/plugins/misc/autopairs.lua
Normal file
15
.config/nvim/lua/plugins/misc/autopairs.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local M = { "windwp/nvim-autopairs" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.opts = {
|
||||
check_ts = true,
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
javascript = { "string", "template_string" },
|
||||
java = false,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
151
.config/nvim/lua/plugins/misc/bufferline.lua
Normal file
151
.config/nvim/lua/plugins/misc/bufferline.lua
Normal file
|
@ -0,0 +1,151 @@
|
|||
local M = { "akinsho/bufferline.nvim" }
|
||||
|
||||
M.event = { "BufRead", "BufNewFile" }
|
||||
|
||||
M.keys = {
|
||||
{ "<C-l>", "<cmd>BufferLineCycleNext<CR>", desc = "Switch to next buffer" },
|
||||
{ "<C-h>", "<cmd>BufferLineCyclePrev<CR>", desc = "Switch to previous buffer" },
|
||||
{ "<A-l>", "<cmd>BufferLineMoveNext<CR>", desc = "Move buffer to next" },
|
||||
{ "<A-h>", "<cmd>BufferLineMovePrev<CR>", desc = "Move buffer to previous" },
|
||||
}
|
||||
|
||||
M.opts = function()
|
||||
local icons = require('config.icons')
|
||||
|
||||
local function is_ft(b, ft)
|
||||
return vim.bo[b].filetype == ft
|
||||
end
|
||||
|
||||
local function diagnostics_indicator(_, _, diagnostics, _)
|
||||
local result = {}
|
||||
local symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warning = icons.diagnostics.Warning,
|
||||
info = icons.diagnostics.Information,
|
||||
}
|
||||
for name, count in pairs(diagnostics) do
|
||||
if symbols[name] and count > 0 then
|
||||
table.insert(result, symbols[name] .. " " .. count)
|
||||
end
|
||||
end
|
||||
result = table.concat(result, " ")
|
||||
return #result > 0 and result or ""
|
||||
end
|
||||
|
||||
local function custom_filter(buf, buf_nums)
|
||||
local logs = vim.tbl_filter(function(b)
|
||||
return is_ft(b, "log")
|
||||
end, buf_nums)
|
||||
if vim.tbl_isempty(logs) then
|
||||
return true
|
||||
end
|
||||
local tab_num = vim.fn.tabpagenr()
|
||||
local last_tab = vim.fn.tabpagenr "$"
|
||||
local is_log = is_ft(buf, "log")
|
||||
if last_tab == 1 then
|
||||
return true
|
||||
end
|
||||
-- only show log buffers in secondary tabs
|
||||
return (tab_num == last_tab and is_log) or (tab_num ~= last_tab and not is_log)
|
||||
end
|
||||
|
||||
local config = {
|
||||
highlights = {
|
||||
background = {
|
||||
italic = true,
|
||||
bold = false,
|
||||
},
|
||||
buffer_selected = {
|
||||
italic = false,
|
||||
bold = true,
|
||||
},
|
||||
},
|
||||
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",
|
||||
},
|
||||
}
|
||||
return config
|
||||
end
|
||||
|
||||
return M
|
7
.config/nvim/lua/plugins/misc/colorizer.lua
Normal file
7
.config/nvim/lua/plugins/misc/colorizer.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local M = { "norcalli/nvim-colorizer.lua" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.opts = { '*' }
|
||||
|
||||
return M
|
17
.config/nvim/lua/plugins/misc/comment.lua
Normal file
17
.config/nvim/lua/plugins/misc/comment.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
local M = { "numToStr/Comment.nvim" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>/", "<Plug>(comment_toggle_linewise_current)", desc = "Comment toggle current line", },
|
||||
{ "<leader>/", "<Plug>(comment_toggle_linewise_visual)", desc = "Comment toggle linewise", mode = { "v" }, },
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
mappings = {
|
||||
basic = false,
|
||||
extra = false
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
60
.config/nvim/lua/plugins/misc/gitsigns.lua
Normal file
60
.config/nvim/lua/plugins/misc/gitsigns.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
local M = { "lewis6991/gitsigns.nvim" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>gj", function() require("gitsigns").next_hunk() end, desc = "Next Hunk" },
|
||||
{ "<leader>gk", function() require("gitsigns").prev_hunk() end, desc = "Prev Hunk" },
|
||||
{ "<leader>gb", function() require("gitsigns").blame_line() end, desc = "Blame" },
|
||||
{ "<leader>gp", function() require("gitsigns").preview_hunk() end, desc = "Preview Hunk" },
|
||||
{ "<leader>gr", function() require("gitsigns").reset_hunk() end, desc = "Reset Hunk" },
|
||||
{ "<leader>gR", function() require("gitsigns").reset_buffer() end, desc = "Reset Buffer" },
|
||||
{ "<leader>gs", function() require("gitsigns").stage_hunk() end, desc = "Stage Hunk" },
|
||||
{ "<leader>gu", function() require("gitsigns").undo_stage_hunk() end, desc = "Undo Stage Hunk" },
|
||||
{ "<leader>gd", "<cmd>Gitsigns diffthis HEAD<cr>", desc = "Git Diff" },
|
||||
}
|
||||
|
||||
M.ft = { "gitcommit" }
|
||||
|
||||
local opts = {
|
||||
signs = {
|
||||
add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
||||
change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||
delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||
topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||
changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
},
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = "single",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
}
|
||||
|
||||
M.config = function()
|
||||
require('gitsigns').setup(opts)
|
||||
require('which-key').register({
|
||||
g = {
|
||||
name = "Git",
|
||||
},
|
||||
}, { prefix = "<leader>" })
|
||||
end
|
||||
|
||||
return M
|
43
.config/nvim/lua/plugins/misc/illuminate.lua
Normal file
43
.config/nvim/lua/plugins/misc/illuminate.lua
Normal file
|
@ -0,0 +1,43 @@
|
|||
local M = { "RRethy/vim-illuminate" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
local opts = {
|
||||
providers = {
|
||||
"lsp",
|
||||
"treesitter",
|
||||
"regex",
|
||||
},
|
||||
delay = 200,
|
||||
filetypes_denylist = {
|
||||
"dirvish",
|
||||
"fugitive",
|
||||
"alpha",
|
||||
"NvimTree",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"Trouble",
|
||||
"lir",
|
||||
"Outline",
|
||||
"spectre_panel",
|
||||
"toggleterm",
|
||||
"DressingSelect",
|
||||
"TelescopePrompt",
|
||||
},
|
||||
filetypes_allowlist = {},
|
||||
modes_denylist = {},
|
||||
modes_allowlist = {},
|
||||
providers_regex_syntax_denylist = {},
|
||||
providers_regex_syntax_allowlist = {},
|
||||
under_cursor = true,
|
||||
}
|
||||
|
||||
M.init = function()
|
||||
vim.g.Illuminate_ftblacklist = { 'alpha', 'NvimTree' }
|
||||
end
|
||||
|
||||
M.config = function()
|
||||
require('illuminate').configure(opts)
|
||||
end
|
||||
|
||||
return M
|
53
.config/nvim/lua/plugins/misc/indent-blankline.lua
Normal file
53
.config/nvim/lua/plugins/misc/indent-blankline.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
local M = { "lukas-reineke/indent-blankline.nvim" }
|
||||
|
||||
M.main = "ibl"
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<c-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,
|
||||
desc = "Jump to context",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
M.dependencies = {
|
||||
"nvim-treesitter",
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
indent = {
|
||||
char = "▏",
|
||||
tab_char = "▏",
|
||||
},
|
||||
scope = {
|
||||
char = "▎",
|
||||
enabled = true,
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
},
|
||||
exclude = {
|
||||
filetypes = {
|
||||
"help",
|
||||
"packer",
|
||||
"NvimTree",
|
||||
},
|
||||
buftypes = {
|
||||
"terminal",
|
||||
"nofile",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
22
.config/nvim/lua/plugins/misc/init.lua
Normal file
22
.config/nvim/lua/plugins/misc/init.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "kyazdani42/nvim-web-devicons" },
|
||||
require('plugins.misc.alpha'),
|
||||
require('plugins.misc.autopairs'),
|
||||
require('plugins.misc.bufferline'),
|
||||
require('plugins.misc.colorizer'),
|
||||
require('plugins.misc.comment'),
|
||||
require('plugins.misc.gitsigns'),
|
||||
require('plugins.misc.illuminate'),
|
||||
require('plugins.misc.indent-blankline'),
|
||||
require('plugins.misc.lf'),
|
||||
require('plugins.misc.lualine'),
|
||||
require('plugins.misc.surround'),
|
||||
require('plugins.misc.todo-comments'),
|
||||
require('plugins.misc.toggleterm'),
|
||||
require('plugins.misc.tokyonight'),
|
||||
require('plugins.misc.treesitter'),
|
||||
require('plugins.misc.vimtex'),
|
||||
require('plugins.misc.which-key'),
|
||||
require('plugins.misc.wiki'),
|
||||
}
|
17
.config/nvim/lua/plugins/misc/lf.lua
Normal file
17
.config/nvim/lua/plugins/misc/lf.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
local M = { "lmburns/lf.nvim" }
|
||||
|
||||
-- M.commit = "383429497292dd8a84271e74a81c6db6993ca7ab"
|
||||
|
||||
M.cmd = { "Lf" }
|
||||
|
||||
M.opts = {
|
||||
mappings = false,
|
||||
winblend = 0,
|
||||
border = "rounded",
|
||||
}
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>e", function() require('lf').start() end, "File Picker" },
|
||||
}
|
||||
|
||||
return M
|
212
.config/nvim/lua/plugins/misc/lualine.lua
Normal file
212
.config/nvim/lua/plugins/misc/lualine.lua
Normal file
|
@ -0,0 +1,212 @@
|
|||
local M = { "nvim-lualine/lualine.nvim" }
|
||||
|
||||
M.opts = function()
|
||||
local colors = require('tokyonight.colors').setup({ transform = true })
|
||||
local icons = require('config.icons')
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand('%:p:h')
|
||||
local gitdir = vim.fn.finddir('.git', filepath .. ';')
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
local function search_result()
|
||||
if vim.v.hlsearch == 0 then
|
||||
return ''
|
||||
end
|
||||
local last_search = vim.fn.getreg('/')
|
||||
if not last_search or last_search == '' then
|
||||
return ''
|
||||
end
|
||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||
end
|
||||
|
||||
local config = {
|
||||
options = {
|
||||
component_separators = '',
|
||||
section_separators = '',
|
||||
-- theme = {
|
||||
-- normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
-- inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
-- },
|
||||
disabled_filetypes = {
|
||||
statusline = { 'alpha' }
|
||||
},
|
||||
ignore_focus = { 'toggleterm', 'NvimTree' },
|
||||
globalstatus = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
}
|
||||
}
|
||||
|
||||
local function ins_left(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
local function mode_color()
|
||||
local color = {
|
||||
n = colors.red,
|
||||
i = colors.green,
|
||||
v = colors.magenta,
|
||||
[''] = colors.magenta,
|
||||
V = colors.magenta,
|
||||
c = colors.blue,
|
||||
no = colors.red,
|
||||
s = colors.orange,
|
||||
S = colors.orange,
|
||||
[''] = colors.orange,
|
||||
ic = colors.yellow,
|
||||
R = colors.violet,
|
||||
Rv = colors.violet,
|
||||
cv = colors.red,
|
||||
ce = colors.red,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
['r?'] = colors.cyan,
|
||||
['!'] = colors.red,
|
||||
t = colors.red,
|
||||
}
|
||||
return { fg = color[vim.fn.mode()] }
|
||||
end
|
||||
|
||||
ins_left {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = function()
|
||||
return mode_color()
|
||||
end,
|
||||
padding = { right = 1 },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
'filename',
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = { fg = colors.magenta, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
'fileformat',
|
||||
fmt = string.upper,
|
||||
icons_enabled = false,
|
||||
color = { fg = colors.green },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
'o:encoding',
|
||||
fmt = string.upper,
|
||||
cond = conditions.hide_in_width,
|
||||
color = { fg = colors.green },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
'filesize',
|
||||
fmt = string.upper,
|
||||
icons_enabled = false,
|
||||
color = { fg = colors.green },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
'%04l:%04c',
|
||||
}
|
||||
|
||||
-- NOTE: My beloved :(
|
||||
|
||||
-- ins_left {
|
||||
-- function()
|
||||
-- local current_line = vim.fn.line "."
|
||||
-- local total_lines = vim.fn.line "$"
|
||||
-- local chars = icons.progress
|
||||
-- local line_ratio = current_line / total_lines
|
||||
-- local index = math.ceil(line_ratio * #chars)
|
||||
-- return chars[index]
|
||||
-- end,
|
||||
-- color = { fg = colors.yellow }
|
||||
-- }
|
||||
|
||||
ins_right {
|
||||
search_result,
|
||||
color = { fg = colors.white },
|
||||
padding = { left = 1 },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
function()
|
||||
local msg = ''
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return 'No LSP'
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
msg = msg .. ", " .. client.name
|
||||
end
|
||||
end
|
||||
return msg:sub(3)
|
||||
end,
|
||||
color = { fg = colors.blue, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic' },
|
||||
symbols = {
|
||||
error = icons.diagnostics.BoldError .. ' ',
|
||||
warn = icons.diagnostics.BoldWarning .. ' ',
|
||||
info = icons.diagnostics.BoldInformation
|
||||
},
|
||||
diagnostics_color = {
|
||||
color_error = { fg = colors.red },
|
||||
color_warn = { fg = colors.yellow },
|
||||
color_info = { fg = colors.cyan },
|
||||
},
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'filetype',
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
padding = { left = 1 },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = function()
|
||||
return mode_color()
|
||||
end,
|
||||
padding = { left = 1 },
|
||||
}
|
||||
|
||||
return config
|
||||
end
|
||||
|
||||
return M
|
7
.config/nvim/lua/plugins/misc/surround.lua
Normal file
7
.config/nvim/lua/plugins/misc/surround.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local M = { "kylechui/nvim-surround" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.config = true
|
||||
|
||||
return M
|
11
.config/nvim/lua/plugins/misc/todo-comments.lua
Normal file
11
.config/nvim/lua/plugins/misc/todo-comments.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local M = { "folke/todo-comments.nvim" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.config = {
|
||||
highlight = {
|
||||
multiline = false
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
32
.config/nvim/lua/plugins/misc/toggleterm.lua
Normal file
32
.config/nvim/lua/plugins/misc/toggleterm.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local M = { "akinsho/toggleterm.nvim" }
|
||||
|
||||
M.opts = {
|
||||
size = 20,
|
||||
open_mapping = [[<c-\>]],
|
||||
hide_numbers = true,
|
||||
shade_terminals = true,
|
||||
shading_factor = 2,
|
||||
start_in_insert = true,
|
||||
insert_mappings = true,
|
||||
persist_size = true,
|
||||
direction = "float",
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
float_opts = {
|
||||
winblend = 0,
|
||||
highlights = {
|
||||
border = "Normal",
|
||||
background = "Normal",
|
||||
},
|
||||
border = "rounded",
|
||||
},
|
||||
}
|
||||
|
||||
--local Terminal = require("toggleterm.terminal").Terminal
|
||||
--local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
|
||||
--
|
||||
--function _LAZYGIT_TOGGLE()
|
||||
-- lazygit:toggle()
|
||||
--end
|
||||
|
||||
return M
|
18
.config/nvim/lua/plugins/misc/tokyonight.lua
Normal file
18
.config/nvim/lua/plugins/misc/tokyonight.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local M = { "folke/tokyonight.nvim" }
|
||||
|
||||
M.priority = 1000
|
||||
|
||||
local opts = {
|
||||
style = "night",
|
||||
transparent = true,
|
||||
on_highlights = function(hl, _)
|
||||
hl.CurSearch = nil
|
||||
end
|
||||
}
|
||||
|
||||
M.config = function()
|
||||
require('tokyonight').setup(opts)
|
||||
vim.cmd("colorscheme tokyonight")
|
||||
end
|
||||
|
||||
return M
|
23
.config/nvim/lua/plugins/misc/treesitter.lua
Normal file
23
.config/nvim/lua/plugins/misc/treesitter.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
local M = { "nvim-treesitter/nvim-treesitter" }
|
||||
|
||||
M.event = { "BufReadPre", "BufNewFile" }
|
||||
|
||||
M.build = ":TSUpdate"
|
||||
|
||||
M.opts = {
|
||||
ensure_installed = { "lua", "bash", "c" },
|
||||
auto_install = true,
|
||||
autopairs = {
|
||||
enable = false,
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
}
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>T", "<cmd>TSConfigInfo<cr>", desc = "Treesitter Info" }
|
||||
}
|
||||
|
||||
return M
|
11
.config/nvim/lua/plugins/misc/vimtex.lua
Normal file
11
.config/nvim/lua/plugins/misc/vimtex.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local M = { "lervag/vimtex" }
|
||||
|
||||
M.init = function()
|
||||
vim.g.vimtex_view_method = "zathura"
|
||||
vim.g.tex_flavor = "latex"
|
||||
vim.g.vimtex_quickfix_mode = 0
|
||||
vim.o.conceallevel = 1
|
||||
vim.g.tex_conceal = 'abdmg'
|
||||
end
|
||||
|
||||
return M
|
76
.config/nvim/lua/plugins/misc/which-key.lua
Normal file
76
.config/nvim/lua/plugins/misc/which-key.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local M = { "folke/which-key.nvim" }
|
||||
|
||||
local icons = require('config.icons')
|
||||
|
||||
M.lazy = false
|
||||
|
||||
M.init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end
|
||||
|
||||
local opts = {
|
||||
plugins = {
|
||||
marks = false,
|
||||
registers = false,
|
||||
presets = {
|
||||
operators = false,
|
||||
motions = false,
|
||||
text_objects = false,
|
||||
windows = false,
|
||||
nav = false,
|
||||
z = false,
|
||||
g = false,
|
||||
}
|
||||
},
|
||||
spelling = {
|
||||
enabled = false,
|
||||
suggestions = 20,
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = icons.ui.DoubleChevronRight,
|
||||
separator = icons.ui.BoldArrowRight,
|
||||
group = icons.ui.Plus,
|
||||
},
|
||||
popup_mappings = {
|
||||
scroll_down = "<c-d>",
|
||||
scroll_up = "<c-u>",
|
||||
},
|
||||
window = {
|
||||
border = "none",
|
||||
position = "bottom",
|
||||
winblend = 0,
|
||||
},
|
||||
layout = {
|
||||
height = { min = 4, max = 25 },
|
||||
width = { min = 20, max = 50 },
|
||||
spacing = 3,
|
||||
align = "left",
|
||||
},
|
||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
|
||||
triggers = "auto",
|
||||
triggers_blacklist = {
|
||||
i = { "j", "k" },
|
||||
v = { "j", "k", "y" },
|
||||
},
|
||||
defaults = {
|
||||
["<leader>u"] = { name = "Utility" },
|
||||
["<leader>p"] = { name = "Plugins" },
|
||||
}
|
||||
}
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>w", "<cmd>w!<CR>", desc = "Save" },
|
||||
{ "<leader>q", require('funcs').buf_kill, desc = "Close" },
|
||||
{ "<leader>h", "<cmd>nohlsearch<CR>", desc = "Clear Highlights" },
|
||||
{ "<leader>n", "<cmd>ene<CR>", desc = "New File" },
|
||||
{ "<leader>uc", "<cmd>w!<CR><cmd>!compiler \"%:p\"<CR>", desc = "Compile" },
|
||||
-- WARN:
|
||||
{ "<leader>pu", require("lazy").check, desc = "Check for updates" },
|
||||
{ "<leader>pc", require("lazy").clear, desc = "Clear finished tasks" },
|
||||
{ "<leader>pd", require("lazy").debug, desc = "Show debug information" },
|
||||
{ "<leader>pp", require("lazy").profile, desc = "Show profiling information" },
|
||||
{ "<leader>ps", require("lazy").sync, desc = "Install, clean and update plugins" },
|
||||
}
|
||||
|
||||
return M
|
16
.config/nvim/lua/plugins/misc/wiki.lua
Normal file
16
.config/nvim/lua/plugins/misc/wiki.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local M = { "lervag/wiki.vim" }
|
||||
|
||||
M.cmd = {
|
||||
"WikiIndex",
|
||||
"WikiJournal",
|
||||
"WikiPages",
|
||||
"WikiTags",
|
||||
"WikiToc",
|
||||
"WikiTocGenerate",
|
||||
}
|
||||
|
||||
M.init = function()
|
||||
vim.g.wiki_root = "~/Documents/wiki"
|
||||
end
|
||||
|
||||
return M
|
330
.config/nvim/lua/snippets/c.lua
Normal file
330
.config/nvim/lua/snippets/c.lua
Normal file
|
@ -0,0 +1,330 @@
|
|||
return {
|
||||
s({ trig = "sst", name = "Standard Template" }, fmt([[
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {{
|
||||
{}
|
||||
return EXIT_SUCCESS;
|
||||
}}
|
||||
]], { i(0) })),
|
||||
s({ trig = "sstp", name = "Preprocessor Template" }, fmt([[
|
||||
// #define NDEBUG // disables assert()
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
]], {})),
|
||||
s({ trig = "main", name = "main(int argc, char *argv[])" }, fmt([[
|
||||
int main(int argc, char *argv[]) {{
|
||||
{}
|
||||
return EXIT_SUCCESS;
|
||||
}}
|
||||
]], { i(0) })),
|
||||
s({ trig = "mainn", name = "main(void)" }, fmt([[
|
||||
int main(void) {{
|
||||
{}
|
||||
return EXIT_SUCCESS;
|
||||
}}
|
||||
]], { i(0) })),
|
||||
s({ trig = "#inc", name = "#include <...>" }, fmt([[
|
||||
#include <{}>
|
||||
]], { i(1) })),
|
||||
s({ trig = "#inc", name = "#include \"...\"" }, fmt([[
|
||||
#include "{}"
|
||||
]], { i(1) })),
|
||||
s({ trig = "#def", name = "#define macro" }, fmt([[
|
||||
#define {}
|
||||
]], { i(0) })),
|
||||
s({ trig = "#deff", name = "#define macro()" }, fmt([[
|
||||
#define {}({}) ({})
|
||||
]], { i(1), i(2), i(3) })),
|
||||
s({ trig = "#if", name = "#if" }, fmt([[
|
||||
#if {}
|
||||
{}
|
||||
#endif /* if {} */
|
||||
]], { i(1), i(0), reference(1) })),
|
||||
s({ trig = "#ifdef", name = "#ifdef" }, fmt([[
|
||||
#ifdef {}
|
||||
{}
|
||||
#endif /* ifdef {} */
|
||||
]], { i(1), i(0), reference(1) })),
|
||||
s({ trig = "#ifndef", name = "#ifndef" }, fmt([[
|
||||
#ifndef {}
|
||||
{}
|
||||
#endif /* ifndef {} */
|
||||
]], { i(1), i(0), reference(1) })),
|
||||
s({ trig = "once", name = "Header Include Guard" }, fmt([[
|
||||
#ifndef {}_H
|
||||
#define {}_H
|
||||
{}
|
||||
#endif /* end of include guard: {} */
|
||||
]], { i(1), reference(1), i(0), reference(1) })),
|
||||
s({ trig = "nocpp", name = "extern C", dscr = "Disable C++ name mangling in C headers" }, fmt([[
|
||||
#ifdef __cplusplus
|
||||
extern "C" {{
|
||||
#endif
|
||||
{}
|
||||
#ifdef __cplusplus
|
||||
}} /* extern "C" */
|
||||
#endif
|
||||
]], { i(0) })),
|
||||
s({ trig = "#err", name = "#error" }, fmt([[
|
||||
#error "{}"
|
||||
]], { i(1) })),
|
||||
s({ trig = "#warn", name = "#warning" }, fmt([[
|
||||
#warning "{}"
|
||||
]], { i(1) })),
|
||||
s({ trig = "if", name = "if" }, fmt([[
|
||||
if ({}) {{
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "ife", name = "if else" }, fmt([[
|
||||
if ({}) {{
|
||||
{}
|
||||
}} else {{
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(2), i(0) })),
|
||||
s({ trig = "el", name = "else" }, fmt([[
|
||||
else {{
|
||||
{}
|
||||
}}
|
||||
]], { i(0) })),
|
||||
s({ trig = "elif", name = "else if" }, fmt([[
|
||||
else if ({}) {{
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "t", name = "Ternary" }, fmt([[
|
||||
{} ? {} : {}
|
||||
]], { i(1), i(2), i(0) })),
|
||||
s({ trig = "switch", name = "Switch" }, fmt([[
|
||||
switch ({}) {{
|
||||
{}
|
||||
default:
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(0), i(2) })),
|
||||
s({ trig = "switchn", name = "Switch Without Default" }, fmt([[
|
||||
switch ({}) {{
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "case", name = "Case" }, fmt([[
|
||||
case {}:
|
||||
{}
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "while", name = "While" }, fmt([[
|
||||
while ({}) {{
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "do", name = "Do While" }, fmt([[
|
||||
do {{
|
||||
{}
|
||||
}} while({});
|
||||
]], { i(0), i(1) })),
|
||||
s({ trig = "for", name = "For" }, fmt([[
|
||||
for ({}) {{
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "ret", name = "return" }, fmt([[
|
||||
return {};
|
||||
]], { i(1) })),
|
||||
s({ trig = "ex", name = "exit()" }, fmt([[
|
||||
exit({});
|
||||
]], { i(1) })),
|
||||
s({ trig = "fund", name = "Function Declaration" }, fmt([[
|
||||
{}({});
|
||||
]], { i(1), i(2) })),
|
||||
s({ trig = "fun", name = "Function Definition" }, fmt([[
|
||||
{}({}) {{
|
||||
{}
|
||||
}}
|
||||
]], { i(1), i(2), i(0) })),
|
||||
s({ trig = "td", name = "typedef" }, fmt([[
|
||||
typedef {};
|
||||
]], { i(1) })),
|
||||
s({ trig = "tdst", name = "typedef struct" }, fmt([[
|
||||
typedef struct {} {};
|
||||
]], { reference(1), i(1) })),
|
||||
s({ trig = "tduo", name = "typedef union" }, fmt([[
|
||||
typedef union {} {};
|
||||
]], { reference(1), i(1) })),
|
||||
s({ trig = "tden", name = "typedef enum" }, fmt([[
|
||||
typedef enum {} {};
|
||||
]], { reference(1), i(1) })),
|
||||
s({ trig = "st", name = "Struct" }, fmt([[
|
||||
struct {} {{
|
||||
{}
|
||||
}};
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "stt", name = "Struct Type" }, fmt([[
|
||||
typedef struct {} {{
|
||||
{}
|
||||
}} {};
|
||||
]], { i(1), i(0), reference(1) })),
|
||||
s({ trig = "uo", name = "Union" }, fmt([[
|
||||
union {} {{
|
||||
{}
|
||||
}};
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "uot", name = "Union Type" }, fmt([[
|
||||
typedef union {} {{
|
||||
{}
|
||||
}} {};
|
||||
]], { i(1), i(0), reference(1) })),
|
||||
s({ trig = "enum", name = "Enum" }, fmt([[
|
||||
enum {} {{
|
||||
{}
|
||||
}};
|
||||
]], { i(1), i(0) })),
|
||||
s({ trig = "enumt", name = "Enum Type" }, fmt([[
|
||||
typedef enum {} {{
|
||||
{}
|
||||
}} {};
|
||||
]], { i(1), i(0), reference(1) })),
|
||||
s({ trig = "pri", name = "printf()" }, fmt([[
|
||||
printf("{}\n", {});
|
||||
]], { i(1, "%s"), i(2) })),
|
||||
s({ trig = "fpri", name = "fprintf()" }, fmt([[
|
||||
fprintf({}, "{}\n", {});
|
||||
]], { i(1, "stderr"), i(2, "%s"), i(3) })),
|
||||
s({ trig = "spri", name = "sprintf()" }, fmt([[
|
||||
sprintf({}, "{}\n", {});
|
||||
]], { i(1, "buf"), i(2, "%s"), i(3) })),
|
||||
s({ trig = "snpri", name = "snprintf()" }, fmt([[
|
||||
snprintf({}, {}, "{}\n", {});
|
||||
]], { i(1, "buf"), i(2, "max"), i(3, "%s"), i(4) })),
|
||||
s({ trig = "sca", name = "scanf()" }, fmt([[
|
||||
scanf("{}", {});
|
||||
]], { i(1, "%i"), i(2) })),
|
||||
s({ trig = "fsca", name = "fscanf()" }, fmt([[
|
||||
fscanf({}, "{}", {});
|
||||
]], { i(1, "stdin"), i(2, "%i"), i(3) })),
|
||||
s({ trig = "ssca", name = "sscanf()" }, fmt([[
|
||||
sscanf({}, "{}", {});
|
||||
]], { i(1, "buf"), i(2, "%i"), i(3) })),
|
||||
s({ trig = "priv", name = "Print Variable" }, fmt([[
|
||||
printf("{} = {}\n", {});
|
||||
]], { reference(2), i(1, "%i"), i(2) })),
|
||||
s({ trig = "warn", name = "warn()" }, fmt([[
|
||||
warn("{}"{});
|
||||
]], { i(1, "%s"), i(2) })),
|
||||
s({ trig = "warnx", name = "warnx()" }, fmt([[
|
||||
warnx("{}"{});
|
||||
]], { i(1, "%s"), i(2) })),
|
||||
s({ trig = "err", name = "err()" }, fmt([[
|
||||
err("{}"{});
|
||||
]], { i(1, "%s"), i(2) })),
|
||||
s({ trig = "errx", name = "errx()" }, fmt([[
|
||||
errx("{}"{});
|
||||
]], { i(1, "%s"), i(2) })),
|
||||
s({ trig = "asr", name = "assert()" }, fmt([[
|
||||
assert({});
|
||||
]], { i(1) })),
|
||||
s({ trig = "stasr", name = "static_assert()" }, fmt([[
|
||||
static_assert({}, "{}");
|
||||
]], { i(1), i(2, "Fuck!") })),
|
||||
s({ trig = "Stasr", name = "static_assert() 1 Parameter" }, fmt([[
|
||||
static_assert({});
|
||||
]], { i(1) })),
|
||||
s({ trig = "mlc", name = "malloc()" }, fmt([[
|
||||
{} = malloc(sizeof({}[{}]){});
|
||||
]], { i(1, "ptr"), i(2, "int"), i(3), i(4) })),
|
||||
s({ trig = "clc", name = "calloc()" }, fmt([[
|
||||
{} = calloc({}, sizeof({}){});
|
||||
]], { i(1, "ptr"), i(2), i(3, "int"), i(4) })),
|
||||
s({ trig = "rlc", name = "realloc()" }, fmt([[
|
||||
{} = realloc({}, sizeof({}[{}]){});
|
||||
]], { i(1, "ptr"), i(2), i(3, "int"), i(4), i(5) })),
|
||||
s({ trig = "fre", name = "free()" }, fmt([[
|
||||
free({});
|
||||
]], { i(1, "ptr") })),
|
||||
s({ trig = "mlcd", name = "Malloc Declaration" }, fmt([[
|
||||
{} *{} = malloc(sizeof({}[{}]){});
|
||||
]], { i(1, "int"), i(2, "ptr"), reference(1), i(3), i(4) })),
|
||||
s({ trig = "clcd", name = "Calloc Declaration" }, fmt([[
|
||||
{} *{} = calloc({}, sizeof({}){});
|
||||
]], { i(1, "int"), i(2, "ptr"), i(3), reference(1), i(4) })),
|
||||
s({ trig = "mlct", name = "Malloc Template" }, fmt([[
|
||||
{} *{} = malloc(sizeof({}[{}]));
|
||||
if (!{}) {{
|
||||
printf(stderr, "{}\n"{});
|
||||
{}
|
||||
}}
|
||||
{}
|
||||
free({});
|
||||
]], { i(1, "int"), i(2, "ptr"), reference(1), i(3), reference(2), i(4, "Failed to malloc!"), i(5),
|
||||
i(6, "exit(EXIT_FAILURE);"), i(0), reference(2) })),
|
||||
s({ trig = "clct", name = "Calloc Template" }, fmt([[
|
||||
{} *{} = calloc({}, sizeof({}));
|
||||
if (!{}) {{
|
||||
printf(stderr, "{}\n"{});
|
||||
{}
|
||||
}}
|
||||
{}
|
||||
free({});
|
||||
]], { i(1, "int"), i(2, "ptr"), i(3), reference(1), reference(2), i(4, "Failed to calloc!"), i(5),
|
||||
i(6, "exit(EXIT_FAILURE);"), i(0), reference(2) })),
|
||||
s({ trig = "/", name = "Comment" }, fmt([[
|
||||
/* {} */
|
||||
]], { i(1) })),
|
||||
s({ trig = "//", name = "Multiline Comment" }, fmt([[
|
||||
/*
|
||||
* {}
|
||||
*/
|
||||
]], { i(1) })),
|
||||
s({ trig = "///", name = "Multiline Double-Star Comment" }, fmt([[
|
||||
/**
|
||||
** {}
|
||||
**/
|
||||
]], { i(1) })),
|
||||
s({ trig = "dox", name = "Doxygen Template" }, fmt([[
|
||||
/*! {}
|
||||
* @brief {}
|
||||
*
|
||||
* {}
|
||||
*/
|
||||
]], { i(1), i(2, "This is something undocumented."), i(3, "Nothing to say here...") })),
|
||||
s({ trig = "dfun", name = "Doxygen Function" }, fmt([[
|
||||
/*!
|
||||
* @brief {}
|
||||
*
|
||||
* {}
|
||||
*
|
||||
* @return {}
|
||||
*/
|
||||
{}({});
|
||||
]], { i(3, "This function is undocumented."), i(4, "Nothing to say here..."), i(5, "Nothing."), i(1), i(2) })),
|
||||
s({ trig = "todo", name = "Doxygen Todo" }, fmt([[
|
||||
/*! TODO: {}
|
||||
*
|
||||
* @todo {}
|
||||
*/
|
||||
]], { i(1), i(2) })),
|
||||
s({ trig = "dgr", name = "Doxygen Group" }, fmt([[
|
||||
/*! @name {}
|
||||
* {}
|
||||
* @{{
|
||||
*/
|
||||
{}
|
||||
/*! @}}
|
||||
*/
|
||||
]], { i(1, "Undocumented Group"), i(2, "This group is undocumented."), i(0) })),
|
||||
s({ trig = "alen", name = "Array Length" }, fmt([[
|
||||
(sizeof {} / sizeof {}[0])
|
||||
]], { i(1), reference(1) })),
|
||||
s({ trig = "lls", name = "Linked List" }, fmt([[
|
||||
struct {} {{
|
||||
{}
|
||||
{} *{};
|
||||
}} {};
|
||||
]], { i(1, "Node"), i(0), reference(1), i(2, "Next"), reference(1) })),
|
||||
}
|
Loading…
Add table
Reference in a new issue