minor updates

This commit is contained in:
Ian Griffin 2025-08-18 11:07:22 +08:00
parent 13b27243ea
commit dbb9af29d5
4 changed files with 72 additions and 9 deletions

View File

@ -29,6 +29,51 @@ ct.map('n', '<Leader>wq', '<cmd>w<CR><cmd>bd<CR>')
-- netrw -- netrw
ct.map('n', '<Leader>e', '<cmd>Explore<CR>') ct.map('n', '<Leader>e', '<cmd>Explore<CR>')
--
-- LSP
--
local lsp_buf = vim.lsp.buf
-- Function to convert snake_case to PascalCase
local function snake_to_pascal(name)
return name:gsub('_', ''):gsub("(%a)(%w*)", function(first, rest)
return first:upper() .. rest:lower()
end)
end
for func_name, _ in pairs(lsp_buf) do
if type(lsp_buf[func_name]) == "function" then -- Check if the value is a function
local command_name = 'LspBuf' .. snake_to_pascal(func_name)
vim.api.nvim_create_user_command(
command_name,
function()
lsp_buf[func_name]() -- Call the function from the table
end,
{desc = "Run LSP Buffer Function: " .. func_name}
)
end
end
function toggle_background()
local bg = vim.o.background
if bg == "dark" then
vim.cmd("set background=light")
else
vim.cmd("set background=dark")
end
-- Query the current colorscheme
--[[ local colorscheme = vim.fn.executable('colorscheme') or ""
-- colorscheme = colorscheme:match("^%s*(.-)%s*$")
-- Reload the colorscheme if it was set
if colorscheme ~= "" then
vim.cmd("colorscheme " .. colorscheme)
end ]]--
end
ct.map('n', '<Leader>b', '<cmd>lua toggle_background()<CR>')
-- --
-- Commands -- Commands
-- --

View File

@ -8,7 +8,7 @@ require("lazy").setup({
}, },
-- Configure any other settings here. See the documentation for more details. -- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins. -- colorscheme that will be used when installing plugins.
install = { colorscheme = { "onedark" } }, install = { colorscheme = { "enfocado" } },
-- automatically check for plugin updates -- automatically check for plugin updates
checker = { enabled = true }, checker = { enabled = false },
}) })

View File

@ -1,7 +1,7 @@
return { return {
{ {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
-- build = ':TSUpdate', build = ':TSUpdate',
event = { "VeryLazy" }, event = { "VeryLazy" },
lazy = vim.fn.argc(-1) == 0, lazy = vim.fn.argc(-1) == 0,
opts = { opts = {
@ -21,6 +21,7 @@ return {
"lua", "lua",
"php", "php",
"python", "python",
"sql",
"typescript", "typescript",
"tsx", "tsx",
"vim", "vim",
@ -56,8 +57,13 @@ return {
{ 'ap/vim-css-color', lazy = false }, { 'ap/vim-css-color', lazy = false },
-- close tags in html languages -- close tags in html languages
{ {
'alvan/closetag.vim', 'alvan/vim-closetag',
ft = { "html", "vue", "typescriptreact" }, ft = { "html", "vue", "javascriptreact", "typescriptreact", "xml" },
config = function()
vim.g.closetag_xhtml_filenames = '*.xhtml,*.js,*.tsx'
vim.g.clostag_xhtml_filetypes = 'xhtm,jsx,tsx'
vim.cmd [[ CloseTagEnableBuffer ]]
end,
}, },
{ {
@ -134,17 +140,17 @@ return {
vim.diagnostic.config({ virtual_text = false }) vim.diagnostic.config({ virtual_text = false })
end end
}, },
{ --[[{
'huggingface/llm.nvim', 'huggingface/llm.nvim',
opts = { opts = {
model = 'qwen2.5-coder:7b', model = 'qwen2.5-coder:latest',
backend = 'ollama', backend = 'ollama',
url = 'http://localhost:11434', url = 'http://localhost:11434',
lsp = { lsp = {
bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "/mason/bin/llm-ls", bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "/mason/bin/llm-ls",
} }
}, },
}, }, ]]--
{ {
'mason-org/mason-lspconfig.nvim', 'mason-org/mason-lspconfig.nvim',
dependencies = { dependencies = {
@ -165,6 +171,7 @@ return {
"lua_ls", "lua_ls",
"phpactor", "phpactor",
"pyright", "pyright",
"sqls",
"texlab", "texlab",
"ts_ls" "ts_ls"
}, },
@ -183,10 +190,21 @@ return {
"lua", "lua",
"php", "php",
"python", "python",
"sql",
"tex", "tex",
"typescript", "typescript",
"typescriptreact", "typescriptreact",
}, },
--[[ config = function()
vim.lsp.config('*', require('coq').lsp_ensure_capabilities {
on_attach = function(client, bufnr)
local basics = require('lsp_basics')
basics.make_lsp_commands(client, bufnr)
basics.make_lsp_mappings(client, bufnr)
end
})
end, ]]--
-- config = function() -- config = function()
-- local masonlsp = require 'mason-lspconfig' -- local masonlsp = require 'mason-lspconfig'
-- --[[ -- --[[

View File

@ -43,7 +43,7 @@ return {
lazy = false, lazy = false,
init = function() init = function()
vim.g.indent_guides_guide_size = 1 vim.g.indent_guides_guide_size = 1
vim.g.indent_guides_tab_guides = 0 vim.g.indent_guides_tab_guides = 0
vim.g.indent_guides_start_level = 2 vim.g.indent_guides_start_level = 2
vim.g.indent_guides_enable_on_vim_startup = 1 vim.g.indent_guides_enable_on_vim_startup = 1
end end