nvim-config/lua/commands.lua
2024-10-16 16:45:17 -07:00

28 lines
965 B
Lua

-- Insert PDB breakpoint
vim.api.nvim_create_user_command('PDB', 'norm obreakpoint() # michael', {})
vim.api.nvim_create_user_command('BP', 'norm obreakpoint() # michael', {})
-- Copy Relative File Path to Clipboard
vim.api.nvim_create_user_command('C', 'let @+ = expand("%:~:.")', {})
local function gitblame_toggle_summary()
local normal = '<author> • <date>'
local with_summary = '<summary> • <author> • <date>'
if vim.g.gitblame_message_template == normal then
vim.g.gitblame_message_template = with_summary
else
vim.g.gitblame_message_template = normal
end
end
vim.api.nvim_create_user_command('GitBlameToggleSummary', gitblame_toggle_summary, {})
-- Copy pytest <filename> -N <current word> to Clipboard
local function copy_pytest_command()
local fp = vim.fn.expand('%:~:.')
local word = vim.fn.expand('<cword>')
vim.fn.setreg('+', 'pytest ' .. fp .. ' -N ' .. word)
end
vim.api.nvim_create_user_command('P', copy_pytest_command, {})