change repo to be collection of all dotfiles installed with gnu stow

This commit is contained in:
2025-08-24 22:04:01 +02:00
parent 5d8f7f3dcd
commit 2c34515569
25 changed files with 0 additions and 0 deletions
+853
View File
@@ -0,0 +1,853 @@
-- vim:foldmethod=marker
local function get_python_venv_path() --{{{1
return vim.fn.stdpath('config') .. '/.venv/bin/python'
end
do
vim.g.python3_host_prog = get_python_venv_path()
end
-- GENERAL SETTINGS {{{1
vim.cmd [[
set exrc
set secure
set clipboard=unnamedplus
set tabstop=4
set shiftwidth=0
set rnu
set nu
set nowrap
set shiftround
set expandtab
set nohlsearch
set incsearch
set guicursor=n-v-c:block-Cursor
nnoremap ,co :copen<CR>
nnoremap ,cc :cclose<CR>
nnoremap ,cq :call setqflist([])<CR>:cclose<CR>
nnoremap ,ct :call setqflist([{'filename': expand('%'), 'lnum': line('.'), 'col': col('.'), 'text': 'TODO'}], 'a')<CR>
nnoremap ,cf :cfirst<CR>
nnoremap ,cl :clast<CR>
nnoremap <c-n> :cnext<CR>zz
nnoremap <c-p> :cprevious<CR>zz
nnoremap ,cu :colder<CR>
nnoremap ,cr :cnewer<CR>
nnoremap ,h H
nnoremap ,l L
nnoremap H ^
nnoremap L $
xnoremap H ^
xnoremap L $
nnoremap ,cD :call setqflist(filter(getqflist(), 'v:val != getqflist()[getqflist({"idx": 0}).idx - 1]'))<CR>
nnoremap ,t <c-w>v<c-w>l:terminal<CR>a
" Don't include curdir, it just causes pain.
set viewoptions=folds,cursor
autocmd BufWinLeave *.* silent! mkview
autocmd BufWinEnter *.* silent! loadview
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
nnoremap <c-d> <c-d>zz
nnoremap <c-u> <c-u>zz
tnoremap <c-w>c <c-\><c-n><c-w>c
autocmd TextYankPost * silent! lua vim.highlight.on_yank {higroup='Visual', timeout=100}
autocmd BufEnter *__virtual* setlocal buftype=nofile bufhidden=hide noswapfile
let g:rustfmt_autosave = 0
" remove annoying and bad indentation
autocmd FileType * setlocal indentexpr=
set wildignore=*.o,*.obj,.git/**,tags,*.pyc
]]
vim.api.nvim_create_autocmd({
'BufRead',
'BufNewFile'
}, {
pattern = {'*.h'},
callback = function()
vim.bo.filetype = 'c'
end
})
local function has_makefile()
local dir = io.popen('ls')
if not dir then return false end
for file in dir:lines() do
if file:lower() == 'makefile' then
dir:close()
return true
end
end
dir:close()
return false
end
-- set makeprg
vim.api.nvim_create_autocmd('BufEnter', {
callback = function()
do
local line = vim.api.nvim_buf_get_lines(0, 0, 1, false)[1]
if line then
local first_two = line:sub(1, 2)
if first_two == '#!' then
vim.bo.makeprg = './%'
return
end
end
end
if vim.bo.filetype == 'go' then
vim.bo.makeprg = 'go'
return
end
if vim.bo.filetype == 'c' then
if not has_makefile() then
vim.bo.makeprg = 'tcc -run %'
end
end
end,
})
-- LAZY.NVIM BOOTSTRAP {{{1
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require'lazy'.setup{ --{{{1
{ 'stevearc/oil.nvim', --{{{2
---@module 'oil'
---@type oil.SetupOpts
opts = {},
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
lazy = false,
config = function ()
require('oil').setup({
default_file_explorer = true,
columns = {
'icon',
'permissions',
'size',
'mtime',
},
buf_options = {
buflisted = false,
bufhidden = 'hide',
},
win_options = {
wrap = false,
signcolumn = 'no',
cursorcolumn = false,
foldcolumn = '0',
spell = false,
list = false,
conceallevel = 3,
concealcursor = 'nvic',
},
delete_to_trash = false,
skip_confirm_for_simple_edits = false,
prompt_save_on_select_new_entry = true,
cleanup_delay_ms = 2000,
lsp_file_methods = {
enabled = true,
timeout_ms = 1000,
autosave_changes = false,
},
constrain_cursor = 'editable',
watch_for_changes = false,
keymaps = {
['g?'] = { 'actions.show_help', mode = 'n' },
['<CR>'] = 'actions.select',
['<C-j>'] = 'actions.select',
['<C-s>'] = { 'actions.select', opts = { vertical = true } },
['<C-h>'] = { 'actions.select', opts = { horizontal = true } },
['<C-t>'] = { 'actions.select', opts = { tab = true } },
['<C-p>'] = 'actions.preview',
['<C-c>'] = { 'actions.close', mode = 'n' },
['<C-l>'] = 'actions.refresh',
['-'] = { 'actions.parent', mode = 'n' },
['_'] = { 'actions.open_cwd', mode = 'n' },
[',cd'] = { 'actions.cd', mode = 'n' },
[',CD'] = { 'actions.cd', opts = { scope = 'tab' }, mode = 'n' },
['gs'] = { 'actions.change_sort', mode = 'n' },
['gx'] = 'actions.open_external',
['g.'] = { 'actions.toggle_hidden', mode = 'n' },
['g\\'] = { 'actions.toggle_trash', mode = 'n' },
},
use_default_keymaps = true,
view_options = {
show_hidden = true,
is_hidden_file = function(name, _)
local m = name:match('^%.')
return m ~= nil
end,
is_always_hidden = function(_, _)
return false
end,
natural_order = 'fast',
case_insensitive = false,
sort = {
{ 'type', 'asc' },
{ 'name', 'asc' },
},
highlight_filename = function(_, _, _, _)
return nil
end,
},
extra_scp_args = {},
float = {
padding = 2,
max_width = 0,
max_height = 0,
border = 'rounded',
win_options = {
winblend = 0,
},
get_win_title = nil,
preview_split = 'auto',
override = function(conf)
return conf
end,
},
preview_win = {
update_on_cursor_moved = true,
preview_method = 'fast_scratch',
disable_preview = function(_)
return false
end,
win_options = {},
},
confirmation = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = 0.9,
min_height = { 5, 0.1 },
height = nil,
border = 'rounded',
win_options = {
winblend = 0,
},
},
progress = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = { 10, 0.9 },
min_height = { 5, 0.1 },
height = nil,
border = 'rounded',
minimized_border = 'none',
win_options = {
winblend = 0,
},
},
ssh = {
border = 'rounded',
},
keymaps_help = {
border = 'rounded',
},
})
-- oil fix relative path
vim.api.nvim_create_augroup('OilRelPathFix', {})
vim.api.nvim_create_autocmd('BufLeave', {
group = 'OilRelPathFix',
pattern = 'oil:///*',
callback = function ()
vim.cmd('cd .')
end
})
local actions = require('oil.actions')
vim.keymap.set('n', '-', actions.parent.callback, { desc = actions.parent.desc })
vim.keymap.set('n', '_', actions.open_cwd.callback, { desc = actions.open_cwd.desc })
end
},
{ 'github/copilot.vim', --{{{2
config = function()
-- q for qomplete ;)
vim.keymap.set('i', '<c-q>', 'copilot#Accept("\\<CR>")', {
expr = true,
replace_keycodes = false,
})
vim.g.copilot_no_tab_map = true
vim.keymap.set('n', '<c-q>', ':Copilot panel<CR>', { noremap = true })
vim.keymap.set('n', ',cd', ':Copilot disable<CR>', { noremap = true })
vim.keymap.set('n', ',ce', ':Copilot disable<CR>', { noremap = true })
end,
},
{ 'rafaelsq/nvim-goc.lua', --{{{2
config = function ()
local goc = require'nvim-goc'
goc.setup{}
---@param name string
local cmd = function(name)
vim.api.nvim_create_user_command(
'Go'..name,
'lua require"nvim-goc".'..name..'()',
{ nargs = 0 }
)
end
cmd('Coverage')
cmd('CoverageFunc')
cmd('ClearCoverage')
end,
},
{ 'f-person/git-blame.nvim', --{{{2
keys = {',a'},
config = function ()
require'gitblame'.setup{
enabled = false,
}
vim.cmd[[
nnoremap ,a :GitBlameToggle<CR>
]]
end
},
{ 'unblevable/quick-scope', --{{{2
init = function()
vim.cmd [[
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
]]
end,
},
{ 'michaeljsmith/vim-indent-object', --{{{2
},
{ 'kylechui/nvim-surround', --{{{2
version = '*', -- Use for stability; omit to use `main` branch for the latest features
event = 'VeryLazy',
config = function()
require('nvim-surround').setup{}
end
},
{ 'echasnovski/mini.align', --{{{2
version = false,
config = function()
require'mini.align'.setup()
end,
},
{ 'sainnhe/everforest', --{{{2
lazy = false,
priority = 1000,
config = function()
vim.o.termguicolors = true
vim.g.everforest_enable_italic = true
vim.cmd.colorscheme('everforest')
end,
},
{ 'roodletoof/zen-mode.nvim', --{{{2
keys = {',z'},
config = function ()
local zen_mode = require'zen-mode'
zen_mode.setup{}
vim.keymap.set(
'n',
',z',
function()
vim.cmd'silent! mkview'
zen_mode.toggle{
window = {
width = 80,
options = {
signcolumn = 'no',
cursorline = false,
cursorcolumn = false,
foldcolumn = '0',
list = false,
}
},
}
vim.cmd'silent! loadview'
end,
{ silent = true }
)
end
},
{ 'seblyng/roslyn.nvim', --{{{2
--WARN: requires html-lsp, roslyn and rzls installed via Mason
dependencies = {
'tris203/rzls.nvim',
config = true,
},
ft = {'cs', 'razor'},
config = function()
local _ = require('mason-registry') -- TODO, do I even need this line?
local rzls_path = vim.fn.expand('$MASON/packages/rzls/libexec')
local cmd = {
'roslyn',
'--stdio',
'--logLevel=Information',
'--extensionLogDirectory=' .. vim.fs.dirname(vim.lsp.get_log_path()),
'--razorSourceGenerator=' .. vim.fs.joinpath(rzls_path, 'Microsoft.CodeAnalysis.Razor.Compiler.dll'),
'--razorDesignTimePath=' .. vim.fs.joinpath(rzls_path, 'Targets', 'Microsoft.NET.Sdk.Razor.DesignTime.targets'),
'--extension',
vim.fs.joinpath(rzls_path, 'RazorExtension', 'Microsoft.VisualStudioCode.RazorExtension.dll'),
}
---@diagnostic disable-next-line: missing-fields
require'rzls'.setup{} -- the missing-fields waring is bullshit. the fields are actually optional
require'roslyn'.setup{
cmd = cmd,
config = {
handlers = require 'rzls.roslyn_handlers',
['csharp|code_lens'] = {
dotnet_enable_references_code_lens = true,
}
},
}
end,
init = function()
vim.filetype.add{
extension = {
razor = 'razor',
cshtml = 'razor'
}
}
end,
},
{ 'folke/lazydev.nvim', --{{{2
ft = 'lua', -- only load on lua files
opts = {
library = {
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
{ path = '${3rd}/love2d/library', words = { 'love' } },
},
},
},
{ 'neovim/nvim-lspconfig', --{{{2
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
},
config = function()
require'mason'.setup{
registries = {
'github:mason-org/mason-registry',
'github:crashdummyy/mason-registry',
},
}
require'mason-lspconfig'.setup()
vim.lsp.config.zls = {
before_init = function(_, _)
vim.g.zig_fmt_autosave = false -- may not be needed anymore?
end,
}
vim.lsp.config.lua_ls = {
settings = {
Lua = { runtime = { version = 'LuaJIT' } }
}
}
vim.lsp.config.gopls = {
filetypes = { -- unsure if this is entirely correct...
'go',
'gomod',
'gowork',
'gotmpl',
'html'
},
settings = {
gopls = {
templateExtensions = {'html', 'gotmpl'}
}
}
}
vim.lsp.config.basedpyright = {
settings = {
basedpyright = {
analysis = {
diagnosticMode = 'workspace',
},
},
},
}
vim.lsp.enable('gdscript')
vim.lsp.config('hls', {
filetypes = { 'haskell', 'lhaskell', 'cabal' },
})
vim.lsp.enable('hls')
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
vim.bo[args.buf].tagfunc = nil
end,
})
local function jump_to_definition()
local word = vim.fn.expand('<cword>')
vim.cmd('tag ' .. word)
end
vim.keymap.set( 'n', ',fc', jump_to_definition, { noremap = true, silent = true})
vim.keymap.set( 'n', ',fd', vim.lsp.buf.definition, { noremap = true, silent = true})
vim.cmd [[
noremap ,rn :lua vim.lsp.buf.rename()<CR>
noremap ,ft :lua vim.lsp.buf.type_definition()<CR>
noremap ,fr :lua vim.lsp.buf.references()<CR>
noremap ,ca :lua vim.lsp.buf.code_action()<CR>
noremap ,oe :lua vim.diagnostic.open_float()<CR>
noremap ,ea :lua vim.diagnostic.setqflist()<CR>
noremap ,ee :lua vim.diagnostic.setqflist{severity='ERROR'}<CR>
noremap ,ew :lua vim.diagnostic.setqflist{severity='WARN'}<CR>
noremap ,ei :lua vim.diagnostic.setqflist{severity='INFO'}<CR>
noremap ,eh :lua vim.diagnostic.setqflist{severity='HINT'}<CR>
]]
end
},
{ 'nvim-treesitter/nvim-treesitter', --{{{2
config = function()
require'nvim-treesitter.configs'.setup{
modules = {},
ensure_installed = {},
ignore_install = {},
parser_install_dir = nil,
sync_install = false,
auto_install = true,
indent = {
enable = true,
},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
end,
},
{ 'kdheepak/lazygit.nvim', --{{{2
lazy = true,
cmd = { 'LazyGit', 'LazyGitConfig', 'LazyGitCurrentFile', 'LazyGitFilter', 'LazyGitFilterCurrentFile', },
dependencies = { 'nvim-lua/plenary.nvim', },
keys = { { ',g', '<cmd>LazyGit<cr>', desc = 'LazyGit' }, },
},
{ 'mfussenegger/nvim-dap', --{{{2
dependencies = {
'nvim-treesitter/nvim-treesitter',
'theHamsta/nvim-dap-virtual-text',
'leoluz/nvim-dap-go',
'mfussenegger/nvim-dap-python',
},
keys = {',b', ',db', ',B', '<B'},
config = function()
require'nvim-dap-virtual-text'.setup{ commented = true, }
require'dap-go'.setup()
require'dap-python'.setup(get_python_venv_path())
local dap = require'dap'
dap.adapters.godot = { type = 'server', host = '127.0.0.1', port = 6006, }
dap.configurations.gdscript = { {type = 'godot', request = 'launch', name = 'Launch scene', project = '${workspaceFolder}',} }
dap.adapters.lldb = {
type = 'executable',
command = vim.fn.exepath('lldb-dap'),
name = 'lldb'
}
dap.configurations.c = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = function()
local i = vim.fn.input('input args: ')
return vim.fn.split(i)
end,
runInTerminal = true,
},
}
dap.configurations.cpp = dap.configurations.c
dap.configurations.rust = dap.configurations.c
vim.cmd [[
nnoremap ,b :DapToggleBreakpoint<CR>
nnoremap ,B :DapClearBreakpoints<CR>
nnoremap <B :DapClearBreakpoints<CR>
nnoremap ,db :DapContinue<CR>
nnoremap <Down> :DapStepInto<CR>
nnoremap <UP> :DapStepOut<CR>
nnoremap <Right> :DapStepOver<CR>
]]
end
},
{ 'dcampos/nvim-snippy', --{{{2
config = function()
require'snippy'.setup{ enable_auto = true, }
vim.cmd [[
imap <expr> <c-l> '<Plug>(snippy-next)'
imap <expr> <c-k> '<Plug>(snippy-previous)'
smap <expr> <c-l> '<Plug>(snippy-next)'
smap <expr> <c-k> '<Plug>(snippy-previous)'
nmap g; <Plug>(snippy-cut-text)
xmap g; <Plug>(snippy-cut-text)
]]
end
},
{ 'hrsh7th/nvim-cmp', --{{{2
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
'dcampos/nvim-snippy',
'dcampos/cmp-snippy',
'quangnguyen30192/cmp-nvim-tags',
},
config = function()
local cmp = require'cmp'
cmp.setup{
snippet = {
expand = function(args)
require'snippy'.expand_snippet(args.body)
end,
},
mapping = {
['<C-y>'] = cmp.mapping.confirm{ select = true },
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
},
sources = cmp.config.sources(
{
{ name = 'snippy', priority = 100000000000000000000 },
{ name = 'nvim_lsp', priority = 1000000000},
{ name = 'tags', priority = 100 },
{ name = 'path', priority = 1},
}
),
preselect = cmp.PreselectMode.None,
}
end,
},
{ 'nvim-telescope/telescope.nvim', --{{{2
tag = '0.1.8',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-ui-select.nvim',
},
config = function()
local a = require'telescope.actions'
require'telescope'.setup{
defaults = {
file_ignore_patterns = {'%__virtual.cs$'},
mappings = {
i = { ['<C-Q>'] = a.smart_send_to_qflist + a.open_qflist, ['<C-j>'] = a.select_default, },
n = { ['<C-Q>'] = a.smart_send_to_qflist + a.open_qflist, ['<C-j>'] = a.select_default, },
}
},
extensions = { ['ui-select'] = { require'telescope.themes'.get_dropdown{}, }, },
}
vim.cmd [[
noremap ,fa :lua require'telescope.builtin'.find_files({hidden=true, no_ignore=true, no_ignore_parent=true})<CR>
noremap ,ff :lua require'telescope.builtin'.find_files()<CR>
noremap ,fo :lua require'telescope.builtin'.oldfiles()<CR>
noremap ,fg :lua require'telescope.builtin'.live_grep()<CR>
noremap ,fs :lua require'telescope.builtin'.grep_string()<CR>
noremap ,fz :lua require'telescope.builtin'.current_buffer_fuzzy_find()<CR>
noremap ,fh :lua require'telescope.builtin'.help_tags()<CR>
noremap ,fm :lua require'telescope.builtin'.marks()<CR>
noremap ,fb :lua require'telescope.builtin'.buffers()<CR>
noremap ,fea :lua require'telescope.builtin'.diagnostics()<CR>
noremap ,fee :lua require'telescope.builtin'.diagnostics{severity='ERROR'}<CR>
noremap ,few :lua require'telescope.builtin'.diagnostics{severity='WARN'}<CR>
noremap ,fei :lua require'telescope.builtin'.diagnostics{severity='INFO'}<CR>
noremap ,feh :lua require'telescope.builtin'.diagnostics{severity='HINT'}<CR>
]]
require'telescope'.load_extension'ui-select'
end,
},
}
do -- split line {{{1
local SPLIT_DELIMETERS = { -- single characters only
[','] = true,
[';'] = true,
['|'] = true,
}
local SPLIT_BETWEEN = { -- single characters only
['('] = ')',
['['] = ']',
['{'] = '}',
['<'] = '>',
}
local SPLIT_IGNORE_BETWEEN = { --single characters only
['"'] = '"',
["'"] = "'",
}
local split_line = function()
local SPLIT_WHITESPACE = ' '
if vim.o.expandtab then
SPLIT_WHITESPACE = ''
for _ = 1, vim.o.tabstop do
SPLIT_WHITESPACE = SPLIT_WHITESPACE .. ' '
end
end
local line = vim.api.nvim_get_current_line()
local _, col = unpack(vim.api.nvim_win_get_cursor(0))
col = col + 1 -- Doing this to make it 1-indexed
---@type integer?
local first_bracket_i = nil
for i = col, #line do
local char = line:sub(i, i)
if SPLIT_BETWEEN[char] ~= nil then
first_bracket_i = i
break
end
end
if not first_bracket_i then
print('No opening brackets found after cursor on this line.')
return
end
---@type integer[]
local split_indexes = {} -- Populate this array
---@type integer?
local last_bracket_i = nil -- And find this index
do
---@type string[]
local closing_bracket_stack = {}
local icon_to_close_ignore = ''
local in_ignore = false
for i = first_bracket_i, #line do
local char = line:sub(i,i)
if in_ignore then
in_ignore = not (char == icon_to_close_ignore)
goto continue
end
if SPLIT_IGNORE_BETWEEN[char] ~= nil then
icon_to_close_ignore = SPLIT_IGNORE_BETWEEN[char]
in_ignore = true
goto continue
end
-- string handling complete
if SPLIT_BETWEEN[char] ~= nil then
table.insert(
closing_bracket_stack,
SPLIT_BETWEEN[char]
)
end
if char == closing_bracket_stack[#closing_bracket_stack] then
table.remove(closing_bracket_stack)
end
if #closing_bracket_stack == 1 and SPLIT_DELIMETERS[char] then
table.insert(split_indexes, i)
end
if #closing_bracket_stack == 0 then
last_bracket_i = i
break
end
::continue::
end
end
if not last_bracket_i then
print('The first opening bracket found after the cursor was not closed on this line.')
return
end
---@type string
local leading_whitespace = string.match(line, '^%s*')
local first_line = line:sub(1, first_bracket_i)
local last_line = leading_whitespace .. line:sub(last_bracket_i, #line)
if #split_indexes == 0 then
if (last_bracket_i - first_bracket_i == 1) then return end
local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
line = line:sub(first_bracket_i+1, last_bracket_i-1)
local leading_pattern = '^[%s'
for k, _ in pairs(SPLIT_DELIMETERS) do
leading_pattern = leading_pattern .. k
end
leading_pattern = leading_pattern .. ']*'
line = line:gsub(leading_pattern, leading_whitespace .. SPLIT_WHITESPACE, 1)
line = line:gsub('[%s]*$', '', 1)
vim.api.nvim_buf_set_lines(0, row-1, row, false, {first_line})
vim.api.nvim_buf_set_lines(0, row, row, false, {last_line})
vim.api.nvim_buf_set_lines(0, row, row, false, {line})
return
end
local middle_lines = {}
table.insert(
middle_lines,
line:sub(first_bracket_i+1, split_indexes[1])
)
for i = 1, #split_indexes-1 do
table.insert(
middle_lines,
line:sub(split_indexes[i], split_indexes[i+1])
)
end
table.insert(
middle_lines,
line:sub(split_indexes[#split_indexes], last_bracket_i-1)
)
local leading_pattern = '^[%s'
for k, _ in pairs(SPLIT_DELIMETERS) do
leading_pattern = leading_pattern .. k
end
leading_pattern = leading_pattern .. ']*'
-- Cleanup step
for i, middle_line in ipairs(middle_lines) do
middle_line = middle_line:gsub(leading_pattern, leading_whitespace .. SPLIT_WHITESPACE, 1)
middle_line = middle_line:gsub('[%s]*$', '', 1)
middle_lines[i] = middle_line
end
if middle_lines[#middle_lines]:match('^%s*$') ~= nil then
table.remove(middle_lines)
end
local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
vim.api.nvim_buf_set_lines(0, row-1, row, false, {first_line})
vim.api.nvim_buf_set_lines(0, row, row, false, {last_line})
vim.api.nvim_buf_set_lines(0, row, row, false, middle_lines)
end
vim.keymap.set(
'n',
',s',
split_line,
{ silent = true }
)
end
+1
View File
@@ -0,0 +1 @@
debugpy==1.8.12
+432
View File
@@ -0,0 +1,432 @@
snippet taggedUnion
#define ${1/.*/\U\0/g}_FIELDS \
X(${0:foo})
#define X(NAME, ...) ${1:union}_type_##NAME,
typedef enum ${1:union}_type {
${1/.*/\U\0/g}_FIELDS
count_${1:union}_type_t
} ${1:union}_type_t;
#undef X
#define X(NAME, ...) typedef struct NAME {__VA_ARGS__} NAME##_t;
${1/.*/\U\0/g}_FIELDS
#undef X
#define X(NAME, ...) NAME##_t NAME;
typedef struct ${1:union} {
${1:union}_type_t type;
union {
${1/.*/\U\0/g}_FIELDS
};
} ${1:union}_t;
#undef X
#define X(NAME, ...) static inline ${1:union}_t ${1:union}_of_##NAME(NAME##_t NAME) { \
${1:union}_t ${1:union} = (${1:union}_t){}; \
${1:union}.type = ${1:union}_type_##NAME; \
${1:union}.NAME = NAME; \
return ${1:union}; \
}
${1/.*/\U\0/g}_FIELDS
#undef X
snippet tccRaylib
#!/bin/tcc -run -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
snippet ,fl "" Ai
, __FILE__, __LINE__
snippet scriptgcc
#if 0
SCRIPT_NAME=$(echo "$0" | tr '/' '_' | tr '.' '_').o
EXEC=/tmp/$SCRIPT_NAME
if [ ! -x "$EXEC" ] || [ "$0" -nt "$EXEC" ]; then
gcc "$0" -o "$EXEC"
fi
exec "$EXEC"
#endif
snippet func
${1:void} ${2:foo}( ${3:void} ) {
${0:fprintf(stderr, __FILE__ ":%d: todo!", __LINE__); exit(1);}
}
snippet region
WITH_MEMORY_REGION(${1:region}) { // Don't return memory owned by ${1:region}.
${0:$VISUAL}
} while (0);
snippet regionDef
#include <stdio.h>
#include <stdlib.h>
typedef struct AllocationHeader {
struct AllocationHeader *next;
union {
long double _only_;
long long _for_;
void *_alignment_;
} data[];
} AllocationHeader;
typedef AllocationHeader* MemoryRegion;
void *MemoryRegionMalloc(MemoryRegion *region, size_t size, char *file, size_t line) {
AllocationHeader *bytes = malloc(sizeof(AllocationHeader) + size);
if (bytes == NULL) {
fprintf(stderr, "%s:%zu: unable to allocate %zu bytes\n", file, line, size);
exit(1);
}
bytes->next = *region;
*region = bytes;
printf("allocated %zu bytes at %p\n", size, bytes);
return &bytes->data;
}
#define MemoryRegionMalloc(region, size) MemoryRegionMalloc(region, size, __FILE__, __LINE__)
void MemoryRegionFree(MemoryRegion *region) {
AllocationHeader *curr = *region;
while (curr != NULL) {
AllocationHeader *next = curr->next;
free(curr);
printf("freed %p\n", curr);
curr = next;
}
*region = NULL;
}
#define WITH_MEMORY_REGION(NAME) for (MemoryRegion NAME = NULL; !NAME; NAME = (MemoryRegionFree(&NAME), (MemoryRegion) 1)) do
snippet scopeMalloc
{
${1:int} *${2:var} = malloc(${3:size});
if (${2:var} == NULL) {
${4:fprintf(stderr, "%s:%d: malloc returned NULL!\\n", __FILE__, __LINE__); exit(1);}
}
// working area ////////////////////////////////////////////////////////////////
$0
////////////////////////////////////////////////////////////////////////////////
free(${2:var});
}
snippet defer
${1:initialize}; {
$0
} ${2:deinitialize};
snippet camera
void camera_update(Camera2D *camera) {
float wheel = GetMouseWheelMove();
if (wheel != 0.0f) {
Vector2 mouseWorldPos = GetScreenToWorld2D(GetMousePosition(), *camera);
camera->offset = GetMousePosition();
camera->target = mouseWorldPos;
float scale_factor = 1.0f + (0.25f*fabsf(wheel));
if (wheel < 0) scale_factor = 1.0f/scale_factor;
camera->zoom = Clamp(camera->zoom*scale_factor, 0.125f, 64.0f);
}
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
Vector2 delta = GetMouseDelta();
delta = Vector2Scale(delta, -1.0f/camera->zoom);
camera->target = Vector2Add(camera->target, delta);
}
}
#define camera_new ((Camera2D) { .zoom = 1.0f, .target = (Vector2) {0.0f, 0.0f}, .offset = (Vector2) {0.0f, 0.0f}, .rotation = 0.0f })
snippet tenum
typedef enum ${1:name} {
$0
count_${1:name}_t
} ${1:name}_t;
snippet aunion
union {
$0
};
snippet astruct
struct {
$0
};
snippet tunion
typedef union ${1:name} {
$0
} ${1:name}_t;
snippet tstruct
typedef struct ${1:name} {
$0
} ${1:name}_t;
snippet class
typedef struct ${1:name} {
$0
} ${1:name};
snippet printf
printf("$1\n"$2);
snippet ,,n "" Ai
\n
snippet foreacharr
for (${1:type} *${2:item} = ${3:array}; ${2:item} < &${3:array}[${4:size}]; ${2:item}++) {
$0
}
snippet flags
#include <_static_assert.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#define FLAGS \
X(SOLID) \
X(DAMAGING) \
X(WATER) \
X(ENEMY)
typedef enum ordinal_flags {
#define X(name) ORDINAL_FLAG_##name,
FLAGS
#undef X
count_ordinal_flags
} ordinal_flags_t;
static_assert(count_ordinal_flags <= 64, "Too many flags!");
typedef enum flag : uint64_t{
#define X(name) FLAG_##name = ((uint64_t)1) << ORDINAL_FLAG_##name,
FLAGS
#undef X
} flag_t;
void flag_print(flag_t f) {
printf("FLAGS: { ");
#define X(name) if (f & FLAG_##name) printf(#name" ");
FLAGS
#undef X
printf("}\n");
}
flag_t flag_parse(char *str) {
flag_t f = 0;
#define X(name) if (strstr(str, " "#name" ")) f |= FLAG_##name;
FLAGS
#undef X
return f;
}
snippet test
#include <stdbool.h>
#include <stdio.h>
int tests_total = 0;
int tests_passed = 0;
typedef enum {Success, Failure} Result;
Result assert(bool condition, char *condition_text, char *file, int line) {
tests_total++;
Result result;
if (condition) {
tests_passed++;
result = Success;
} else {
printf("%s:%d: error: Assertion failed: %s\n", file, line, condition_text);
result = Failure;
}
fflush(stdout);
return result;
}
#define assert(condition) assert(condition, #condition, __FILE__, __LINE__)
int main(int arg_count, char *args[]) {
{ // TEST HERE
$0
}
if (tests_total == tests_passed) {
return 0;
} else {
return tests_total - tests_passed;
}
}
snippet unpackRect
$1.x, $1.y, $1.width, $1.height
snippet unpackRectInt
((int) $1.x), ((int) $1.y), ((int) $1.width), ((int) $1.height)
snippet rect
(Rectangle) {$1}
snippet forxy
for ( int y = 0; y < ${1:HEIGHT}; y++ ) {
for ( int x = 0; x < ${2:WIDTH}; x++ ) {
$0
}
}
snippet constAssign
*((${1:int} *) &${2:const}) = ${3:val};
snippet colorToVec4
Vector4 ${1:color}_v = (Vector4) {
.x = (float) ${1:color}.r,
.y = (float) ${1:color}.g,
.z = (float) ${1:color}.b,
.w = (float) ${1:color}.a
};
snippet cast
(($1) ${2:$VISUAL})
snippet appendDefine
#define append(arr, val, size, capacity) \
do { \
assert(size < capacity); \
arr[size] = val; \
size++; \
} while (0)
snippet popDefine
#define pop(recipient, arr, size) \
do { \
assert(0 < size); \
size--; \
recipient = arr[size]; \
} while (0)
snippet pop
assert(0 < ${3:size});
${3:size}--;
${2:recipient} = ${1:$VISUAL}[${3:size}];
snippet append
${1:arr}[${3:size}++] = ${2:value};
snippet )
( $1 )
snippet ]
[ $1 ]
snippet }
{ $1 }
snippet (
(
$1
)
snippet [
[
$1
]
snippet {
{
$1
}
snippet main
int main( int arg_count, char *args[] ) {
$0
return 0;
}
snippet fori
for ( ${1:size_t} ${2:i} = ${3:0}; ${2:i} < ${4:count}; ${2:i}++ ) {
$0
}
snippet do
do {
$0
\} while ( ${1:1} );
snippet while
while ( ${1:1} ) {
$0
}
snippet if
if ( $1 ) {
$0
}
snippet includeGuard
#ifndef $1
#define $1
$0
#endif /* $1 */
snippet singleHeaderLib
#ifndef $1_HEADER
#define $1_HEADER
$0
#ifdef $1_IMPL
#endif /* $1_IMPL */
#endif /* $1_HEADER */
snippet withDrawing
BeginDrawing();
$0
EndDrawing();
snippet withBlendMode
BeginBlendMode(${1:int mode});
$0
EndBlendMode();
snippet withMode2D
BeginMode2D(${1:Camera2D camera});
$0
EndMode2D();
snippet withMode3D
BeginMode3D(${1:Camera3D camera});
$0
EndMode3D();
snippet withShaderMode
BeginShaderMode(${1:Shader shader});
$0
EndShaderMode();
snippet withTextureMode
BeginTextureMode(${1:RenderTexture2D target});
$0
EndTextureMode();
snippet withVrStereoMode
BeginVrStereoMode(${1:VrStereoConfig config});
$0
EndVrStereoMode();
snippet withScissorMode
BeginScissorMode(${1:int x}, ${2:int y}, ${3:int width}, ${4:int height});
$0
EndScissorMode();
snippet gear
[GID_${1:TYPE}_${2:IDENTIFIER}] = {
.name = "${3:In game name}",
.texture_path = "assets/player/${4:path/to/image}.png",
.type = GEAR_${1:TYPE},
.rating = ${5:dmg / armor}
},
snippet escape
$1 \
snippet X
X( $1 )
snippet Xdef
#define X($1) $2
$0
#undef X
snippet todo
_Static_assert(false, "TODO");
+7
View File
@@ -0,0 +1,7 @@
snippet guard "Include guards"
#ifndef ${1:MY_HEADER_NAME_GOES_HERE_H}
#define ${1:MY_HEADER_NAME_GOES_HERE_H}
${0:...}
#endif /* ${1:MY_HEADER_NAME_GOES_HERE_H} */
+10
View File
@@ -0,0 +1,10 @@
snippet ,,n "" Ai
\n
snippet summary
/// <summary>
/// $1
/// </summary>$0
snippet param
/// <param name="$1">$2</param>$0
+116
View File
@@ -0,0 +1,116 @@
snippet tryget
if ${2:val}, ok := $1; ok {
$0
}
snippet dontimes
for range $1 {
$0
}
snippet handlefunc
router.HandleFunc("$1", func( w http.ResponseWriter, r *http.Request,) {
$0
})
snippet !! "" Ai
!=
snippet :: "" Ai
:=
snippet ,,n "" Ai
\n
snippet <<< "" Ai
<-
snippet ts
type $1 struct {
$0
}
snippet main
package main
func main() {
$0
}
snippet gofunc
go func() {
$0
}()
snippet afunc
func($1) $2 {
$0
}
snippet func
func ${1:foo}($2) $3 {
$0
}
snippet meth
func (${1:rec}) ${2:foo}($3) $4 {
$0
}
snippet err
if err != nil { return err }$0
snippet {
{
$1
}$0
snippet [
[
$1
]$0
snippet (
(
$1
)$0
snippet }
{ $1 }$0
snippet ]
[ $1 ]$0
snippet )
( $1 )$0
snippet fori
for ${1:i} := ${2:0}; ${1:i} < ${3:upper}; ${1:i}++ {
$0
}
snippet retSeq1
return func(yield func(${1:V}) bool) {
for /*TODO*/ {
if !yield( /*${1:V}*/ ) {
return
}
}
}
snippet retSeq2
return func(yield func(${1:K}, ${2:V}) bool) {
for /*TODO*/ {
if !yield( /*${1:K},${2:V}*/ ) {
return
}
}
}
snippet impl
var _ ${1:INTERFACE} = (*${2:CONCRETE_TYPE})(nil)
snippet implstr
var _ ${1:INTERFACE} = (*${2:CONCRETE_TYPE})(nil)
type ${2:CONCRETE_TYPE} ${3:UNDERLYING_TYPE}
snippet append
${1:slice} = append( ${1:slice}, ${2:value} )
+2
View File
@@ -0,0 +1,2 @@
snippet <! "" Ai
<!-- $1 -->
@@ -0,0 +1,14 @@
snippet (
(
$0
)
snippet {
{
$0
}
snippet [
[
$0
]
+105
View File
@@ -0,0 +1,105 @@
snippet as
--[[@as $1]]
snippet anon
function($1)
$0
end
snippet ) "" i
( $1 )
snippet ] "" i
[ $1 ]
snippet } "" i
{ $1 }
snippet ( "" i
(
$1
)
snippet [ "" i
[
$1
]
snippet { "" i
{
$1
}
snippet ltag ""
local ${0:$VISUAL} = '${0:$VISUAL}'
snippet tag
${0:$VISUAL} = '${0:$VISUAL}'
snippet != "" Ai
~=
snippet ne "" i
~=
snippet --[[ "" i
--[[
$0
--]]
snippet wopen
do
local file = io.open( $1, $2 )
assert( file ~= nil, ("io.open('%s', '%s' returned nil."):format($1, $2))
${0:$VISUAL}
file:close()
end
snippet wshader
local previous_shader = love.graphics.getShader()
love.graphics.setShader( $1 )
${0:$VISUAL}
love.graphics.setShader( previous_shader )
snippet wcanvas
local previous_canvas = love.graphics.getCanvas()
love.graphics.setCanvas( $1 )
${0:$VISUAL}
love.graphics.setCanvas( previous_canvas )
snippet wcolor
local previous_color = { love.graphics.getColor() }
love.graphics.setColor( $1 )
${0:$VISUAL}
love.graphics.setColor( previous_color )
snippet uvec
${1:$VISUAL}.x, ${1:$VISUAL}.y$0
snippet urec
${1:$VISUAL}.x, ${1:$VISUAL}.y, ${1:$VISUAL}.w, ${1:$VISUAL}.h$0
snippet swap
$1, $2 = $2, $1$0
snippet add ""
${1:$VISUAL} = ${1:$VISUAL} + $2
snippet sub
${1:$VISUAL} = ${1:$VISUAL} - $2
snippet mul
${1:$VISUAL} = ${1:$VISUAL} * $2
snippet div
${1:$VISUAL} = ${1:$VISUAL} / $2
snippet conc
${1:$VISUAL} = ${1:$VISUAL} .. $2
snippet inc
${1:$VISUAL} = ${1:$VISUAL} + 1$0
snippet dec
${1:$VISUAL} = ${1:$VISUAL} - 1$0
+14
View File
@@ -0,0 +1,14 @@
snippet raylib
${2:game}: ${1:main.c}
cc ${1:main.c} -o ${2:game} -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
clean:
rm ./${2:game}
run: ${2:game}
./${2:game}
snippet test
test: test.c
@cc -o test test.c
@./test || (rm -f test && $(MAKE) --no-print-directory clean && exit 1)
@@ -0,0 +1,480 @@
snippet link
[${1:$VISUAL}](${2:$VISUAL})
snippet XML
\`\`\`XML
${0:$VISUAL}
\`\`\`
snippet <! "" Ai
<!-- ${1:$VISUAL} -->
snippet <> "" i
<${1:$VISUAL}>
$0
</${1:$VISUAL}>
snippet FIFO
**First In, First Out** (FIFO)
snippet DAC
'DefaultAzureCredential'
snippet runarroll
![runarroll.gif](runarroll.gif)
snippet runarapprove
![runarapprove.gif](runarapprove.gif)
snippet runarangry
![runarangry.gif](runarangry.gif)
snippet runarshrug
![runarshrug.png](runarshrug.png)
snippet image
![$1]($1)
snippet note
> **Note**
> $0
snippet code
\`\`\`${1:c}
${0:$VISUAL}
\`\`\`
snippet haskell
\`\`\`haskell
${0:$VISUAL}
\`\`\`
snippet c
\`\`\`c
${0:$VISUAL}
\`\`\`
snippet bash
\`\`\`Bash
${0:$VISUAL}
\`\`\`
snippet json
\`\`\`JSON
${0:$VISUAL}
\`\`\`
snippet cs
\`\`\`cs
${0:$VISUAL}
\`\`\`
snippet cpp
\`\`\`cpp
${0:$VISUAL}
\`\`\`
snippet py "Python"
\`\`\`py
$0
\`\`\`
snippet bullet "Bullet item"
- **${1:...}** -
snippet check "Checklist item"
- [ ] ${0:...}
snippet i "Italic"
*${1:$VISUAL}*$0
snippet b "Bold"
**${1:$VISUAL}**$0
snippet ib "Italic Bold"
***${1:$VISUAL}***$0
snippet bi "Bold Italic"
***${1:...}***$0
snippet pagebreak "Force a pagebreak for when the document is converted to a pdf."
<div style="page-break-after: always;"></div>
snippet equation
\begin{equation*}
$0
\end{equation*}
snippet aligned
\begin{aligned}
$0
\end{aligned}
snippet matrix
\begin{bmatrix*}[r]
$0
\end{bmatrix*}
snippet detMatrix
\begin{vmatrix*}[r]
$0
\end{vmatrix*}
snippet row2matrix
${1:a} & ${2:b} \\\\
snippet row3matrix
${1:a} & ${2:b} & ${3:c} \\\\
snippet row4matrix
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
snippet row5matrix
${1:a} & ${2:b} & ${3:c} & ${4:d} & ${5:e} \\\\
snippet row6matrix
${1:a} & ${2:b} & ${3:c} & ${4:d} & ${5:e} & ${6:f}\\\\
snippet matI2
\begin{bmatrix*}[r]
1 & 0 \\\\
0 & 1 \\\\
\end{bmatrix*}
snippet mat22
\begin{bmatrix*}[r]
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
\end{bmatrix*}
snippet mat23
\begin{bmatrix*}[r]
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
\end{bmatrix*}
snippet mat24
\begin{bmatrix*}[r]
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
\end{bmatrix*}
snippet matI3
\begin{bmatrix*}[r]
1 & 0 & 0 \\\\
0 & 1 & 0 \\\\
0 & 0 & 1 \\\\
\end{bmatrix*}
snippet mat32
\begin{bmatrix*}[r]
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
\end{bmatrix*}
snippet mat33
\begin{bmatrix*}[r]
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
\end{bmatrix*}
snippet mat34
\begin{bmatrix*}[r]
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
\end{bmatrix*}
snippet matI4
\begin{bmatrix*}[r]
1 & 0 & 0 & 0 \\\\
0 & 1 & 0 & 0 \\\\
0 & 0 & 1 & 0 \\\\
0 & 0 & 0 & 1 \\\\
\end{bmatrix*}
snippet mat42
\begin{bmatrix*}[r]
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
${7:g} & ${8:h} \\\\
\end{bmatrix*}
snippet mat43
\begin{bmatrix*}[r]
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
${10:j} & ${11:k} & ${12:l} \\\\
\end{bmatrix*}
snippet mat44
\begin{bmatrix*}[r]
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
${13:m} & ${14:n} & ${15:o} & ${16:p} \\\\
\end{bmatrix*}
snippet detI2
\begin{vmatrix*}[r]
1 & 0 \\\\
0 & 1 \\\\
\end{vmatrix*}
snippet det22
\begin{vmatrix*}[r]
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
\end{vmatrix*}
snippet det23
\begin{vmatrix*}[r]
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
\end{vmatrix*}
snippet det24
\begin{vmatrix*}[r]
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
\end{vmatrix*}
snippet detI3
\begin{vmatrix*}[r]
1 & 0 & 0 \\\\
0 & 1 & 0 \\\\
0 & 0 & 1 \\\\
\end{vmatrix*}
snippet det32
\begin{vmatrix*}[r]
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
\end{vmatrix*}
snippet det33
\begin{vmatrix*}[r]
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
\end{vmatrix*}
snippet det34
\begin{vmatrix*}[r]
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
\end{vmatrix*}
snippet detI4
\begin{vmatrix*}[r]
1 & 0 & 0 & 0 \\\\
0 & 1 & 0 & 0 \\\\
0 & 0 & 1 & 0 \\\\
0 & 0 & 0 & 1 \\\\
\end{vmatrix*}
snippet det42
\begin{vmatrix*}[r]
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
${7:g} & ${8:h} \\\\
\end{vmatrix*}
snippet det43
\begin{vmatrix*}[r]
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
${10:j} & ${11:k} & ${12:l} \\\\
\end{vmatrix*}
snippet det44
\begin{vmatrix*}[r]
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
${13:m} & ${14:n} & ${15:o} & ${16:p} \\\\
\end{vmatrix*}
snippet pi
\pi
snippet infinity
\infty
snippet sum
\sum_{i=${1:1}}^{${2:\\infty}}
snippet fraction
\frac{${1:a}}{${2:b}}
snippet flexbrace
\left($1\right)
snippet text
\text{$1}
snippet Z
\mathbb{Z}
snippet Z+
\mathbb{Z}^{+}
snippet Z+0
\mathbb{Z}^{+}_{0}
snippet Z-
\mathbb{Z}^{-}
snippet Z-0
\mathbb{Z}^{-}_0
snippet N
\mathbb{N}
snippet R
\mathbb{R}
snippet Rn
\mathbb{R}^n
snippet Rm
\mathbb{R}^m
snippet lambda
\lambda
snippet my
\mu
snippet bigVec
\overrightarrow{$1}
snippet vec
\vec{$1}
snippet colvec2
\begin{bmatrix*}[r]
${1:x_1} \\\\
${2:x_2} \\\\
\end{bmatrix*}
snippet colvec3
\begin{bmatrix*}[r]
${1:x_1} \\\\
${2:x_2} \\\\
${3:x_3} \\\\
\end{bmatrix*}
snippet colvec4
\begin{bmatrix*}[r]
${1:x_1} \\\\
${2:x_2} \\\\
${3:x_3} \\\\
${4:x_4} \\\\
\end{bmatrix*}
snippet colvec5
\begin{bmatrix*}[r]
${1:x_1} \\\\
${2:x_2} \\\\
${3:x_3} \\\\
${4:x_4} \\\\
${5:x_5} \\\\
\end{bmatrix*}
snippet +-
\pm
snippet sqrt
\sqrt{$1}
snippet nsqrt
\sqrt[$1]{$2}
snippet abc
${1:x} = \frac{-${3:b} \pm \sqrt{ ${3:b}^2 - 4 * ${4:c} * ${2:a} } }{ 2 * ${2:a} }$0
snippet ul
\underline{$1}
snippet ulul
\underline{\underline{$1}}$0
snippet boldText
\textbf{$1}
snippet italicText
\emph{$1}
snippet section
\section{$1}$0
snippet subsection
\subsection{$1}$0
snippet subsubsection
\subsubsection{$1}$0
snippet enumerate
\begin{enumerate}
$0
\end{enumerate}
snippet item
\item $1
snippet transformation
T : \mathbb{R}^${1:n} \to \mathbb{R}^${2:m}
snippet pow
${1:a}^{${2:n}}$0
snippet inverse
^{-1}
snippet transposed
^{T}
snippet nxn
${1:n} \times ${1:n}
snippet nxm
${1:n} \times ${2:m}
snippet adj
\text{adj}
snippet span
\text{Span}
snippet squigles
\\{$1\\}$0
snippet vecu
\vec{u}
snippet vecv
\vec{v}
snippet vecx
\vec{x}
snippet vecb
\vec{b}
snippet vecw
\vec{w}
snippet u "Underscore"
_{$1}$0
snippet dots "... in math mode"
\dots
snippet nbasis
B = \{\vec b_1, \dots, \vec b_n \\}
snippet dim
\\text{dim }
snippet dot
\\cdot
@@ -0,0 +1,28 @@
snippet main
def main():
${0:$VISUAL}
if __name__ == '__main__':
main()
snippet mainargs
from sys import argv
def main( me: str, args: list[str] ):
${0:$VISUAL}
if __name__ == '__main__':
main(argv[0], argv[1:])
snippet tag
$1 = '$1'
snippet assign
self.$1 = $1
snippet ignore
#pyright: ignore
snippet ''' "" Ai
'''
$0
'''
+30
View File
@@ -0,0 +1,30 @@
snippet (
(
$1
)
snippet [
[
$1
]
snippet {
{
$1
}
snippet )
($1)
snippet ]
[$1]
snippet }
{$1}
snippet inc
${1:var} = ${1:var} + 1;
snippet cmpn
#[derive(Component)] struct $1;
+3
View File
@@ -0,0 +1,3 @@
snippet raylibBuildLinux
cc $1.c -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 -o $1
./$1
@@ -0,0 +1,9 @@
snippet vis
\${${1:n}:\$VISUAL}
snippet par
\${${1:n}:${2:default}}
snippet code
snippet ${1:c}
\\\`\\\`\\\`${1:c}
\${0:\$VISUAL}
\\\`\\\`\\\`
+441
View File
@@ -0,0 +1,441 @@
snippet template
\documentclass{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{titlesec}
\AddToHook{cmd/section/before}{\clearpage}
\linespread{1.25}
\usepackage[skip=10pt plus1pt, indent=0pt]{parskip}
\titleformat{\section}
{\normalfont\Large\bfseries}{}{0em}{} % Removes section numbering
\titleformat{\subsection}
{\normalfont\large\bfseries}{}{0em}{} % Removes subsection numbering
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{}{0em}{} % Removes subsubsection numbering
\titlespacing*{\section}{0pt}{\baselineskip}{\baselineskip}
\titlespacing*{\subsection}{0pt}{\baselineskip}{\baselineskip}
\titlespacing*{\subsubsection}{0pt}{\baselineskip}{\baselineskip}
\begin{document}
$0
\end{document}
snippet templateMath
\documentclass{article}
\AddToHook{cmd/section/before}{\clearpage}
\usepackage{amsfonts}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{amsmath}
\usepackage[a4paper, margin=2.5cm]{geometry}
\newmdenv[linecolor=black,linewidth=2pt,roundcorner=5pt]{questionbox}
\newenvironment{question}[1]
{\begin{questionbox}\textbf{\boldmath #1}\par\medskip\hrule\medskip}
{\end{questionbox}}
\begin{document}
\tableofcontents
$0
\end{document}
snippet question
\begin{question}{ ${1:Question} }
$0
\end{question}
snippet equation
\begin{equation*}
$0
\end{equation*}
snippet aligned
\begin{aligned}
$0
\end{aligned}
snippet matrix
\begin{bmatrix}
$0
\end{bmatrix}
snippet detMatrix
\begin{vmatrix}
$0
\end{vmatrix}
snippet row2matrix
${1:a} & ${2:b} \\\\
snippet row3matrix
${1:a} & ${2:b} & ${3:c} \\\\
snippet row4matrix
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
snippet row5matrix
${1:a} & ${2:b} & ${3:c} & ${4:d} & ${5:e} \\\\
snippet row6matrix
${1:a} & ${2:b} & ${3:c} & ${4:d} & ${5:e} & ${6:f}\\\\
snippet matI2
\begin{bmatrix}
1 & 0 \\\\
0 & 1 \\\\
\end{bmatrix}
snippet mat22
\begin{bmatrix}
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
\end{bmatrix}
snippet mat23
\begin{bmatrix}
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
\end{bmatrix}
snippet mat24
\begin{bmatrix}
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
\end{bmatrix}
snippet matI3
\begin{bmatrix}
1 & 0 & 0 \\\\
0 & 1 & 0 \\\\
0 & 0 & 1 \\\\
\end{bmatrix}
snippet mat32
\begin{bmatrix}
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
\end{bmatrix}
snippet mat33
\begin{bmatrix}
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
\end{bmatrix}
snippet mat34
\begin{bmatrix}
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
\end{bmatrix}
snippet matI4
\begin{bmatrix}
1 & 0 & 0 & 0 \\\\
0 & 1 & 0 & 0 \\\\
0 & 0 & 1 & 0 \\\\
0 & 0 & 0 & 1 \\\\
\end{bmatrix}
snippet mat42
\begin{bmatrix}
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
${7:g} & ${8:h} \\\\
\end{bmatrix}
snippet mat43
\begin{bmatrix}
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
${10:j} & ${11:k} & ${12:l} \\\\
\end{bmatrix}
snippet mat44
\begin{bmatrix}
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
${13:m} & ${14:n} & ${15:o} & ${16:p} \\\\
\end{bmatrix}
snippet detI2
\begin{vmatrix}
1 & 0 \\\\
0 & 1 \\\\
\end{vmatrix}
snippet det22
\begin{vmatrix}
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
\end{vmatrix}
snippet det23
\begin{vmatrix}
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
\end{vmatrix}
snippet det24
\begin{vmatrix}
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
\end{vmatrix}
snippet detI3
\begin{vmatrix}
1 & 0 & 0 \\\\
0 & 1 & 0 \\\\
0 & 0 & 1 \\\\
\end{vmatrix}
snippet det32
\begin{vmatrix}
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
\end{vmatrix}
snippet det33
\begin{vmatrix}
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
\end{vmatrix}
snippet det34
\begin{vmatrix}
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
\end{vmatrix}
snippet detI4
\begin{vmatrix}
1 & 0 & 0 & 0 \\\\
0 & 1 & 0 & 0 \\\\
0 & 0 & 1 & 0 \\\\
0 & 0 & 0 & 1 \\\\
\end{vmatrix}
snippet det42
\begin{vmatrix}
${1:a} & ${2:b} \\\\
${3:c} & ${4:d} \\\\
${5:e} & ${6:f} \\\\
${7:g} & ${8:h} \\\\
\end{vmatrix}
snippet det43
\begin{vmatrix}
${1:a} & ${2:b} & ${3:c} \\\\
${4:d} & ${5:e} & ${6:f} \\\\
${7:g} & ${8:h} & ${9:i} \\\\
${10:j} & ${11:k} & ${12:l} \\\\
\end{vmatrix}
snippet det44
\begin{vmatrix}
${1:a} & ${2:b} & ${3:c} & ${4:d} \\\\
${5:e} & ${6:f} & ${7:g} & ${8:h} \\\\
${9:i} & ${10:j} & ${11:k} & ${12:l} \\\\
${13:m} & ${14:n} & ${15:o} & ${16:p} \\\\
\end{vmatrix}
snippet pi
\pi
snippet infinity
\infty
snippet sum
\sum_{i=${1:1}}^{${2:\\infty}}
snippet fraction
\frac{${1:a}}{${2:b}}
snippet flexbrace
\left($1\right)
snippet text
\text{$1}
snippet Z
\mathbb{Z}
snippet Z+
\mathbb{Z}^{+}
snippet Z+0
\mathbb{Z}^{+}_{0}
snippet Z-
\mathbb{Z}^{-}
snippet Z-0
\mathbb{Z}^{-}_0
snippet N
\mathbb{N}
snippet R
\mathbb{R}
snippet Rn
\mathbb{R}^n
snippet Rm
\mathbb{R}^m
snippet lambda
\lambda
snippet my
\mu
snippet bigVec
\overrightarrow{$1}
snippet vec
\vec{$1}
snippet colvec2
\begin{bmatrix}
${1:x_1} \\\\
${2:x_2} \\\\
\end{bmatrix}
snippet colvec3
\begin{bmatrix}
${1:x_1} \\\\
${2:x_2} \\\\
${3:x_3} \\\\
\end{bmatrix}
snippet colvec4
\begin{bmatrix}
${1:x_1} \\\\
${2:x_2} \\\\
${3:x_3} \\\\
${4:x_4} \\\\
\end{bmatrix}
snippet colvec5
\begin{bmatrix}
${1:x_1} \\\\
${2:x_2} \\\\
${3:x_3} \\\\
${4:x_4} \\\\
${5:x_5} \\\\
\end{bmatrix}
snippet +-
\pm
snippet sqrt
\sqrt{$1}
snippet nsqrt
\sqrt[$1]{$2}
snippet abc
${1:x} = \frac{-${3:b} \pm \sqrt{ ${3:b}^2 - 4 * ${4:c} * ${2:a} } }{ 2 * ${2:a} }$0
snippet ul
\underline{$1}
snippet ulul
\underline{\underline{$1}}$0
snippet boldText
\textbf{$1}
snippet italicText
\emph{$1}
snippet section
\section{$1}$0
snippet subsection
\subsection{$1}$0
snippet subsubsection
\subsubsection{$1}$0
snippet enumerate
\begin{enumerate}
$0
\end{enumerate}
snippet item
\item $1
snippet transformation
T : \mathbb{R}^${1:n} \to \mathbb{R}^${2:m}
snippet pow
${1:a}^{${2:n}}$0
snippet inverse
^{-1}
snippet transposed
^{T}
snippet nxn
${1:n} \times ${1:n}
snippet nxm
${1:n} \times ${2:m}
snippet adj
\text{adj}
snippet span
\text{Span}
snippet squigles
\\{$1\\}$0
snippet vecu
\vec{u}
snippet vecv
\vec{v}
snippet vecx
\vec{x}
snippet vecb
\vec{b}
snippet vecw
\vec{w}
snippet u "Underscore"
_{$1}$0
snippet dots "... in math mode"
\dots
snippet nbasis
B = \{\vec b_1, \dots, \vec b_n \\}
snippet dim
\\text{dim }
snippet dot
\\cdot
@@ -0,0 +1,13 @@
snippet tscl
<$1/>
snippet tone
<$1>${0:$VISUAL}</$1>
snippet tmul
<$1>
${0:$VISUAL}
</$1>
snippet view
<View>
${0:$VISUAL}
</View>
@@ -0,0 +1,6 @@
snippet gear
gearDict.insert(
"$1",
gear($2)[$1][$3]
)
+3
View File
@@ -0,0 +1,3 @@
snippet basedpyrightErrors
set makeprg=basedpyright
set errorformat=%f:%l:%c\ -\ %t%*[^:]:%m
+16
View File
@@ -0,0 +1,16 @@
snippet backfill
- name: Backfill ${1:$VISUAL} once a day for the last 5 days (gap filling)
functionExternalId: icapi_datapoints_extractor
cronExpression: "47 0 * * *"
data:
backfill: True
sites:
- ${1:$VISUAL}
snippet singleHeader
CompileFlags:
Add:
- -D${1:SOME_IMPL_MACRO}
Diagnostics:
Suppress:
- misc-definitions-in-headers
+7
View File
@@ -0,0 +1,7 @@
snippet fori
{
var ${1:i}: usize = ${2:0};
while (i < ${3:10}) : (${1:i} += ${4:1}) {
$0
}
}