refactor: update remaining language and misc plugins
- Update copilot.lua, copilot-chat.lua AI integrations - Refactor jupytext.lua, slime.lua, venv-selector.lua for Python dev - Update dadbod.lua database tools, vimtex.lua LaTeX support - Clean up context.lua, render-markdown.lua, solarized.lua, monokai.lua - Update auto-dark-mode.lua, undotree.lua
This commit is contained in:
parent
f162354317
commit
467f005604
13 changed files with 163 additions and 163 deletions
|
|
@ -1,3 +1,5 @@
|
|||
local themes = require('custom.themes')
|
||||
|
||||
-- Define the function to set custom highlights for both themes
|
||||
local function set_lsp_highlights(mode)
|
||||
local hl = vim.api.nvim_set_hl
|
||||
|
|
@ -20,6 +22,10 @@ local function set_lsp_highlights(mode)
|
|||
local comment = '#75715e'
|
||||
local line_nr = '#90908a'
|
||||
|
||||
-- Transparent background for editor
|
||||
hl(0, 'Normal', { bg = 'none' })
|
||||
hl(0, 'NormalNC', { bg = 'none' })
|
||||
|
||||
for _, group in ipairs(diagnostic_groups) do
|
||||
hl(0, group, { fg = fg, bg = bg, underline = false })
|
||||
end
|
||||
|
|
@ -27,11 +33,19 @@ local function set_lsp_highlights(mode)
|
|||
hl(0, 'TreesitterContext', { bg = bg })
|
||||
hl(0, 'TreesitterContextLineNumber', { fg = line_nr })
|
||||
hl(0, 'TreesitterContextSeparator', { fg = comment })
|
||||
|
||||
-- Notify styling
|
||||
hl(0, 'NormalFloat', { bg = bg, fg = '#f8f8f2' })
|
||||
hl(0, 'FloatBorder', { bg = bg, fg = '#75715e' })
|
||||
elseif mode == 'light' then
|
||||
local bg = '#fdf6e3'
|
||||
local fg = '#657b83'
|
||||
local comment = '#586e75'
|
||||
|
||||
-- Transparent background for editor
|
||||
hl(0, 'Normal', { bg = 'none' })
|
||||
hl(0, 'NormalNC', { bg = 'none' })
|
||||
|
||||
hl(0, 'LspDocumentHighlight', { bg = bg, fg = fg, underline = false })
|
||||
hl(0, 'DiagnosticVirtualTextError', { fg = '#dc322f' })
|
||||
hl(0, 'DiagnosticVirtualTextWarn', { fg = '#b58900' })
|
||||
|
|
@ -41,25 +55,27 @@ local function set_lsp_highlights(mode)
|
|||
hl(0, 'TreesitterContext', { bg = 'NONE' })
|
||||
hl(0, 'TreesitterContextLineNumber', { fg = comment })
|
||||
hl(0, 'TreesitterContextSeparator', { fg = comment })
|
||||
|
||||
-- Notify styling
|
||||
hl(0, 'NormalFloat', { bg = bg, fg = '#657b83' })
|
||||
hl(0, 'FloatBorder', { bg = bg, fg = comment })
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
'f-person/auto-dark-mode.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
update_interval = 2000,
|
||||
set_dark_mode = function()
|
||||
vim.api.nvim_set_option_value('background', 'dark', {})
|
||||
vim.cmd('colorscheme monokai_soda')
|
||||
|
||||
-- Apply custom highlight settings for Monokai
|
||||
vim.o.background = 'dark'
|
||||
vim.cmd.colorscheme(themes.dark)
|
||||
set_lsp_highlights('dark')
|
||||
end,
|
||||
set_light_mode = function()
|
||||
vim.api.nvim_set_option_value('background', 'light', {})
|
||||
vim.cmd('colorscheme solarized')
|
||||
|
||||
-- Apply custom highlight settings for Solarized
|
||||
vim.o.background = 'light'
|
||||
vim.cmd.colorscheme(themes.light)
|
||||
set_lsp_highlights('light')
|
||||
end,
|
||||
},
|
||||
|
|
|
|||
2
lua/custom/plugins/context.lua
Normal file → Executable file
2
lua/custom/plugins/context.lua
Normal file → Executable file
|
|
@ -7,7 +7,7 @@ return {
|
|||
multiwindow = false,
|
||||
multiline_threshold = 1,
|
||||
trim_scope = 'inner',
|
||||
mode = 'cursor', -- faster than 'cursor'
|
||||
mode = 'cursor', -- faster than 'topline'
|
||||
separator = '─',
|
||||
on_attach = function(buf)
|
||||
-- disable for large files
|
||||
|
|
|
|||
29
lua/custom/plugins/copilot-chat.lua
Normal file → Executable file
29
lua/custom/plugins/copilot-chat.lua
Normal file → Executable file
|
|
@ -1,4 +1,3 @@
|
|||
-- Copilot Chat (UI + prompts for Copilot)
|
||||
return {
|
||||
'CopilotC-Nvim/CopilotChat.nvim',
|
||||
cmd = {
|
||||
|
|
@ -13,31 +12,23 @@ return {
|
|||
'CopilotChatToggle',
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>C', '<cmd>CopilotChat<cr>', desc = 'Open CopilotChat' },
|
||||
{ '<leader>Cq', '<cmd>CopilotChatClose<cr>', desc = 'Close CopilotChat' },
|
||||
{ '<leader>Ce', '<cmd>CopilotChatExplain<cr>', desc = 'Explain code', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cr', '<cmd>CopilotChatReview<cr>', desc = 'Review code', mode = { 'n', 'v' } },
|
||||
{ '<leader>Ct', '<cmd>CopilotChatTests<cr>', desc = 'Generate tests', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cf', '<cmd>CopilotChatRefactor<cr>', desc = 'Refactor code', mode = { 'n', 'v' } },
|
||||
{ '<leader>Co', '<cmd>CopilotChatOptimize<cr>', desc = 'Optimize code', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cd', '<cmd>CopilotChatDocs<cr>', desc = 'Generate docs', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cp', '<cmd>CopilotChatToggle<cr>', desc = 'Toggle CopilotChat' },
|
||||
{ '<leader>CC', '<cmd>CopilotChat<cr>', desc = 'Open CopilotChat' }, -- fix: was <leader>C
|
||||
{ '<leader>Cq', '<cmd>CopilotChatClose<cr>', desc = 'Close' },
|
||||
{ '<leader>Ce', '<cmd>CopilotChatExplain<cr>', desc = 'Explain', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cr', '<cmd>CopilotChatReview<cr>', desc = 'Review', mode = { 'n', 'v' } },
|
||||
{ '<leader>Ct', '<cmd>CopilotChatTests<cr>', desc = 'Tests', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cf', '<cmd>CopilotChatRefactor<cr>', desc = 'Refactor', mode = { 'n', 'v' } },
|
||||
{ '<leader>Co', '<cmd>CopilotChatOptimize<cr>', desc = 'Optimize', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cd', '<cmd>CopilotChatDocs<cr>', desc = 'Docs', mode = { 'n', 'v' } },
|
||||
{ '<leader>Cp', '<cmd>CopilotChatToggle<cr>', desc = 'Toggle' },
|
||||
},
|
||||
build = 'make tiktoken',
|
||||
opts = {
|
||||
debug = false,
|
||||
show_help = true,
|
||||
prompts = {
|
||||
Explain = 'Please explain how the following code works.',
|
||||
Review = 'Please review the following code and provide suggestions for improvement.',
|
||||
Tests = 'Please explain how the selected code works, then generate unit tests for it.',
|
||||
Refactor = 'Please refactor the following code to improve its clarity and readability.',
|
||||
Optimize = 'Please optimize the following code for efficiency and performance.',
|
||||
Docs = 'Please generate documentation for the following code.',
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'zbirenbaum/copilot.lua', -- make sure copilot is available
|
||||
'zbirenbaum/copilot.lua',
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
-- GitHub Copilot base plugin
|
||||
return {
|
||||
'zbirenbaum/copilot.lua',
|
||||
cmd = 'Copilot',
|
||||
event = 'InsertEnter',
|
||||
event = 'VeryLazy', -- loads immediately after UI, not blocked on first keypress
|
||||
opts = {
|
||||
node_cmd = vim.fn.executable('node') == 1 and vim.fn.exepath('node') or 'node',
|
||||
suggestion = {
|
||||
auto_trigger = true,
|
||||
keymap = {
|
||||
accept_word = '<M-u>',
|
||||
accept_line = '<M-i>',
|
||||
-- next = '<M-[>',
|
||||
-- previous = '<M-]>',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
return {
|
||||
'kristijanhusak/vim-dadbod-ui',
|
||||
dependencies = {
|
||||
{ 'tpope/vim-dadbod', lazy = true },
|
||||
{ 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional
|
||||
},
|
||||
cmd = {
|
||||
'DBUI',
|
||||
'DBUIToggle',
|
||||
'DBUIAddConnection',
|
||||
'DBUIFindBuffer',
|
||||
},
|
||||
init = function()
|
||||
-- Your DBUI configuration
|
||||
vim.g.db_ui_use_nerd_fonts = 1
|
||||
end,
|
||||
-- 'kristijanhusak/vim-dadbod-ui',
|
||||
-- dependencies = {
|
||||
-- { 'tpope/vim-dadbod', lazy = true },
|
||||
-- { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional
|
||||
-- },
|
||||
-- cmd = {
|
||||
-- 'DBUI',
|
||||
-- 'DBUIToggle',
|
||||
-- 'DBUIAddConnection',
|
||||
-- 'DBUIFindBuffer',
|
||||
-- },
|
||||
-- init = function()
|
||||
-- -- Your DBUI configuration
|
||||
-- vim.g.db_ui_use_nerd_fonts = 1
|
||||
-- end,
|
||||
}
|
||||
|
|
|
|||
136
lua/custom/plugins/jupytext.lua
Normal file → Executable file
136
lua/custom/plugins/jupytext.lua
Normal file → Executable file
|
|
@ -1,70 +1,70 @@
|
|||
return {
|
||||
'goerz/jupytext.vim',
|
||||
lazy = false,
|
||||
config = function()
|
||||
vim.g.jupytext_fmt = 'py:percent'
|
||||
vim.g.jupytext_enable = 1
|
||||
vim.g.jupytext_pairing = 1
|
||||
|
||||
local jupytext_bin = vim.fn.exepath('jupytext')
|
||||
if jupytext_bin ~= nil and jupytext_bin ~= '' then
|
||||
vim.g.jupytext_command = jupytext_bin
|
||||
else
|
||||
local preferred_python3 = '/opt/homebrew/bin/python3'
|
||||
local python3_bin = preferred_python3
|
||||
if vim.fn.executable(preferred_python3) ~= 1 then
|
||||
python3_bin = vim.fn.exepath('python3')
|
||||
end
|
||||
|
||||
if python3_bin ~= nil and python3_bin ~= '' then
|
||||
vim.g.jupytext_command = python3_bin .. ' -m jupytext'
|
||||
else
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
'Jupytext: no `jupytext` or `python3` found in PATH. Install jupytext (e.g. `/opt/homebrew/bin/python3 -m pip install --user jupytext`) or set `vim.g.jupytext_command`.',
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
local jupytext_group = vim.api.nvim_create_augroup('custom_jupytext', { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
group = jupytext_group,
|
||||
pattern = '*.py',
|
||||
callback = function()
|
||||
local ipynb_file = vim.fn.expand('%:r') .. '.ipynb'
|
||||
if vim.fn.filereadable(ipynb_file) == 1 then
|
||||
vim.cmd('silent! Jupytext --sync')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
group = jupytext_group,
|
||||
pattern = '*.ipynb',
|
||||
callback = function()
|
||||
local py_file = vim.fn.expand('%:r') .. '.py'
|
||||
if vim.fn.filereadable(py_file) == 1 then
|
||||
vim.cmd('silent! Jupytext --sync')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufReadPost', 'BufNewFile' }, {
|
||||
group = jupytext_group,
|
||||
pattern = '*.ipynb',
|
||||
callback = function()
|
||||
local py_file = vim.fn.expand('%:r') .. '.py'
|
||||
if vim.fn.filereadable(py_file) == 0 then
|
||||
vim.cmd('silent! Jupytext --to py:percent')
|
||||
end
|
||||
|
||||
if vim.fn.filereadable(py_file) == 1 then
|
||||
vim.cmd('silent! edit ' .. vim.fn.fnameescape(py_file))
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
-- 'goerz/jupytext.vim',
|
||||
-- ft = { 'python', 'markdown' },
|
||||
-- config = function()
|
||||
-- vim.g.jupytext_fmt = 'py:percent'
|
||||
-- vim.g.jupytext_enable = 1
|
||||
-- vim.g.jupytext_pairing = 1
|
||||
--
|
||||
-- local jupytext_bin = vim.fn.exepath('jupytext')
|
||||
-- if jupytext_bin ~= nil and jupytext_bin ~= '' then
|
||||
-- vim.g.jupytext_command = jupytext_bin
|
||||
-- else
|
||||
-- local preferred_python3 = '/opt/homebrew/bin/python3'
|
||||
-- local python3_bin = preferred_python3
|
||||
-- if vim.fn.executable(preferred_python3) ~= 1 then
|
||||
-- python3_bin = vim.fn.exepath('python3')
|
||||
-- end
|
||||
--
|
||||
-- if python3_bin ~= nil and python3_bin ~= '' then
|
||||
-- vim.g.jupytext_command = python3_bin .. ' -m jupytext'
|
||||
-- else
|
||||
-- vim.schedule(function()
|
||||
-- vim.notify(
|
||||
-- 'Jupytext: no `jupytext` or `python3` found in PATH. Install jupytext (e.g. `/opt/homebrew/bin/python3 -m pip install --user jupytext`) or set `vim.g.jupytext_command`.',
|
||||
-- vim.log.levels.WARN
|
||||
-- )
|
||||
-- end)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- local jupytext_group = vim.api.nvim_create_augroup('custom_jupytext', { clear = true })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
-- group = jupytext_group,
|
||||
-- pattern = '*.py',
|
||||
-- callback = function()
|
||||
-- local ipynb_file = vim.fn.expand('%:r') .. '.ipynb'
|
||||
-- if vim.fn.filereadable(ipynb_file) == 1 then
|
||||
-- vim.cmd('silent! Jupytext --sync')
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
-- group = jupytext_group,
|
||||
-- pattern = '*.ipynb',
|
||||
-- callback = function()
|
||||
-- local py_file = vim.fn.expand('%:r') .. '.py'
|
||||
-- if vim.fn.filereadable(py_file) == 1 then
|
||||
-- vim.cmd('silent! Jupytext --sync')
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd({ 'BufReadPost', 'BufNewFile' }, {
|
||||
-- group = jupytext_group,
|
||||
-- pattern = '*.ipynb',
|
||||
-- callback = function()
|
||||
-- local py_file = vim.fn.expand('%:r') .. '.py'
|
||||
-- if vim.fn.filereadable(py_file) == 0 then
|
||||
-- vim.cmd('silent! Jupytext --to py:percent')
|
||||
-- end
|
||||
--
|
||||
-- if vim.fn.filereadable(py_file) == 1 then
|
||||
-- vim.cmd('silent! edit ' .. vim.fn.fnameescape(py_file))
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
return {
|
||||
'tanvirtin/monokai.nvim',
|
||||
priority = 1000,
|
||||
lazy = true,
|
||||
config = function() end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,5 @@ return {
|
|||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
opts = {
|
||||
-- Put any overrides here only if you need them.
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
return {
|
||||
'jpalardy/vim-slime',
|
||||
ft = { 'python' },
|
||||
keys = {
|
||||
{ '<leader>RC', '<cmd>SlimeConfig<cr>', desc = 'Slime Config' },
|
||||
{
|
||||
'<leader>RS',
|
||||
function()
|
||||
if require('custom.user.ipython_utils').is_ipython_open() then
|
||||
if vim.fn.mode() == 'v' then
|
||||
-- Visual mode mapping
|
||||
vim.cmd("<cmd><C-u>'<,'>SlimeSend<CR>")
|
||||
else
|
||||
-- Normal mode mapping: Execute the <Plug>SlimeSendCell and move to the next cell delimiter
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Plug>SlimeSendCell', true, true, true), 'm', true)
|
||||
vim.cmd('normal! /^# %%\\<CR>')
|
||||
end
|
||||
else
|
||||
vim.notify('No IPython REPL found. Open an IPython terminal first.', vim.log.levels.WARN)
|
||||
end
|
||||
end,
|
||||
mode = { 'n', 'v' },
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.g.slime_target = 'neovim'
|
||||
vim.g.slime_no_mappings = true
|
||||
end,
|
||||
config = function()
|
||||
-- Slime configuration
|
||||
vim.g.slime_cell_delimiter = '# %%'
|
||||
vim.g.slime_bracketed_paste = 1
|
||||
vim.g.slime_paste_file = os.getenv('HOME') .. '/.slime_paste'
|
||||
vim.g.slime_input_pid = false
|
||||
vim.g.slime_suggest_default = true
|
||||
vim.g.slime_menu_config = false
|
||||
vim.g.slime_neovim_ignore_unlisted = false
|
||||
vim.g.slime_python_ipython = 0
|
||||
end,
|
||||
-- 'jpalardy/vim-slime',
|
||||
-- ft = { 'python' },
|
||||
-- keys = {
|
||||
-- { '<leader>RC', '<cmd>SlimeConfig<cr>', desc = 'Slime Config' },
|
||||
-- {
|
||||
-- '<leader>RS',
|
||||
-- function()
|
||||
-- if require('custom.user.ipython_utils').is_ipython_open() then
|
||||
-- if vim.fn.mode() == 'v' then
|
||||
-- -- Visual mode mapping
|
||||
-- vim.cmd("<cmd><C-u>'<,'>SlimeSend<CR>")
|
||||
-- else
|
||||
-- -- Normal mode mapping: Execute the <Plug>SlimeSendCell and move to the next cell delimiter
|
||||
-- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Plug>SlimeSendCell', true, true, true), 'm', true)
|
||||
-- vim.cmd('normal! /^# %%\\<CR>')
|
||||
-- end
|
||||
-- else
|
||||
-- vim.notify('No IPython REPL found. Open an IPython terminal first.', vim.log.levels.WARN)
|
||||
-- end
|
||||
-- end,
|
||||
-- mode = { 'n', 'v' },
|
||||
-- },
|
||||
-- },
|
||||
-- init = function()
|
||||
-- vim.g.slime_target = 'neovim'
|
||||
-- vim.g.slime_no_mappings = true
|
||||
-- end,
|
||||
-- config = function()
|
||||
-- -- Slime configuration
|
||||
-- vim.g.slime_cell_delimiter = '# %%'
|
||||
-- vim.g.slime_bracketed_paste = 1
|
||||
-- vim.g.slime_paste_file = os.getenv('HOME') .. '/.slime_paste'
|
||||
-- vim.g.slime_input_pid = false
|
||||
-- vim.g.slime_suggest_default = true
|
||||
-- vim.g.slime_menu_config = false
|
||||
-- vim.g.slime_neovim_ignore_unlisted = false
|
||||
-- vim.g.slime_python_ipython = 0
|
||||
-- end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
return {
|
||||
'shaunsingh/solarized.nvim',
|
||||
event = 'VeryLazy',
|
||||
lazy = true,
|
||||
config = function()
|
||||
vim.g.solarized_variant = 'light'
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
return {
|
||||
'mbbill/undotree',
|
||||
cmd = 'UndotreeToggle',
|
||||
config = function()
|
||||
-- Set Undotree to open on the right side
|
||||
vim.g.undotree_WindowLayout = 4
|
||||
|
|
|
|||
|
|
@ -4,14 +4,13 @@ return {
|
|||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
-- Remove nvim-dap-python from here - it's defined separately
|
||||
},
|
||||
opts = {
|
||||
settings = {
|
||||
options = {
|
||||
activate_venv_in_terminal = true,
|
||||
notify_user_on_venv_activation = true,
|
||||
debug = true,
|
||||
notify_user_on_venv_activation = false, -- stops pulling nvim-notify at BufReadPre
|
||||
debug = false, -- also turn off debug in production, it's noisy and slow
|
||||
},
|
||||
search = {
|
||||
pyenv = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
return {
|
||||
'lervag/vimtex',
|
||||
ft = { 'tex', 'latex', 'cls', 'sty', 'bib' },
|
||||
lazy = false,
|
||||
init = function()
|
||||
-- macOS PDF viewer - Skim is better than Zathura on macOS
|
||||
vim.g.vimtex_view_method = 'skim'
|
||||
|
|
|
|||
Loading…
Reference in a new issue