mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2025-10-21 20:10:41 +00:00
Update 2025-10-08
update 2025-10-08
This commit is contained in:
parent
f7194a919e
commit
517cef14ea
170
.editorconfig
Normal file
170
.editorconfig
Normal file
@ -0,0 +1,170 @@
|
||||
# see https://github.com/CppCXY/EmmyLuaCodeStyle
|
||||
[*.lua]
|
||||
# [basic]
|
||||
|
||||
# optional space/tab
|
||||
indent_style = tab
|
||||
# if indent_style is space, this is valid
|
||||
indent_size = 4
|
||||
# if indent_style is tab, this is valid
|
||||
tab_width = 4
|
||||
# none/single/double
|
||||
quote_style = double
|
||||
|
||||
continuation_indent = 4
|
||||
## extend option
|
||||
# continuation_indent.before_block = 4
|
||||
# continuation_indent.in_expr = 4
|
||||
# continuation_indent.in_table = 4
|
||||
|
||||
# this mean utf8 length , if this is 'unset' then the line width is no longer checked
|
||||
# this option decides when to chopdown the code
|
||||
max_line_length = 120
|
||||
|
||||
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
|
||||
# in neovim the value 'auto' is not a valid option, please use 'unset'
|
||||
end_of_line = lf
|
||||
|
||||
# none/ comma / semicolon / only_kv_colon
|
||||
table_separator_style = comma
|
||||
|
||||
#optional keep/never/always/smart
|
||||
trailing_table_separator = smart
|
||||
|
||||
# keep/remove/remove_table_only/remove_string_only
|
||||
call_arg_parentheses = keep
|
||||
|
||||
detect_end_of_line = false
|
||||
|
||||
# this will check text end with new line
|
||||
insert_final_newline = true
|
||||
|
||||
# [space]
|
||||
space_around_table_field_list = true
|
||||
|
||||
space_before_attribute = true
|
||||
|
||||
space_before_function_open_parenthesis = false
|
||||
|
||||
space_before_function_call_open_parenthesis = false
|
||||
|
||||
space_before_closure_open_parenthesis = false
|
||||
|
||||
# optional always/only_string/only_table/none
|
||||
# or true/false
|
||||
space_before_function_call_single_arg = always
|
||||
## extend option
|
||||
## always/keep/none
|
||||
# space_before_function_call_single_arg.table = always
|
||||
## always/keep/none
|
||||
# space_before_function_call_single_arg.string = always
|
||||
|
||||
space_before_open_square_bracket = false
|
||||
|
||||
space_inside_function_call_parentheses = false
|
||||
|
||||
space_inside_function_param_list_parentheses = false
|
||||
|
||||
space_inside_square_brackets = false
|
||||
|
||||
# like t[#t+1] = 1
|
||||
space_around_table_append_operator = false
|
||||
|
||||
ignore_spaces_inside_function_call = false
|
||||
|
||||
# detail number or 'keep'
|
||||
space_before_inline_comment = 1
|
||||
|
||||
# convert '---' to '--- ' or '--' to '-- '
|
||||
space_after_comment_dash = false
|
||||
|
||||
# [operator space]
|
||||
space_around_math_operator = true
|
||||
# space_around_math_operator.exponent = false
|
||||
|
||||
space_after_comma = true
|
||||
|
||||
space_after_comma_in_for_statement = true
|
||||
|
||||
# true/false or none/always/no_space_asym
|
||||
space_around_concat_operator = true
|
||||
|
||||
space_around_logical_operator = true
|
||||
|
||||
# true/false or none/always/no_space_asym
|
||||
space_around_assign_operator = true
|
||||
|
||||
# [align]
|
||||
|
||||
align_call_args = false
|
||||
|
||||
align_function_params = true
|
||||
|
||||
# true/false or always
|
||||
align_continuous_assign_statement = true
|
||||
|
||||
align_continuous_rect_table_field = true
|
||||
|
||||
align_continuous_line_space = 2
|
||||
|
||||
align_if_branch = false
|
||||
|
||||
# option none / always / contain_curly/
|
||||
align_array_table = always
|
||||
|
||||
align_continuous_similar_call_args = false
|
||||
|
||||
align_continuous_inline_comment = true
|
||||
# option none / always / only_call_stmt
|
||||
align_chain_expr = none
|
||||
|
||||
# [indent]
|
||||
|
||||
never_indent_before_if_condition = false
|
||||
|
||||
never_indent_comment_on_if_branch = false
|
||||
|
||||
keep_indents_on_empty_lines = false
|
||||
|
||||
allow_non_indented_comments = false
|
||||
# [line space]
|
||||
|
||||
# The following configuration supports four expressions
|
||||
# keep
|
||||
# fixed(n)
|
||||
# min(n)
|
||||
# max(n)
|
||||
# for eg. min(2)
|
||||
|
||||
line_space_after_if_statement = keep
|
||||
|
||||
line_space_after_do_statement = keep
|
||||
|
||||
line_space_after_while_statement = keep
|
||||
|
||||
line_space_after_repeat_statement = keep
|
||||
|
||||
line_space_after_for_statement = keep
|
||||
|
||||
line_space_after_local_or_assign_statement = keep
|
||||
|
||||
line_space_after_function_statement = fixed(2)
|
||||
|
||||
line_space_after_expression_statement = keep
|
||||
|
||||
line_space_after_comment = keep
|
||||
|
||||
line_space_around_block = fixed(1)
|
||||
# [line break]
|
||||
break_all_list_when_line_exceed = true
|
||||
|
||||
auto_collapse_lines = false
|
||||
|
||||
break_before_braces = false
|
||||
|
||||
# [preference]
|
||||
ignore_space_after_colon = false
|
||||
|
||||
remove_call_expression_list_finish_comma = false
|
||||
# keep / always / same_line / replace_with_newline / never
|
||||
end_statement_with_semicolon = keep
|
||||
@ -1,61 +0,0 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
local shared = require("config.snips")
|
||||
local same = shared.same
|
||||
local year = shared.year
|
||||
local date = shared.date
|
||||
|
||||
ls.add_snippets("c", {
|
||||
s(
|
||||
"auth",
|
||||
fmt(
|
||||
[[
|
||||
// Copyright {}
|
||||
// Author - Kristiāns Francis Cagulis, kc22015
|
||||
// {}
|
||||
// Created: {}
|
||||
]],
|
||||
{
|
||||
year(),
|
||||
i(1),
|
||||
date(),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"fn",
|
||||
fmt(
|
||||
[[
|
||||
// {};
|
||||
// Funkcija {}({}) -
|
||||
// {}
|
||||
{} {{
|
||||
}}
|
||||
]],
|
||||
{
|
||||
same(1),
|
||||
f(function(function_name)
|
||||
if not function_name[1][1] then
|
||||
function_name[1][1] = ""
|
||||
end
|
||||
local words = {}
|
||||
for word in function_name[1][1]:gmatch("%w+") do
|
||||
table.insert(words, word)
|
||||
end
|
||||
return words[2] or ""
|
||||
end, { 1 }),
|
||||
i(2),
|
||||
i(0),
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
@ -1,53 +0,0 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
local shared = require("config.snips")
|
||||
local same = shared.same
|
||||
|
||||
local cmake_version = function()
|
||||
local version = "3.27.4"
|
||||
-- vim.fn.jobstart("cmake --version | head -n 1 | rg -o '\\d+\\.\\d+\\.\\d+'", {})
|
||||
return version
|
||||
end
|
||||
|
||||
ls.add_snippets("cmake", {
|
||||
s(
|
||||
"lib",
|
||||
fmt(
|
||||
[[
|
||||
cmake_minimum_required(VERSION {})
|
||||
project({})
|
||||
add_library(${{PROJECT_NAME}} src/{}.cc)
|
||||
]],
|
||||
{
|
||||
cmake_version(),
|
||||
i(1),
|
||||
same(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"bin",
|
||||
fmt(
|
||||
[[
|
||||
cmake_minimum_required(VERSION {})
|
||||
project({})
|
||||
add_executable(${{PROJECT_NAME}} src/main.cc)
|
||||
target_link_directories(${{PROJECT_NAME}} PRIVATE ${{CMAKE_SOURCE_DIR}}/include/{}/target/build/)
|
||||
target_link_libraries(${{PROJECT_NAME}} {})
|
||||
]],
|
||||
{
|
||||
cmake_version(),
|
||||
i(1),
|
||||
i(2),
|
||||
same(2),
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
@ -1,61 +0,0 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
local shared = require("config.snips")
|
||||
local same = shared.same
|
||||
local year = shared.year
|
||||
local date = shared.date
|
||||
|
||||
ls.add_snippets("cpp", {
|
||||
s(
|
||||
"auth",
|
||||
fmt(
|
||||
[[
|
||||
// Copyright {}
|
||||
// Author - Kristiāns Francis Cagulis, kc22015
|
||||
// {}
|
||||
// Created: {}
|
||||
]],
|
||||
{
|
||||
year(),
|
||||
i(1),
|
||||
date(),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"fn",
|
||||
fmt(
|
||||
[[
|
||||
// {};
|
||||
// Funkcija {}({}) -
|
||||
// {}
|
||||
{} {{
|
||||
}}
|
||||
]],
|
||||
{
|
||||
same(1),
|
||||
f(function(function_name)
|
||||
if not function_name[1][1] then
|
||||
function_name[1][1] = ""
|
||||
end
|
||||
local words = {}
|
||||
for word in function_name[1][1]:gmatch("%w+") do
|
||||
table.insert(words, word)
|
||||
end
|
||||
return words[2] or ""
|
||||
end, { 1 }),
|
||||
i(2),
|
||||
i(0),
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
@ -1,145 +0,0 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local shared = require("config.snips")
|
||||
local same = shared.same
|
||||
|
||||
ls.add_snippets("rust", {
|
||||
s(
|
||||
"modtest",
|
||||
fmt(
|
||||
[[
|
||||
#[cfg(test)]
|
||||
mod tests {{
|
||||
use super::*;
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"tmain",
|
||||
fmt(
|
||||
[[
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {{
|
||||
Ok(())
|
||||
}}
|
||||
]],
|
||||
{}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"dead",
|
||||
fmt(
|
||||
[[
|
||||
#[allow(dead_code)]
|
||||
]],
|
||||
{}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"component",
|
||||
fmt(
|
||||
[[
|
||||
#[derive(Debug, Reflect, Component)]
|
||||
#[reflect(Component)]
|
||||
struct {}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"event",
|
||||
fmt(
|
||||
[[
|
||||
#[derive(Debug, Event)]
|
||||
struct {}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"resource",
|
||||
fmt(
|
||||
[[
|
||||
#[derive(Debug, Default, Reflect, Resource)]
|
||||
#[reflect(Resource)]
|
||||
struct {}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"schedule",
|
||||
fmt(
|
||||
[[
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ScheduleLabel)]
|
||||
struct {}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"states",
|
||||
fmt(
|
||||
[[
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, States)]
|
||||
enum {} {{
|
||||
#[default]
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"systemset",
|
||||
fmt(
|
||||
[[
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)]
|
||||
enum {} {{
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"plugin",
|
||||
fmt(
|
||||
[[
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub(super) fn plugin(app: &mut App) {{
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
@ -1,10 +0,0 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
ls.add_snippets("typst", {})
|
||||
@ -30,7 +30,9 @@
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
||||
"http-codes.nvim": { "branch": "main", "commit": "77aea3a73d5f3134089941ebf6d4172af34a4a8d" },
|
||||
"hererocks": { "branch": "master", "commit": "160228946bed9998f5e3b168bd0b66ba2690f8f3" },
|
||||
"http-codes.nvim": { "branch": "feature/snacks", "commit": "4b4886c5091a125900a6e319bddd10bc34747bf1" },
|
||||
"image.nvim": { "branch": "master", "commit": "446a8a5cc7a3eae3185ee0c697732c32a5547a0b" },
|
||||
"img-clip.nvim": { "branch": "main", "commit": "f33f3af9ba50f99d70f8fcb1a8575750ada4ea4a" },
|
||||
"inlay-hint.nvim": { "branch": "main", "commit": "ee8aa9806d1e160a2bc08b78ae60568fb6d9dbce" },
|
||||
"inlay-hints.nvim": { "branch": "master", "commit": "990e1f96699b8293b6665b9e73b16128c66684e6" },
|
||||
|
||||
@ -46,12 +46,13 @@ nmap("Q", "@qj", "Run macro")
|
||||
|
||||
nmap("<leader>oo", "<cmd>update<cr><cmd>source<cr>", "Source current file")
|
||||
|
||||
-- vim.keymap.set({ "n", "v", "x" }, "<leader>y", '"+y', { desc = "Yank to system clipboard" })
|
||||
-- vim.keymap.set("n", "<leader>Y", '"+yy', { desc = "Yank line to system clipboard" })
|
||||
vim.keymap.set({ "n", "v", "x" }, "<leader>y", '"+y<cr>', { desc = "Yank to system clipboard" })
|
||||
vim.keymap.set("n", "<leader>Y", '"+yy<cr>', { desc = "Yank line to system clipboard" })
|
||||
|
||||
-- vim.keymap.set({ "n", "v", "x" }, "<leader>p", '"+p', { desc = "Paste from system clipboard" })
|
||||
-- vim.keymap.set("n", "<leader>P", '"+P', { desc = "Paste before cursor from system clipboard" })
|
||||
vim.keymap.set({ "n", "v", "x" }, "<leader>d", '"+d<cr>', { desc = "Cut to system clipboard" })
|
||||
|
||||
vim.keymap.set({ "n", "v", "x" }, "<leader>p", '"+p<cr>', { desc = "Paste from system clipboard" })
|
||||
vim.keymap.set("n", "<leader>P", '"+P<cr>', { desc = "Paste before cursor from system clipboard" })
|
||||
|
||||
vim.keymap.set("n", "<leader>cf", function()
|
||||
local file_path = vim.fn.expand("%:p")
|
||||
|
||||
@ -28,9 +28,6 @@ require("lazy").setup({
|
||||
ui = { border = "rounded" },
|
||||
change_detection = { enabled = false },
|
||||
rocks = {
|
||||
hererocks = nil,
|
||||
},
|
||||
dev = {
|
||||
path = "~/repos/nvim/plugins",
|
||||
hererocks = true,
|
||||
},
|
||||
})
|
||||
|
||||
@ -1,78 +0,0 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local ls = require("luasnip")
|
||||
local f = ls.function_node
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
|
||||
--[[
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require("luasnip.util.events")
|
||||
local ai = require("luasnip.nodes.absolute_indexer")
|
||||
local extras = require("luasnip.extras")
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local conds = require("luasnip.extras.expand_conditions")
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local types = require("luasnip.util.types")
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
]]
|
||||
|
||||
local shortcut = function(val)
|
||||
if type(val) == "string" then
|
||||
return { t({ val }), i(0) }
|
||||
end
|
||||
if type(val) == "table" then
|
||||
for k, v in ipairs(val) do
|
||||
if type(v) == "string" then
|
||||
val[k] = t({ v })
|
||||
end
|
||||
end
|
||||
end
|
||||
return val
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.same = function(index)
|
||||
return f(function(args)
|
||||
return args[1]
|
||||
end, { index })
|
||||
end
|
||||
|
||||
M.year = function()
|
||||
return os.date("%Y")
|
||||
end
|
||||
|
||||
M.date = function()
|
||||
return os.date("%d.%m.%Y")
|
||||
end
|
||||
|
||||
M.make = function(tbl)
|
||||
local result = {}
|
||||
for k, v in pairs(tbl) do
|
||||
table.insert(result, (s({ trig = k, desc = v.desc }, shortcut(v))))
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
return M
|
||||
@ -33,7 +33,13 @@ return {
|
||||
javascript = js,
|
||||
javascriptreact = js,
|
||||
json = { "jq" },
|
||||
lua = { "stylua" },
|
||||
lua = function()
|
||||
local config_file = vim.fn.getcwd() .. "/*stylua.toml"
|
||||
if vim.fn.exists(config_file) then
|
||||
return { "stylua" }
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
markdown = makrdown,
|
||||
python = { "ruff_format", "ruff_fix", "ruff_organize_imports", "docformatter" },
|
||||
rest = { "kulala" },
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
return {
|
||||
{
|
||||
|
||||
"Saecki/crates.nvim",
|
||||
tag = "stable",
|
||||
event = { "BufRead Cargo.toml" },
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
return {
|
||||
"barrett-ruth/http-codes.nvim",
|
||||
dependencies = { "folke/snacks.nvim" },
|
||||
"kristoferssolo/http-codes.nvim",
|
||||
branch = "feature/snacks",
|
||||
dependencies = "folke/snacks.nvim",
|
||||
cmd = "HTTPCodes",
|
||||
keys = { { "<leader>pdh", vim.cmd.HTTPCodes, desc = "HTTP" } },
|
||||
config = true,
|
||||
keys = { { "<leader>pH", vim.cmd.HTTPCodes, desc = "HTTP" } },
|
||||
opts = {
|
||||
use = "snacks",
|
||||
},
|
||||
}
|
||||
|
||||
@ -2,6 +2,39 @@ local function is_typst()
|
||||
return vim.bo.filetype == "typst"
|
||||
end
|
||||
return {
|
||||
{
|
||||
"3rd/image.nvim",
|
||||
opts = {
|
||||
backend = "ueberzug",
|
||||
processor = "magick_rock",
|
||||
scale_factor = 0.5,
|
||||
integrations = {
|
||||
neorg = {
|
||||
clear_in_insert_mode = true,
|
||||
only_render_image_at_cursor = true,
|
||||
only_render_image_at_cursor_mode = "popup",
|
||||
},
|
||||
typst = {
|
||||
clear_in_insert_mode = true,
|
||||
only_render_image_at_cursor = true,
|
||||
only_render_image_at_cursor_mode = "popup",
|
||||
},
|
||||
markdown = {
|
||||
clear_in_insert_mode = true,
|
||||
only_render_image_at_cursor = true,
|
||||
only_render_image_at_cursor_mode = "popup",
|
||||
resolve_image_path = function(document_path, image_path, fallback)
|
||||
local working_dir = vim.fn.getcwd()
|
||||
if working_dir:find("Obsidian") then
|
||||
return working_dir .. "/assets/img/" .. image_path
|
||||
end
|
||||
return fallback(document_path, image_path)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"HakonHarnes/img-clip.nvim",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
@ -26,9 +59,7 @@ return {
|
||||
end,
|
||||
file_name = "%Y-%m-%d_%H-%M-%S",
|
||||
relative_to_current_file = false,
|
||||
prompt_for_file_name = function()
|
||||
return is_typst()
|
||||
end,
|
||||
prompt_for_file_name = is_typst,
|
||||
embed_image_as_base64 = false,
|
||||
drag_and_drop = {
|
||||
insert_mode = true,
|
||||
@ -51,4 +82,5 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ return {
|
||||
vim.lsp.buf.hover({ border = "rounded" })
|
||||
end, "Hover Documentation")
|
||||
nmap("gi", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
|
||||
vim.keymap.set("i", "<C-h>", function()
|
||||
vim.keymap.set("i", "<C-H>", function()
|
||||
vim.lsp.buf.signature_help({ border = "rounded" })
|
||||
end, { buffer = event.buf, desc = "LSP: Signature Documentation" })
|
||||
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
|
||||
@ -85,7 +85,7 @@ return {
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end, "Diagnostic Prev")
|
||||
nmap("]d", function()
|
||||
trouble:next({ mode = "diagnostics", skip_groups = true, jump = true })
|
||||
trouble.next({ mode = "diagnostics", skip_groups = true, jump = true })
|
||||
end, "LSP: Trouble Next")
|
||||
nmap("[d", function()
|
||||
trouble.prev({ mode = "diagnostics", skip_groups = true, jump = true })
|
||||
@ -99,7 +99,9 @@ return {
|
||||
nmap("gr", function()
|
||||
trouble.toggle("lsp_references")
|
||||
end, "[G]oto [R]eferences")
|
||||
nmap("gR", function() Snacks.picker.lsp_references() end, "[G]oto [R]eferences")
|
||||
nmap("gR", function()
|
||||
Snacks.picker.lsp_references()
|
||||
end, "[G]oto [R]eferences")
|
||||
end,
|
||||
})
|
||||
|
||||
@ -194,38 +196,42 @@ return {
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim", "awesome", "client", "ya" },
|
||||
globals = {
|
||||
"vim",
|
||||
"awesome",
|
||||
"client",
|
||||
"s",
|
||||
"sn",
|
||||
"isn",
|
||||
"t",
|
||||
"i",
|
||||
"f",
|
||||
"c",
|
||||
"d",
|
||||
"r",
|
||||
"events",
|
||||
"k",
|
||||
"ai",
|
||||
"extras",
|
||||
"l",
|
||||
"rep",
|
||||
"p",
|
||||
"m",
|
||||
"n",
|
||||
"dl",
|
||||
"fmt",
|
||||
"fmta",
|
||||
"conds",
|
||||
"postfix",
|
||||
"types",
|
||||
"parse",
|
||||
"ms",
|
||||
},
|
||||
-- workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
-- library = vim.api.nvim_get_runtime_file("", true),
|
||||
-- },
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
root_pattern = {
|
||||
".stylua.toml",
|
||||
".luarc.json",
|
||||
".luarc.jsonc",
|
||||
".luacheckrc",
|
||||
"stylua.toml",
|
||||
"selene.toml",
|
||||
"selene.yml",
|
||||
".git",
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
format = { enable = true },
|
||||
hint = { enable = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -3,20 +3,13 @@ return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = "make install_jsregexp",
|
||||
version = "v2.*",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets", -- a bunch of snippets to use
|
||||
},
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
opts = function()
|
||||
local types = require("luasnip.util.types")
|
||||
return {
|
||||
-- This tells LuaSnip to remember to keep around the last snippet.
|
||||
-- You can jump back into it even if you move outside of the selection
|
||||
history = true,
|
||||
-- This one is cool cause if you have dynamic snippets, it updates as you type!
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
-- Autosnippets:
|
||||
enable_autosnippets = true,
|
||||
-- Crazy highlights!!
|
||||
ext_opts = {
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
@ -29,32 +22,6 @@ return {
|
||||
config = function(_, opts)
|
||||
local ls = require("luasnip")
|
||||
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require("luasnip.util.events")
|
||||
local ai = require("luasnip.nodes.absolute_indexer")
|
||||
local extras = require("luasnip.extras")
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local conds = require("luasnip.extras.expand_conditions")
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local types = require("luasnip.util.types")
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<C-j>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
@ -83,15 +50,11 @@ return {
|
||||
|
||||
require("luasnip.loaders.from_vscode").load({
|
||||
exclude = {
|
||||
"rust",
|
||||
rust = {
|
||||
"modtest",
|
||||
},
|
||||
rust = { "modtest" },
|
||||
},
|
||||
})
|
||||
vim.tbl_map(function(type)
|
||||
require("luasnip.loaders.from_" .. type).lazy_load()
|
||||
end, { "vscode", "snipmate", "lua" })
|
||||
|
||||
require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath("config") .. "/snippets/" })
|
||||
|
||||
ls.filetype_extend("typescript", { "tsdoc" })
|
||||
ls.filetype_extend("javascript", { "jsdoc" })
|
||||
|
||||
@ -31,7 +31,6 @@ return {
|
||||
desc = "Extract the visually selected text into a new note and link to it.",
|
||||
},
|
||||
{ "<leader>Ow", vim.cmd.ObsidianWorkspace, desc = "Switch to another workspace." },
|
||||
-- { "<leader>Op", vim.cmd.ObsidianPasteImg, desc = "Paste an image from the clipboard into the note." },
|
||||
{
|
||||
"<leader>Or",
|
||||
vim.cmd.ObsidianRename,
|
||||
|
||||
@ -18,7 +18,7 @@ return {
|
||||
bufdelete = { enabled = true },
|
||||
dashboard = { enabled = false },
|
||||
debug = { enabled = true },
|
||||
dim = { enabled = true },
|
||||
dim = { enabled = false },
|
||||
explorer = { enabled = false },
|
||||
git = { enabled = true },
|
||||
gitbrowse = { enabled = true },
|
||||
@ -44,7 +44,7 @@ return {
|
||||
enabled = true,
|
||||
format = "file",
|
||||
layout = {
|
||||
preset = "telescope"
|
||||
preset = "telescope",
|
||||
},
|
||||
matcher = {
|
||||
frecency = true,
|
||||
@ -57,10 +57,10 @@ return {
|
||||
keys = {
|
||||
["<C-t>"] = {
|
||||
"trouble_open",
|
||||
mode = { "n", "i" }
|
||||
}
|
||||
}
|
||||
}
|
||||
mode = { "n", "i" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
profiler = { enabled = false },
|
||||
@ -116,20 +116,111 @@ return {
|
||||
desc = "Git Blame",
|
||||
},
|
||||
{
|
||||
"<C-n>", function() Snacks.picker.files() end, desc = "Find Files" },
|
||||
{ "<leader>pf", function() Snacks.picker.files() end, desc = "Find Files" },
|
||||
{ "<leader>ps", function() Snacks.picker.grep() end, desc = "Grep" },
|
||||
{ "<leader>pb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>pw", function() Snacks.picker.grep_word() end, desc = "Visual selection of word", mode = { "n", "x" } },
|
||||
{ "<leader>pi", function() Snacks.picker.icons() end, desc = "Icons", },
|
||||
{ "<leader>ph", function() Snacks.picker.help() end, desc = "Help Pages", },
|
||||
{ "<leader>pr", function() Snacks.picker.recent() end, desc = "Recent", },
|
||||
{ "<leader>pR", function() Snacks.picker.registers() end, desc = "Registers", },
|
||||
{ "<leader>pg", function() Snacks.picker.git_files() end, desc = "Find Git Fiels", },
|
||||
{ "<leader>pk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
||||
{ "<leader>pt", function() Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" },
|
||||
{ "<leader>pc", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
|
||||
{ "<leader>pl", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
|
||||
"<C-n>",
|
||||
function()
|
||||
Snacks.picker.files()
|
||||
end,
|
||||
desc = "Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>pf",
|
||||
function()
|
||||
Snacks.picker.files()
|
||||
end,
|
||||
desc = "Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>ps",
|
||||
function()
|
||||
Snacks.picker.grep()
|
||||
end,
|
||||
desc = "Grep",
|
||||
},
|
||||
{
|
||||
"<leader>pb",
|
||||
function()
|
||||
Snacks.picker.buffers()
|
||||
end,
|
||||
desc = "Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>pw",
|
||||
function()
|
||||
Snacks.picker.grep_word()
|
||||
end,
|
||||
desc = "Visual selection of word",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
{
|
||||
"<leader>pi",
|
||||
function()
|
||||
Snacks.picker.icons()
|
||||
end,
|
||||
desc = "Icons",
|
||||
},
|
||||
{
|
||||
"<leader>ph",
|
||||
function()
|
||||
Snacks.picker.help()
|
||||
end,
|
||||
desc = "Help Pages",
|
||||
},
|
||||
{
|
||||
"<leader>pr",
|
||||
function()
|
||||
Snacks.picker.recent()
|
||||
end,
|
||||
desc = "Recent",
|
||||
},
|
||||
{
|
||||
"<leader>pR",
|
||||
function()
|
||||
Snacks.picker.registers()
|
||||
end,
|
||||
desc = "Registers",
|
||||
},
|
||||
{
|
||||
"<leader>pg",
|
||||
function()
|
||||
Snacks.picker.git_files()
|
||||
end,
|
||||
desc = "Find Git Fiels",
|
||||
},
|
||||
{
|
||||
"<leader>pk",
|
||||
function()
|
||||
Snacks.picker.keymaps()
|
||||
end,
|
||||
desc = "Keymaps",
|
||||
},
|
||||
{
|
||||
"<leader>pt",
|
||||
function()
|
||||
Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } })
|
||||
end,
|
||||
desc = "Todo/Fix/Fixme",
|
||||
},
|
||||
{
|
||||
"<leader>pc",
|
||||
function()
|
||||
Snacks.picker.colorschemes()
|
||||
end,
|
||||
desc = "Colorschemes",
|
||||
},
|
||||
{
|
||||
"<leader>pl",
|
||||
function()
|
||||
Snacks.picker.lazy()
|
||||
end,
|
||||
desc = "Search for Plugin Spec",
|
||||
},
|
||||
{
|
||||
"<leader>pD",
|
||||
function()
|
||||
Snacks.picker.diagnostics()
|
||||
end,
|
||||
desc = "Diagnostics",
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
|
||||
@ -1,69 +1,5 @@
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {
|
||||
signs = true, -- show icons in the signs column
|
||||
sign_priority = 8, -- sign priority
|
||||
-- keywords recognized as todo comments
|
||||
keywords = {
|
||||
FIX = {
|
||||
icon = " ", -- icon used for the sign, and in search results
|
||||
color = "error", -- can be a hex color, or a named color (see below)
|
||||
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||
-- signs = false, -- configure signs for some keywords individually
|
||||
},
|
||||
TODO = { icon = " ", color = "info" },
|
||||
HACK = { icon = " ", color = "warning" },
|
||||
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||
NOTE = { icon = " ", color = "hint", alt = { "INFO", "HINT" } },
|
||||
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
},
|
||||
gui_style = {
|
||||
fg = "NONE", -- The gui style to use for the fg highlight group.
|
||||
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
||||
},
|
||||
|
||||
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||
-- highlighting of the line containing the todo comment
|
||||
-- * before: highlights before the keyword (typically comment characters)
|
||||
-- * keyword: highlights of the keyword
|
||||
-- * after: highlights after the keyword (todo text)
|
||||
highlight = {
|
||||
multiline = true, -- enable multine todo comments
|
||||
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
|
||||
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
|
||||
before = "", -- "fg" or "bg" or empty
|
||||
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
|
||||
after = "fg", -- "fg" or "bg" or empty
|
||||
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
|
||||
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||
max_line_len = 400, -- ignore lines longer than this
|
||||
exclude = {}, -- list of file types to exclude highlighting
|
||||
},
|
||||
-- list of named colors where we try to extract the guifg from the
|
||||
-- list of highlight groups or use the hex color if hl not found as a fallback
|
||||
colors = {
|
||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||
info = { "DiagnosticInfo", "#2563EB" },
|
||||
hint = { "DiagnosticHint", "#10B981" },
|
||||
default = { "Identifier", "#7C3AED" },
|
||||
test = { "Identifier", "#FF00FF" },
|
||||
},
|
||||
search = {
|
||||
command = "rg",
|
||||
args = {
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
},
|
||||
-- regex that will be used to match keywords.
|
||||
-- don't replace the (KEYWORDS) placeholder
|
||||
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
||||
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
local ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" }
|
||||
return {
|
||||
{
|
||||
"pmizio/typescript-tools.nvim",
|
||||
@ -5,7 +6,7 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" },
|
||||
ft = ft,
|
||||
opts = {
|
||||
on_attach = function(client)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
@ -33,7 +34,7 @@ return {
|
||||
-- memory limit in megabytes or "auto"(basically no limit)
|
||||
tsserver_max_memory = "auto",
|
||||
-- described below
|
||||
tsserver_format_options = function(ft)
|
||||
tsserver_format_options = function(_)
|
||||
-- Return empty table to disable formatting
|
||||
return {}
|
||||
end,
|
||||
@ -72,13 +73,13 @@ return {
|
||||
},
|
||||
{
|
||||
"dmmulroy/ts-error-translator.nvim",
|
||||
ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" },
|
||||
ft = ft,
|
||||
},
|
||||
{
|
||||
"folke/ts-comments.nvim",
|
||||
opts = {},
|
||||
event = "VeryLazy",
|
||||
enabled = vim.fn.has("nvim-0.10.0") == 1,
|
||||
ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" },
|
||||
ft = ft,
|
||||
},
|
||||
}
|
||||
|
||||
@ -18,43 +18,5 @@ return {
|
||||
build = function()
|
||||
require("typst-preview").update()
|
||||
end,
|
||||
opts = {
|
||||
-- Setting this true will enable printing debug information with print()
|
||||
debug = false,
|
||||
|
||||
-- Custom format string to open the output link provided with %s
|
||||
-- Example: open_cmd = 'firefox %s -P typst-preview --class typst-preview'
|
||||
open_cmd = "xdg-open %s",
|
||||
-- open_cmd = "floorp %s -P typst-preview --class typst-preview",
|
||||
|
||||
-- Setting this to 'always' will invert black and white in the preview
|
||||
-- Setting this to 'auto' will invert depending if the browser has enable
|
||||
-- dark mode
|
||||
invert_colors = nil,
|
||||
-- Whether the preview will follow the cursor in the source file
|
||||
follow_cursor = true,
|
||||
|
||||
-- Provide the path to binaries for dependencies.
|
||||
-- Setting this will skip the download of the binary by the plugin.
|
||||
-- Warning: Be aware that your version might be older than the one
|
||||
-- required.
|
||||
dependencies_bin = {
|
||||
-- if you are using tinymist, just set ['typst-preview'] = "tinymist".
|
||||
["typst-preview"] = nil,
|
||||
["websocat"] = nil,
|
||||
},
|
||||
-- A list of extra arguments (or nil) to be passed to previewer.
|
||||
-- For example, extra_args = { "--input=ver=draft", "--ignore-system-fonts" }
|
||||
extra_args = nil,
|
||||
-- This function will be called to determine the root of the typst project
|
||||
get_root = function(path_of_main_file)
|
||||
return vim.fn.fnamemodify(path_of_main_file, ":p:h")
|
||||
end,
|
||||
|
||||
-- This function will be called to determine the main file of the typst
|
||||
-- project.
|
||||
get_main_file = function(path_of_buffer)
|
||||
return path_of_buffer
|
||||
end,
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ std = "neovim"
|
||||
|
||||
[rules]
|
||||
global_usage = "allow"
|
||||
undefined_variable = "allow"
|
||||
multiple_statements = "allow"
|
||||
incorrect_standard_library_use = "allow"
|
||||
mixed_table = "allow"
|
||||
|
||||
1
snippets/all.lua
Normal file
1
snippets/all.lua
Normal file
@ -0,0 +1 @@
|
||||
return {}
|
||||
3
snippets/c.lua
Normal file
3
snippets/c.lua
Normal file
@ -0,0 +1,3 @@
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
return {}
|
||||
3
snippets/cmake.lua
Normal file
3
snippets/cmake.lua
Normal file
@ -0,0 +1,3 @@
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
return {}
|
||||
3
snippets/cpp.lua
Normal file
3
snippets/cpp.lua
Normal file
@ -0,0 +1,3 @@
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
return {}
|
||||
@ -1,22 +1,4 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local ls = require("luasnip")
|
||||
|
||||
local s = ls.snippet
|
||||
local sn = ls.sn
|
||||
local i = ls.insert_node
|
||||
local t = ls.text_node
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
local shared = require("config.snips")
|
||||
|
||||
local newline = function(text)
|
||||
return t({ "", text })
|
||||
end
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
local require_var = function(args, _)
|
||||
local text = args[1][1] or ""
|
||||
@ -32,12 +14,12 @@ local require_var = function(args, _)
|
||||
})
|
||||
end
|
||||
|
||||
ls.add_snippets("lua", {
|
||||
return {
|
||||
s(
|
||||
"lf",
|
||||
fmt(
|
||||
[[
|
||||
local {} = function({})
|
||||
local function {}({})
|
||||
{}
|
||||
end{}
|
||||
]],
|
||||
@ -70,4 +52,4 @@ ls.add_snippets("lua", {
|
||||
i(1),
|
||||
})
|
||||
),
|
||||
})
|
||||
}
|
||||
@ -1,13 +1,6 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
ls.add_snippets("markdown", {
|
||||
return {
|
||||
s(
|
||||
"ket",
|
||||
fmt(
|
||||
@ -47,4 +40,4 @@ ls.add_snippets("markdown", {
|
||||
{}
|
||||
)
|
||||
),
|
||||
})
|
||||
}
|
||||
@ -1,15 +1,6 @@
|
||||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local t = ls.text_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local c = ls.choice_node
|
||||
|
||||
ls.add_snippets("python", {
|
||||
return {
|
||||
s(
|
||||
"logger",
|
||||
fmt(
|
||||
@ -97,4 +88,17 @@ ls.add_snippets("python", {
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
}, {
|
||||
s(
|
||||
"__",
|
||||
fmta(
|
||||
[[
|
||||
__<init>__<>
|
||||
]],
|
||||
{
|
||||
init = i(1),
|
||||
i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
}
|
||||
233
snippets/rust.lua
Normal file
233
snippets/rust.lua
Normal file
@ -0,0 +1,233 @@
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
local snippets = {
|
||||
s("p", fmta([[println!("{}", <>)]], { i(0) })),
|
||||
s(
|
||||
"modtest",
|
||||
fmta(
|
||||
[[
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
s(
|
||||
"test",
|
||||
fmta(
|
||||
[[
|
||||
#[test]
|
||||
fn <name>() {
|
||||
<body>
|
||||
}
|
||||
]],
|
||||
{
|
||||
name = i(1),
|
||||
body = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"rstest",
|
||||
fmta(
|
||||
[[
|
||||
#[rstest]
|
||||
#[case(<case>)]
|
||||
fn <name>(<args>) {
|
||||
<body>
|
||||
}
|
||||
]],
|
||||
{
|
||||
name = i(1),
|
||||
args = i(2),
|
||||
case = i(3),
|
||||
body = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"tmain",
|
||||
fmt(
|
||||
[[
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {{
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
i(1, "todo!();"),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"dead",
|
||||
fmt(
|
||||
[[
|
||||
#[allow(dead_code)]
|
||||
]],
|
||||
{}
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
local function has_bevy()
|
||||
local cwd = vim.fn.getcwd()
|
||||
local cargo_toml = cwd .. "/Cargo.toml"
|
||||
|
||||
if vim.fn.filereadable(cargo_toml) == 1 then
|
||||
local contents = vim.fn.readfile(cargo_toml)
|
||||
for _, line in ipairs(contents) do
|
||||
if line:match("^%s*bevy%s*=") or line:find("bevy") and not line:find("bevy%.") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local bevy_snippets = {
|
||||
s(
|
||||
"component",
|
||||
fmta(
|
||||
[[
|
||||
#[derive(Debug, Reflect, Component)]
|
||||
#[reflect(Component)]
|
||||
pub struct <name><params>
|
||||
]],
|
||||
{
|
||||
name = i(1, "Component"),
|
||||
params = c(2, {
|
||||
t(";"),
|
||||
t("( );"),
|
||||
t(" { }"),
|
||||
}),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"event",
|
||||
fmta(
|
||||
[[
|
||||
#[derive(Debug, Event)]
|
||||
pub struct <name><params>
|
||||
]],
|
||||
{
|
||||
name = i(1, "Event"),
|
||||
params = c(2, {
|
||||
t(";"),
|
||||
t("( );"),
|
||||
t(" { }"),
|
||||
}),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"resource",
|
||||
fmta(
|
||||
[[
|
||||
#[derive(Debug, Default, Reflect, Resource)]
|
||||
#[reflect(Resource)]
|
||||
pub struct <name><params>
|
||||
]],
|
||||
{
|
||||
name = i(1, "Resource"),
|
||||
params = c(2, {
|
||||
t(";"),
|
||||
t("( );"),
|
||||
t(" { }"),
|
||||
}),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"schedule",
|
||||
fmta(
|
||||
[[
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ScheduleLabel)]
|
||||
pub struct <name><params>
|
||||
]],
|
||||
{
|
||||
name = i(1, "Resource"),
|
||||
params = c(2, {
|
||||
t(";"),
|
||||
t("( );"),
|
||||
t(" { }"),
|
||||
}),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"state",
|
||||
fmta(
|
||||
[[
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, States)]
|
||||
pub enum <name> {
|
||||
#[default]
|
||||
<default>,
|
||||
<variants>
|
||||
}
|
||||
]],
|
||||
{
|
||||
name = i(1, "State"),
|
||||
default = i(2, "Default"),
|
||||
variants = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"systemset",
|
||||
fmta(
|
||||
[[
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)]
|
||||
pub enum <name> {
|
||||
<body>
|
||||
}
|
||||
]],
|
||||
{
|
||||
name = i(1),
|
||||
body = i(2),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"plugin",
|
||||
fmta(
|
||||
[[
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub(super) fn plugin(app: &mut App) {
|
||||
<body>
|
||||
}
|
||||
]],
|
||||
{
|
||||
body = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"query",
|
||||
fmta(
|
||||
[[
|
||||
fn <name>(<args>) {
|
||||
<body>
|
||||
}
|
||||
]],
|
||||
{
|
||||
name = i(1, "sytem"),
|
||||
args = i(2, "args"),
|
||||
body = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
if has_bevy() then
|
||||
vim.tbl_extend("force", snippets, bevy_snippets)
|
||||
end
|
||||
|
||||
return snippets
|
||||
33
snippets/typst.lua
Normal file
33
snippets/typst.lua
Normal file
@ -0,0 +1,33 @@
|
||||
---@diagnostic disable: undefined-global
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "([^%s]+)t", name = "Superscript", regTrig = true },
|
||||
fmta("(<>)^(<>)", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(0),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "([^%s]+)b", name = "Subscript", regTrig = true },
|
||||
fmta("(<>)_(<>)", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(0),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "([^%s]+)r", name = "Root", regTrig = true },
|
||||
fmta("sqrt(<>)", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
})
|
||||
),
|
||||
}, { -- autosnippets
|
||||
s({ trig = "mt", name = "Math Block" }, fmta("$<>$", { i(1) })),
|
||||
s({ trig = "mmt", name = "Multiline Math Block" }, fmta("$ <> $", { i(1) })),
|
||||
}
|
||||
@ -627,3 +627,5 @@ saprotami
|
||||
iekavās
|
||||
iekavām
|
||||
viennozīmīgu
|
||||
iekavas
|
||||
atbilsoši
|
||||
|
||||
Binary file not shown.
10
stylua.toml
10
stylua.toml
@ -1,10 +0,0 @@
|
||||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Tabs"
|
||||
indent_width = 4
|
||||
quote_style = "AutoPreferDouble"
|
||||
call_parentheses = "Always"
|
||||
collapse_simple_statement = "Never"
|
||||
|
||||
[sort_requires]
|
||||
enabled = false
|
||||
Loading…
Reference in New Issue
Block a user