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" },
|
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
||||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
"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" },
|
"img-clip.nvim": { "branch": "main", "commit": "f33f3af9ba50f99d70f8fcb1a8575750ada4ea4a" },
|
||||||
"inlay-hint.nvim": { "branch": "main", "commit": "ee8aa9806d1e160a2bc08b78ae60568fb6d9dbce" },
|
"inlay-hint.nvim": { "branch": "main", "commit": "ee8aa9806d1e160a2bc08b78ae60568fb6d9dbce" },
|
||||||
"inlay-hints.nvim": { "branch": "master", "commit": "990e1f96699b8293b6665b9e73b16128c66684e6" },
|
"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")
|
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", "v", "x" }, "<leader>y", '"+y<cr>', { desc = "Yank to system clipboard" })
|
||||||
-- vim.keymap.set("n", "<leader>Y", '"+yy', { desc = "Yank line 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", "v", "x" }, "<leader>d", '"+d<cr>', { desc = "Cut to system clipboard" })
|
||||||
-- vim.keymap.set("n", "<leader>P", '"+P', { desc = "Paste before cursor from 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()
|
vim.keymap.set("n", "<leader>cf", function()
|
||||||
local file_path = vim.fn.expand("%:p")
|
local file_path = vim.fn.expand("%:p")
|
||||||
|
|||||||
@ -28,9 +28,6 @@ require("lazy").setup({
|
|||||||
ui = { border = "rounded" },
|
ui = { border = "rounded" },
|
||||||
change_detection = { enabled = false },
|
change_detection = { enabled = false },
|
||||||
rocks = {
|
rocks = {
|
||||||
hererocks = nil,
|
hererocks = true,
|
||||||
},
|
|
||||||
dev = {
|
|
||||||
path = "~/repos/nvim/plugins",
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,57 +1,57 @@
|
|||||||
vim.opt.backup = false -- creates a backup file
|
vim.opt.backup = false -- creates a backup file
|
||||||
vim.opt.breakindent = true -- Enable break indent
|
vim.opt.breakindent = true -- Enable break indent
|
||||||
vim.opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
|
vim.opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
|
||||||
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
|
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
|
||||||
vim.opt.colorcolumn = "120"
|
vim.opt.colorcolumn = "120"
|
||||||
vim.opt.completeopt = { "menuone", "noselect" } -- mostly just for cmp
|
vim.opt.completeopt = { "menuone", "noselect" } -- mostly just for cmp
|
||||||
vim.opt.conceallevel = 2 -- so that `` is visible in markdown files
|
vim.opt.conceallevel = 2 -- so that `` is visible in markdown files
|
||||||
vim.opt.cursorcolumn = true -- highlight the current column
|
vim.opt.cursorcolumn = true -- highlight the current column
|
||||||
vim.opt.cursorline = true -- highlight the current line
|
vim.opt.cursorline = true -- highlight the current line
|
||||||
vim.opt.expandtab = true -- convert tabs to spaces
|
vim.opt.expandtab = true -- convert tabs to spaces
|
||||||
vim.opt.fileencoding = "utf-8" -- the encoding written to a file
|
vim.opt.fileencoding = "utf-8" -- the encoding written to a file
|
||||||
vim.opt.fillchars.eob = " "
|
vim.opt.fillchars.eob = " "
|
||||||
vim.opt.foldmethod = "manual"
|
vim.opt.foldmethod = "manual"
|
||||||
vim.opt.foldenable = true
|
vim.opt.foldenable = true
|
||||||
vim.opt.foldlevelstart = 99
|
vim.opt.foldlevelstart = 99
|
||||||
vim.opt.foldcolumn = "1" -- '0' is not bad
|
vim.opt.foldcolumn = "1" -- '0' is not bad
|
||||||
vim.opt.guifont = "JetBrainsMono NF:h11" -- the font used in graphical neovim applications
|
vim.opt.guifont = "JetBrainsMono NF:h11" -- the font used in graphical neovim applications
|
||||||
vim.opt.hlsearch = false -- highlight all matches on previous search pattern
|
vim.opt.hlsearch = false -- highlight all matches on previous search pattern
|
||||||
vim.opt.ignorecase = true -- ignore case in search patterns
|
vim.opt.ignorecase = true -- ignore case in search patterns
|
||||||
vim.opt.incsearch = true
|
vim.opt.incsearch = true
|
||||||
vim.opt.isfname:append("@-@")
|
vim.opt.isfname:append("@-@")
|
||||||
vim.opt.iskeyword:append("-")
|
vim.opt.iskeyword:append("-")
|
||||||
vim.opt.laststatus = 3
|
vim.opt.laststatus = 3
|
||||||
vim.opt.mouse = "a" -- allow the mouse to be used in neovim
|
vim.opt.mouse = "a" -- allow the mouse to be used in neovim
|
||||||
vim.opt.number = true -- set numbered lines
|
vim.opt.number = true -- set numbered lines
|
||||||
vim.opt.numberwidth = 4 -- set number column width to 4 {default 4}
|
vim.opt.numberwidth = 4 -- set number column width to 4 {default 4}
|
||||||
vim.opt.pumheight = 10 -- pop up menu height
|
vim.opt.pumheight = 10 -- pop up menu height
|
||||||
vim.opt.relativenumber = true -- set relative numbered lines
|
vim.opt.relativenumber = true -- set relative numbered lines
|
||||||
vim.opt.ruler = false
|
vim.opt.ruler = false
|
||||||
vim.opt.scrolloff = 8 -- is one of my fav
|
vim.opt.scrolloff = 8 -- is one of my fav
|
||||||
vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
|
vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
|
||||||
vim.opt.shortmess:append("c")
|
vim.opt.shortmess:append("c")
|
||||||
vim.opt.showcmd = false
|
vim.opt.showcmd = false
|
||||||
vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
|
vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
|
||||||
vim.opt.showtabline = 0 -- disable tabs
|
vim.opt.showtabline = 0 -- disable tabs
|
||||||
vim.opt.sidescrolloff = 8
|
vim.opt.sidescrolloff = 8
|
||||||
vim.opt.signcolumn = "yes" -- always show the sign column otherwise it would shift the text each time
|
vim.opt.signcolumn = "yes" -- always show the sign column otherwise it would shift the text each time
|
||||||
vim.opt.smartcase = true -- smart case
|
vim.opt.smartcase = true -- smart case
|
||||||
vim.opt.smartindent = true -- make indenting smarter again
|
vim.opt.smartindent = true -- make indenting smarter again
|
||||||
vim.opt.softtabstop = 4
|
vim.opt.softtabstop = 4
|
||||||
vim.opt.spell = false
|
vim.opt.spell = false
|
||||||
vim.opt.spelloptions:append("camel")
|
vim.opt.spelloptions:append("camel")
|
||||||
vim.opt.splitbelow = true -- force all horizontal splits to go below current window
|
vim.opt.splitbelow = true -- force all horizontal splits to go below current window
|
||||||
vim.opt.splitright = true -- force all vertical splits to go to the right of current window
|
vim.opt.splitright = true -- force all vertical splits to go to the right of current window
|
||||||
vim.opt.swapfile = false -- creates a swapfile
|
vim.opt.swapfile = false -- creates a swapfile
|
||||||
vim.opt.tabstop = 4 -- insert 4 spaces for a tab
|
vim.opt.tabstop = 4 -- insert 4 spaces for a tab
|
||||||
vim.opt.termguicolors = true -- set term gui colors (most terminals support this)
|
vim.opt.termguicolors = true -- set term gui colors (most terminals support this)
|
||||||
vim.opt.timeoutlen = 250 -- time to wait for a mapped sequence to complete (in milliseconds)
|
vim.opt.timeoutlen = 250 -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||||
vim.opt.undodir = vim.fn.stdpath("data") .. "/nvim/undodir"
|
vim.opt.undodir = vim.fn.stdpath("data") .. "/nvim/undodir"
|
||||||
vim.opt.undofile = true -- enable persistent undo
|
vim.opt.undofile = true -- enable persistent undo
|
||||||
vim.opt.updatetime = 50 -- faster completion (4000ms default)
|
vim.opt.updatetime = 50 -- faster completion (4000ms default)
|
||||||
vim.opt.whichwrap:append("<,>,[,],h,l")
|
vim.opt.whichwrap:append("<,>,[,],h,l")
|
||||||
vim.opt.wrap = false -- display lines as one long line
|
vim.opt.wrap = false -- display lines as one long line
|
||||||
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program) it is not allowed to be edit
|
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program) it is not allowed to be edit
|
||||||
vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua")
|
vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua")
|
||||||
vim.opt_local.suffixesadd:prepend(".lua")
|
vim.opt_local.suffixesadd:prepend(".lua")
|
||||||
vim.opt_local.suffixesadd:prepend("init.lua")
|
vim.opt_local.suffixesadd:prepend("init.lua")
|
||||||
|
|||||||
@ -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,
|
javascript = js,
|
||||||
javascriptreact = js,
|
javascriptreact = js,
|
||||||
json = { "jq" },
|
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,
|
markdown = makrdown,
|
||||||
python = { "ruff_format", "ruff_fix", "ruff_organize_imports", "docformatter" },
|
python = { "ruff_format", "ruff_fix", "ruff_organize_imports", "docformatter" },
|
||||||
rest = { "kulala" },
|
rest = { "kulala" },
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
|
|
||||||
"Saecki/crates.nvim",
|
"Saecki/crates.nvim",
|
||||||
tag = "stable",
|
tag = "stable",
|
||||||
event = { "BufRead Cargo.toml" },
|
event = { "BufRead Cargo.toml" },
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
return {
|
return {
|
||||||
"barrett-ruth/http-codes.nvim",
|
"kristoferssolo/http-codes.nvim",
|
||||||
dependencies = { "folke/snacks.nvim" },
|
branch = "feature/snacks",
|
||||||
|
dependencies = "folke/snacks.nvim",
|
||||||
cmd = "HTTPCodes",
|
cmd = "HTTPCodes",
|
||||||
keys = { { "<leader>pdh", vim.cmd.HTTPCodes, desc = "HTTP" } },
|
keys = { { "<leader>pH", vim.cmd.HTTPCodes, desc = "HTTP" } },
|
||||||
config = true,
|
opts = {
|
||||||
|
use = "snacks",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,52 +2,84 @@ local function is_typst()
|
|||||||
return vim.bo.filetype == "typst"
|
return vim.bo.filetype == "typst"
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
"HakonHarnes/img-clip.nvim",
|
{
|
||||||
event = "VeryLazy",
|
"3rd/image.nvim",
|
||||||
keys = {
|
opts = {
|
||||||
{ "<leader>v", vim.cmd.PasteImage, desc = "Paste image from system clipboard" },
|
backend = "ueberzug",
|
||||||
},
|
processor = "magick_rock",
|
||||||
opts = {
|
scale_factor = 0.5,
|
||||||
default = {
|
integrations = {
|
||||||
dir_path = "assets/img",
|
neorg = {
|
||||||
extension = function()
|
clear_in_insert_mode = true,
|
||||||
if is_typst() then
|
only_render_image_at_cursor = true,
|
||||||
return "png"
|
only_render_image_at_cursor_mode = "popup",
|
||||||
else
|
},
|
||||||
return "webp"
|
typst = {
|
||||||
end
|
clear_in_insert_mode = true,
|
||||||
end,
|
only_render_image_at_cursor = true,
|
||||||
process_cmd = function()
|
only_render_image_at_cursor_mode = "popup",
|
||||||
if is_typst() then
|
},
|
||||||
return ""
|
markdown = {
|
||||||
else
|
clear_in_insert_mode = true,
|
||||||
return "convert - -quality 75 webp:-"
|
only_render_image_at_cursor = true,
|
||||||
end
|
only_render_image_at_cursor_mode = "popup",
|
||||||
end,
|
resolve_image_path = function(document_path, image_path, fallback)
|
||||||
file_name = "%Y-%m-%d_%H-%M-%S",
|
local working_dir = vim.fn.getcwd()
|
||||||
relative_to_current_file = false,
|
if working_dir:find("Obsidian") then
|
||||||
prompt_for_file_name = function()
|
return working_dir .. "/assets/img/" .. image_path
|
||||||
return is_typst()
|
end
|
||||||
end,
|
return fallback(document_path, image_path)
|
||||||
embed_image_as_base64 = false,
|
end,
|
||||||
drag_and_drop = {
|
},
|
||||||
insert_mode = true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
filetypes = {
|
},
|
||||||
markdown = {
|
{
|
||||||
template = "![[$FILE_PATH]]",
|
"HakonHarnes/img-clip.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
keys = {
|
||||||
|
{ "<leader>v", vim.cmd.PasteImage, desc = "Paste image from system clipboard" },
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
default = {
|
||||||
|
dir_path = "assets/img",
|
||||||
|
extension = function()
|
||||||
|
if is_typst() then
|
||||||
|
return "png"
|
||||||
|
else
|
||||||
|
return "webp"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
process_cmd = function()
|
||||||
|
if is_typst() then
|
||||||
|
return ""
|
||||||
|
else
|
||||||
|
return "convert - -quality 75 webp:-"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
file_name = "%Y-%m-%d_%H-%M-%S",
|
||||||
|
relative_to_current_file = false,
|
||||||
|
prompt_for_file_name = is_typst,
|
||||||
|
embed_image_as_base64 = false,
|
||||||
|
drag_and_drop = {
|
||||||
|
insert_mode = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
vimwiki = {
|
filetypes = {
|
||||||
template = "![[$FILE_PATH]]",
|
markdown = {
|
||||||
},
|
template = "![[$FILE_PATH]]",
|
||||||
typst = {
|
},
|
||||||
template = [[
|
vimwiki = {
|
||||||
|
template = "![[$FILE_PATH]]",
|
||||||
|
},
|
||||||
|
typst = {
|
||||||
|
template = [[
|
||||||
#figure(
|
#figure(
|
||||||
image("$FILE_PATH", width: 80%),
|
image("$FILE_PATH", width: 80%),
|
||||||
caption: [$CURSOR],
|
caption: [$CURSOR],
|
||||||
) <$LABEL>
|
) <$LABEL>
|
||||||
]],
|
]],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -66,7 +66,7 @@ return {
|
|||||||
vim.lsp.buf.hover({ border = "rounded" })
|
vim.lsp.buf.hover({ border = "rounded" })
|
||||||
end, "Hover Documentation")
|
end, "Hover Documentation")
|
||||||
nmap("gi", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
|
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" })
|
vim.lsp.buf.signature_help({ border = "rounded" })
|
||||||
end, { buffer = event.buf, desc = "LSP: Signature Documentation" })
|
end, { buffer = event.buf, desc = "LSP: Signature Documentation" })
|
||||||
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
|
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 })
|
vim.diagnostic.jump({ count = -1, float = true })
|
||||||
end, "Diagnostic Prev")
|
end, "Diagnostic Prev")
|
||||||
nmap("]d", function()
|
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")
|
end, "LSP: Trouble Next")
|
||||||
nmap("[d", function()
|
nmap("[d", function()
|
||||||
trouble.prev({ mode = "diagnostics", skip_groups = true, jump = true })
|
trouble.prev({ mode = "diagnostics", skip_groups = true, jump = true })
|
||||||
@ -99,7 +99,9 @@ return {
|
|||||||
nmap("gr", function()
|
nmap("gr", function()
|
||||||
trouble.toggle("lsp_references")
|
trouble.toggle("lsp_references")
|
||||||
end, "[G]oto [R]eferences")
|
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,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -194,38 +196,42 @@ return {
|
|||||||
lua_ls = {
|
lua_ls = {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
|
||||||
version = "LuaJIT",
|
|
||||||
},
|
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
globals = {
|
||||||
globals = { "vim", "awesome", "client", "ya" },
|
"vim",
|
||||||
},
|
"awesome",
|
||||||
-- workspace = {
|
"client",
|
||||||
-- Make the server aware of Neovim runtime files
|
"s",
|
||||||
-- library = vim.api.nvim_get_runtime_file("", true),
|
"sn",
|
||||||
-- },
|
"isn",
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
"t",
|
||||||
telemetry = {
|
"i",
|
||||||
enable = false,
|
"f",
|
||||||
},
|
"c",
|
||||||
root_pattern = {
|
"d",
|
||||||
".stylua.toml",
|
"r",
|
||||||
".luarc.json",
|
"events",
|
||||||
".luarc.jsonc",
|
"k",
|
||||||
".luacheckrc",
|
"ai",
|
||||||
"stylua.toml",
|
"extras",
|
||||||
"selene.toml",
|
"l",
|
||||||
"selene.yml",
|
"rep",
|
||||||
".git",
|
"p",
|
||||||
},
|
"m",
|
||||||
format = {
|
"n",
|
||||||
enable = false,
|
"dl",
|
||||||
},
|
"fmt",
|
||||||
hint = {
|
"fmta",
|
||||||
enable = true,
|
"conds",
|
||||||
|
"postfix",
|
||||||
|
"types",
|
||||||
|
"parse",
|
||||||
|
"ms",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
telemetry = { enable = false },
|
||||||
|
format = { enable = true },
|
||||||
|
hint = { enable = true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,20 +3,13 @@ return {
|
|||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
build = "make install_jsregexp",
|
build = "make install_jsregexp",
|
||||||
version = "v2.*",
|
version = "v2.*",
|
||||||
dependencies = {
|
dependencies = { "rafamadriz/friendly-snippets" },
|
||||||
"rafamadriz/friendly-snippets", -- a bunch of snippets to use
|
|
||||||
},
|
|
||||||
opts = function()
|
opts = function()
|
||||||
local types = require("luasnip.util.types")
|
local types = require("luasnip.util.types")
|
||||||
return {
|
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,
|
history = true,
|
||||||
-- This one is cool cause if you have dynamic snippets, it updates as you type!
|
|
||||||
updateevents = "TextChanged,TextChangedI",
|
updateevents = "TextChanged,TextChangedI",
|
||||||
-- Autosnippets:
|
|
||||||
enable_autosnippets = true,
|
enable_autosnippets = true,
|
||||||
-- Crazy highlights!!
|
|
||||||
ext_opts = {
|
ext_opts = {
|
||||||
[types.choiceNode] = {
|
[types.choiceNode] = {
|
||||||
active = {
|
active = {
|
||||||
@ -29,32 +22,6 @@ return {
|
|||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
local ls = require("luasnip")
|
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()
|
vim.keymap.set({ "i", "s" }, "<C-j>", function()
|
||||||
if ls.expand_or_jumpable() then
|
if ls.expand_or_jumpable() then
|
||||||
ls.expand_or_jump()
|
ls.expand_or_jump()
|
||||||
@ -83,15 +50,11 @@ return {
|
|||||||
|
|
||||||
require("luasnip.loaders.from_vscode").load({
|
require("luasnip.loaders.from_vscode").load({
|
||||||
exclude = {
|
exclude = {
|
||||||
"rust",
|
rust = { "modtest" },
|
||||||
rust = {
|
|
||||||
"modtest",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
vim.tbl_map(function(type)
|
|
||||||
require("luasnip.loaders.from_" .. type).lazy_load()
|
require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath("config") .. "/snippets/" })
|
||||||
end, { "vscode", "snipmate", "lua" })
|
|
||||||
|
|
||||||
ls.filetype_extend("typescript", { "tsdoc" })
|
ls.filetype_extend("typescript", { "tsdoc" })
|
||||||
ls.filetype_extend("javascript", { "jsdoc" })
|
ls.filetype_extend("javascript", { "jsdoc" })
|
||||||
|
|||||||
@ -31,7 +31,6 @@ return {
|
|||||||
desc = "Extract the visually selected text into a new note and link to it.",
|
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>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",
|
"<leader>Or",
|
||||||
vim.cmd.ObsidianRename,
|
vim.cmd.ObsidianRename,
|
||||||
|
|||||||
@ -18,7 +18,7 @@ return {
|
|||||||
bufdelete = { enabled = true },
|
bufdelete = { enabled = true },
|
||||||
dashboard = { enabled = false },
|
dashboard = { enabled = false },
|
||||||
debug = { enabled = true },
|
debug = { enabled = true },
|
||||||
dim = { enabled = true },
|
dim = { enabled = false },
|
||||||
explorer = { enabled = false },
|
explorer = { enabled = false },
|
||||||
git = { enabled = true },
|
git = { enabled = true },
|
||||||
gitbrowse = { enabled = true },
|
gitbrowse = { enabled = true },
|
||||||
@ -44,7 +44,7 @@ return {
|
|||||||
enabled = true,
|
enabled = true,
|
||||||
format = "file",
|
format = "file",
|
||||||
layout = {
|
layout = {
|
||||||
preset = "telescope"
|
preset = "telescope",
|
||||||
},
|
},
|
||||||
matcher = {
|
matcher = {
|
||||||
frecency = true,
|
frecency = true,
|
||||||
@ -57,10 +57,10 @@ return {
|
|||||||
keys = {
|
keys = {
|
||||||
["<C-t>"] = {
|
["<C-t>"] = {
|
||||||
"trouble_open",
|
"trouble_open",
|
||||||
mode = { "n", "i" }
|
mode = { "n", "i" },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
profiler = { enabled = false },
|
profiler = { enabled = false },
|
||||||
@ -116,20 +116,111 @@ return {
|
|||||||
desc = "Git Blame",
|
desc = "Git Blame",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<C-n>", function() Snacks.picker.files() end, desc = "Find Files" },
|
"<C-n>",
|
||||||
{ "<leader>pf", function() Snacks.picker.files() end, desc = "Find Files" },
|
function()
|
||||||
{ "<leader>ps", function() Snacks.picker.grep() end, desc = "Grep" },
|
Snacks.picker.files()
|
||||||
{ "<leader>pb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
end,
|
||||||
{ "<leader>pw", function() Snacks.picker.grep_word() end, desc = "Visual selection of word", mode = { "n", "x" } },
|
desc = "Find Files",
|
||||||
{ "<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>pf",
|
||||||
{ "<leader>pR", function() Snacks.picker.registers() end, desc = "Registers", },
|
function()
|
||||||
{ "<leader>pg", function() Snacks.picker.git_files() end, desc = "Find Git Fiels", },
|
Snacks.picker.files()
|
||||||
{ "<leader>pk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
end,
|
||||||
{ "<leader>pt", function() Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" },
|
desc = "Find Files",
|
||||||
{ "<leader>pc", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
|
},
|
||||||
{ "<leader>pl", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
|
{
|
||||||
|
"<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()
|
init = function()
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
|||||||
@ -1,69 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
"folke/todo-comments.nvim",
|
"folke/todo-comments.nvim",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
opts = {
|
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
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
local ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" }
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"pmizio/typescript-tools.nvim",
|
"pmizio/typescript-tools.nvim",
|
||||||
@ -5,7 +6,7 @@ return {
|
|||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
},
|
},
|
||||||
ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" },
|
ft = ft,
|
||||||
opts = {
|
opts = {
|
||||||
on_attach = function(client)
|
on_attach = function(client)
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
@ -33,7 +34,7 @@ return {
|
|||||||
-- memory limit in megabytes or "auto"(basically no limit)
|
-- memory limit in megabytes or "auto"(basically no limit)
|
||||||
tsserver_max_memory = "auto",
|
tsserver_max_memory = "auto",
|
||||||
-- described below
|
-- described below
|
||||||
tsserver_format_options = function(ft)
|
tsserver_format_options = function(_)
|
||||||
-- Return empty table to disable formatting
|
-- Return empty table to disable formatting
|
||||||
return {}
|
return {}
|
||||||
end,
|
end,
|
||||||
@ -72,13 +73,13 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dmmulroy/ts-error-translator.nvim",
|
"dmmulroy/ts-error-translator.nvim",
|
||||||
ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" },
|
ft = ft,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"folke/ts-comments.nvim",
|
"folke/ts-comments.nvim",
|
||||||
opts = {},
|
opts = {},
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
enabled = vim.fn.has("nvim-0.10.0") == 1,
|
enabled = vim.fn.has("nvim-0.10.0") == 1,
|
||||||
ft = { "javascriptreact", "typescriptreact", "javascript", "typescript" },
|
ft = ft,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,43 +18,5 @@ return {
|
|||||||
build = function()
|
build = function()
|
||||||
require("typst-preview").update()
|
require("typst-preview").update()
|
||||||
end,
|
end,
|
||||||
opts = {
|
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,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ std = "neovim"
|
|||||||
|
|
||||||
[rules]
|
[rules]
|
||||||
global_usage = "allow"
|
global_usage = "allow"
|
||||||
|
undefined_variable = "allow"
|
||||||
multiple_statements = "allow"
|
multiple_statements = "allow"
|
||||||
incorrect_standard_library_use = "allow"
|
incorrect_standard_library_use = "allow"
|
||||||
mixed_table = "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
|
---@diagnostic disable: undefined-global
|
||||||
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
|
|
||||||
|
|
||||||
local require_var = function(args, _)
|
local require_var = function(args, _)
|
||||||
local text = args[1][1] or ""
|
local text = args[1][1] or ""
|
||||||
@ -32,12 +14,12 @@ local require_var = function(args, _)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
ls.add_snippets("lua", {
|
return {
|
||||||
s(
|
s(
|
||||||
"lf",
|
"lf",
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
local {} = function({})
|
local function {}({})
|
||||||
{}
|
{}
|
||||||
end{}
|
end{}
|
||||||
]],
|
]],
|
||||||
@ -70,4 +52,4 @@ ls.add_snippets("lua", {
|
|||||||
i(1),
|
i(1),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
})
|
}
|
||||||
@ -1,13 +1,6 @@
|
|||||||
if not pcall(require, "luasnip") then
|
---@diagnostic disable: undefined-global
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ls = require("luasnip")
|
return {
|
||||||
local s = ls.snippet
|
|
||||||
local i = ls.insert_node
|
|
||||||
local fmt = require("luasnip.extras.fmt").fmt
|
|
||||||
|
|
||||||
ls.add_snippets("markdown", {
|
|
||||||
s(
|
s(
|
||||||
"ket",
|
"ket",
|
||||||
fmt(
|
fmt(
|
||||||
@ -47,4 +40,4 @@ ls.add_snippets("markdown", {
|
|||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
})
|
}
|
||||||
@ -1,15 +1,6 @@
|
|||||||
if not pcall(require, "luasnip") then
|
---@diagnostic disable: undefined-global
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ls = require("luasnip")
|
return {
|
||||||
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", {
|
|
||||||
s(
|
s(
|
||||||
"logger",
|
"logger",
|
||||||
fmt(
|
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ās
|
||||||
iekavām
|
iekavām
|
||||||
viennozīmīgu
|
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