updates
This commit is contained in:
parent
8ba8fc98ca
commit
e2ee24b57a
13 changed files with 238 additions and 70 deletions
|
|
@ -12,14 +12,14 @@ in {
|
|||
enable = mkBoolOpt false "Enable Kitty Term";
|
||||
|
||||
fonts = {
|
||||
# normal = mkStringOpt "ZedMono Nerd Font Mono Bold" "Normal Font";
|
||||
# bold = mkStringOpt "ZedMono Nerd Font Mono ExtraBold" "Bold Font";
|
||||
# italic = mkStringOpt "ZedMono Nerd Font Mono Bold Italic" "Italic Font";
|
||||
# bold_italic = mkStringOpt "ZedMono Nerd Font Mono ExtraBold Italic" "Bold Italic Font";
|
||||
normal = mkStringOpt "Iosevka Bold" "Normal Font";
|
||||
bold = mkStringOpt "Iosevka ExtraBold" "Bold Font";
|
||||
italic = mkStringOpt "Iosevka Bold Italic" "Italic Font";
|
||||
bold_italic = mkStringOpt "Iosevka ExtraBold Italic" "Bold Italic Font";
|
||||
normal = mkStringOpt "JetBrainsMonoNL Nerd Font Mono Bold" "Normal Font";
|
||||
bold = mkStringOpt "JetBrainsMonoNL Nerd Font Mono ExtraBold" "Bold Font";
|
||||
italic = mkStringOpt "JetBrainsMonoNL Nerd Font Mono Bold Italic" "Italic Font";
|
||||
bold_italic = mkStringOpt "JetBrainsMonoNL Nerd Font Mono ExtraBold Italic" "Bold Italic Font";
|
||||
# normal = mkStringOpt "Iosevka Bold" "Normal Font";
|
||||
# bold = mkStringOpt "Iosevka ExtraBold" "Bold Font";
|
||||
# italic = mkStringOpt "Iosevka Bold Italic" "Italic Font";
|
||||
# bold_italic = mkStringOpt "Iosevka ExtraBold Italic" "Bold Italic Font";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
"lazyvim.plugins.extras.lang.tailwind",
|
||||
"lazyvim.plugins.extras.lang.elixir",
|
||||
"lazyvim.plugins.extras.lang.tex",
|
||||
"lazyvim.plugins.extras.lang.go",
|
||||
"lazyvim.plugins.extras.lang.typescript",
|
||||
"lazyvim.plugins.extras.test.core",
|
||||
"lazyvim.plugins.extras.util.dot",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,121 @@
|
|||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
-- Function to get the visual selection
|
||||
local function get_visual_selection()
|
||||
-- Get the current buffer number (0 means current buffer)
|
||||
local bufnr = 0
|
||||
|
||||
-- Get the total number of lines in the buffer
|
||||
local line_count = vim.api.nvim_buf_line_count(bufnr)
|
||||
|
||||
-- Get all lines from the buffer (0-based index, end is exclusive)
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, line_count, false)
|
||||
|
||||
-- Get the file name
|
||||
local file_name = vim.fn.expand("%:p")
|
||||
|
||||
-- Create the file info description
|
||||
local file_info = string.format("File: %s (%d lines)", file_name, line_count)
|
||||
|
||||
-- Convert the lines into a single string
|
||||
local file_contents = table.concat(lines, "\n")
|
||||
|
||||
-- Return both the file contents and the file info
|
||||
return file_contents, file_info
|
||||
end
|
||||
|
||||
-- Function to parse JSON response and get gist URL
|
||||
local function handle_response(response)
|
||||
-- Parse the JSON response
|
||||
local ok, decoded = pcall(vim.fn.json_decode, response)
|
||||
if not ok then
|
||||
vim.api.nvim_echo({ {
|
||||
"Failed to parse response: " .. decoded,
|
||||
"ErrorMsg",
|
||||
} }, true, {})
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Check if we have the expected data structure
|
||||
if not (decoded and decoded.data and decoded.data.id) then
|
||||
vim.api.nvim_echo({ {
|
||||
"Invalid response format",
|
||||
"ErrorMsg",
|
||||
} }, true, {})
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Construct the URL
|
||||
return string.format("https://zoeys.computer/gists/%s", decoded.data.id)
|
||||
end
|
||||
|
||||
-- Function to create gist
|
||||
local function create_gist()
|
||||
-- Get the selected code and line range
|
||||
local selected_code, line_range = get_visual_selection()
|
||||
|
||||
-- Check if we got any code
|
||||
if selected_code == "" then
|
||||
vim.api.nvim_echo({ {
|
||||
"No text selected",
|
||||
"ErrorMsg",
|
||||
} }, true, {})
|
||||
return
|
||||
end
|
||||
|
||||
-- Get the current file name with extension
|
||||
local file_name = vim.fn.expand("%:t")
|
||||
if file_name == "" then
|
||||
file_name = "untitled." .. vim.bo.filetype
|
||||
end
|
||||
|
||||
-- Create the payload table first
|
||||
local payload = {
|
||||
title = file_name,
|
||||
desc = line_range,
|
||||
code = selected_code,
|
||||
lang = vim.bo.filetype,
|
||||
}
|
||||
|
||||
-- Convert to JSON string
|
||||
local json_data = vim.fn.json_encode(payload)
|
||||
|
||||
-- Create a temporary file for the JSON payload
|
||||
local temp_file = os.tmpname()
|
||||
local f = io.open(temp_file, "w")
|
||||
f:write(json_data)
|
||||
f:close()
|
||||
|
||||
-- Construct and execute the curl command
|
||||
local cmd = string.format(
|
||||
[[
|
||||
curl -s -X POST \
|
||||
https://zoeys.computer/api/gists/create \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer Z4MYrYtJUb3Y8VvJynkWAw9eBVU3kvvW9gQ50--hROw" \
|
||||
-d @%s
|
||||
]],
|
||||
temp_file
|
||||
)
|
||||
|
||||
-- Execute the command and get the response
|
||||
local response = vim.fn.system(cmd)
|
||||
|
||||
-- Clean up the temporary file
|
||||
os.remove(temp_file)
|
||||
|
||||
-- Parse response and get URL
|
||||
local url = handle_response(response)
|
||||
if url then
|
||||
-- Copy URL to system clipboard
|
||||
vim.fn.setreg("+", url)
|
||||
|
||||
-- Show success message
|
||||
vim.api.nvim_echo({ {
|
||||
"Gist created! URL copied to clipboard: " .. url,
|
||||
"Normal",
|
||||
} }, true, {})
|
||||
end
|
||||
end
|
||||
|
||||
-- Set up the keybinding (you can modify this to your preferred key combination)
|
||||
vim.keymap.set("n", "<leader>zc", create_gist, { noremap = true, silent = true, expr = true })
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
function confirm(opts)
|
||||
local cmp = require("blink.cmp")
|
||||
opts = vim.tbl_extend("force", { select = true }, opts or {})
|
||||
return function(fallback) end
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
|
|
@ -5,6 +11,8 @@ return {
|
|||
colorscheme = "catppuccin",
|
||||
},
|
||||
},
|
||||
{ "nvim-lualine/lualine.nvim", enabled = false },
|
||||
{ "echasnovski/mini.statusline", opts = {} },
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
|
|
@ -29,6 +37,18 @@ return {
|
|||
},
|
||||
},
|
||||
{ "hrsh7th/nvim-cmp", enabled = false },
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
tag = "v3.8.2",
|
||||
---@module "ibl"
|
||||
---@type ibl.config
|
||||
-- opts = {
|
||||
-- debounce = 100,
|
||||
-- indent = { char = "|" },
|
||||
-- whitespace = { highlight = "Whitespace", "NonText" },
|
||||
-- },
|
||||
},
|
||||
{
|
||||
"jake-stewart/force-cul.nvim",
|
||||
config = function()
|
||||
|
|
@ -39,19 +59,49 @@ return {
|
|||
"saghen/blink.cmp",
|
||||
lazy = false, -- lazy loading handled internally
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
dependencies = { "rafamadriz/friendly-snippets", "saghen/blink.compat" },
|
||||
|
||||
build = "cargo build --release",
|
||||
|
||||
sources = {
|
||||
completion = {
|
||||
enabled_providers = { "lsp", "path", "snippets", "buffer", "dadbod", "crates" },
|
||||
},
|
||||
|
||||
providers = {
|
||||
dadbod = {
|
||||
name = "vim-dadbod-completion",
|
||||
module = "blink.compat",
|
||||
opts = {},
|
||||
},
|
||||
crates = {
|
||||
name = "crates",
|
||||
module = "blink.compat",
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
show = "<C-S-space>",
|
||||
accept = "<Enter>",
|
||||
select_prev = { "<S-Tab>", "<C-j>", "<C-p>" },
|
||||
select_next = { "<C-Tab>", "<C-k>", "<C-n>" },
|
||||
|
||||
snippet_forward = "<Tab>",
|
||||
snippet_backward = "<C-S-Tab>",
|
||||
["<C-b>"] = { "scroll_documentation_down", "fallback" },
|
||||
["<C-f>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-p>"] = { "select_prev", "fallback" },
|
||||
["<C-n>"] = { "select_next", "fallback" },
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
["<CR>"] = {
|
||||
function(cmp)
|
||||
if cmp.is_in_snippet() then
|
||||
return cmp.accept()
|
||||
else
|
||||
return cmp.select_and_accept()
|
||||
end
|
||||
end,
|
||||
"snippet_forward",
|
||||
"fallback",
|
||||
},
|
||||
},
|
||||
|
||||
windows = {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ return {
|
|||
"oysandvik94/curl.nvim",
|
||||
cmd = { "CurlOpen" },
|
||||
keys = {
|
||||
{ "<leader>co", "<cmd>CurlOpen<cr>", desc = "Open Curl" },
|
||||
{ "<leader>C", "<cmd>CurlOpen<cr>", desc = "Open Curl" },
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ in {
|
|||
markdownlint-cli2
|
||||
shfmt
|
||||
sqlfluff
|
||||
go
|
||||
|
||||
tailwindcss-language-server
|
||||
clang
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue