Compare commits
19 Commits
57f27ce0e1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f42322984e | ||
|
|
1a6e75cace | ||
|
|
ee1e8110a1 | ||
|
|
5b68fda6bb | ||
|
|
3eb6fe5743 | ||
|
|
47a191c3c2 | ||
|
|
a61d76d248 | ||
|
|
71da2ca93d | ||
|
|
bb87a70cb2 | ||
|
|
07cf759d98 | ||
|
|
f89e212da7 | ||
|
|
92840f428e | ||
|
|
fc5cf565d6 | ||
|
|
5a9c788b08 | ||
|
|
3bb580b542 | ||
|
|
381fd0140c | ||
| 795bc171f7 | |||
|
|
a7cde0494f | ||
|
|
0b95d8f8e5 |
@@ -1,24 +1,30 @@
|
||||
-- This file needs to have same structure as nvconfig.lua
|
||||
-- This file needs to have same structure as nvconfig.lua
|
||||
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
|
||||
-- Please read that file to know all available options :(
|
||||
-- Please read that file to know all available options :(
|
||||
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
|
||||
M.base46 = {
|
||||
theme = "monekai",
|
||||
theme = "chadracula",
|
||||
transparency = false,
|
||||
|
||||
-- hl_override = {
|
||||
-- Comment = { italic = true },
|
||||
-- ["@comment"] = { italic = true },
|
||||
-- },
|
||||
hl_override = {
|
||||
Comment = { italic = true },
|
||||
["@comment"] = { italic = true },
|
||||
},
|
||||
}
|
||||
|
||||
-- M.nvdash = { load_on_startup = true }
|
||||
-- M.ui = {
|
||||
-- tabufline = {
|
||||
-- lazyload = false
|
||||
-- }
|
||||
--}
|
||||
M.nvdash = { load_on_startup = true }
|
||||
M.ui = {
|
||||
tabufline = {
|
||||
lazyload = false,
|
||||
},
|
||||
telescope = { style = "borderless" },
|
||||
statusline = {
|
||||
theme = "minimal",
|
||||
separator_style = "round",
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
local cc = require "codecompanion"
|
||||
cc.setup {
|
||||
adapters = {
|
||||
llama3 = function()
|
||||
return require("codecompanion.adapters").extend("ollama", {
|
||||
name = "llama3",
|
||||
schema = {
|
||||
model = {
|
||||
default = "llama3.1:latest",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
mistral = function()
|
||||
return require("codecompanion.adapters").extend("ollama", {
|
||||
name = "mistral",
|
||||
schema = {
|
||||
model = {
|
||||
default = "mistral:latest",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
qwen = function()
|
||||
return require("codecompanion.adapters").extend("ollama", {
|
||||
name = "qwen",
|
||||
schema = {
|
||||
model = {
|
||||
default = "qwen2.5-coder",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "copilot",
|
||||
},
|
||||
inline = {
|
||||
adapter = "copilot",
|
||||
},
|
||||
},
|
||||
display = {
|
||||
-- diff = {
|
||||
-- provider = "mini_diff",
|
||||
-- },
|
||||
action_palette = {
|
||||
provider = "mini_pick",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
log_level = "DEBUG",
|
||||
},
|
||||
}
|
||||
@@ -4,8 +4,9 @@ local options = {
|
||||
-- css = { "prettier" },
|
||||
-- html = { "prettier" },
|
||||
-- python = { "isort", "black" },
|
||||
python = { "ruff" },
|
||||
python = { "isort", "ruff_fix", "ruff_format" },
|
||||
yaml = { "prettier" },
|
||||
latex = { "bibtex-tidy", "tex-fmt", lsp_format = "fallback" }
|
||||
},
|
||||
|
||||
-- format_on_save = {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
-- load defaults i.e lua_lsp
|
||||
require("nvchad.configs.lspconfig").defaults()
|
||||
|
||||
local nvlsp = require "nvchad.configs.lspconfig"
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
nvlsp.defaults()
|
||||
|
||||
-- EXAMPLE
|
||||
local servers = { "html", "cssls", "ruff", "jedi_language_server", "yls", "lua_ls" }
|
||||
local nvlsp = require "nvchad.configs.lspconfig"
|
||||
local servers = { "html", "cssls", "ruff", "jedi_language_server", "yls", "lua_ls", "texlab" }
|
||||
|
||||
-- lsps with default config
|
||||
for _, lsp in ipairs(servers) do
|
||||
@@ -16,12 +16,41 @@ for _, lsp in ipairs(servers) do
|
||||
}
|
||||
end
|
||||
|
||||
-- configuring single server, example: typescript
|
||||
-- lspconfig.ts_ls.setup {
|
||||
-- on_attach = nvlsp.on_attach,
|
||||
-- on_init = nvlsp.on_init,
|
||||
-- capabilities = nvlsp.capabilities,
|
||||
-- }
|
||||
-- lspconfig.texlab.setup({
|
||||
-- settings = {
|
||||
-- latex = {
|
||||
-- build = {
|
||||
-- executable = "latexmk",
|
||||
-- args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
|
||||
-- onSave = true,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
|
||||
-- Set up LTeX separately
|
||||
lspconfig.ltex.setup {
|
||||
on_init = nvlsp.on_init,
|
||||
capabilities = nvlsp.capabilities,
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
-- Run NvChad's on_attach for your usual LSP keymaps
|
||||
nvlsp.on_attach(client, bufnr)
|
||||
|
||||
require("ltex_extra").setup {
|
||||
load_langs = { "en-GB", "en-US", "nb" },
|
||||
init_check = true,
|
||||
path = vim.fn.expand("~/.local/share/ltex"), -- where to store language dicts
|
||||
}
|
||||
end,
|
||||
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "en-US",
|
||||
additionalLanguages = { "nb" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.ruff.setup({
|
||||
init_options = {
|
||||
@@ -33,7 +62,6 @@ lspconfig.ruff.setup({
|
||||
ignore = {"F401", "W191"},
|
||||
preview = true,
|
||||
}
|
||||
-- Ruff language server settings go here
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
25
lua/custom/snippets/tex.lua
Normal file
25
lua/custom/snippets/tex.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local ls = require "luasnip"
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
|
||||
return {
|
||||
-- Italic snippet: type "it" in insert mode and expand to \textit{...}
|
||||
s({trig="it", desc="Insert italic text"}, {
|
||||
t "\\textit{",
|
||||
i(1, "text"),
|
||||
t "}",
|
||||
}),
|
||||
-- Bold snippet example:
|
||||
s({trig="bf", desc="Insert bold text"}, {
|
||||
t "\\textbf{",
|
||||
i(1, "text"),
|
||||
t "}",
|
||||
}),
|
||||
-- Emph snippet example:
|
||||
s({trig="em", desc="Insert emphasized text"}, {
|
||||
t "\\emph{",
|
||||
i(1, "text"),
|
||||
t "}",
|
||||
}),
|
||||
}
|
||||
146
lua/mappings.lua
146
lua/mappings.lua
@@ -7,12 +7,13 @@ local map = vim.keymap.set
|
||||
local g = vim.g
|
||||
local diag = vim.diagnostic
|
||||
|
||||
-- General mappings
|
||||
map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||
map("i", "jk", "<ESC>")
|
||||
|
||||
map("n", "<leader>ca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end, { desc = "LSP code action" })
|
||||
map("n", "j", "gj", { desc = "Move down" })
|
||||
map("n", "k", "gk", { desc = "Move up" })
|
||||
|
||||
map("n", "<leader>tt", function()
|
||||
require("base46").toggle_transparency()
|
||||
end, { desc = "Toggle transparency" })
|
||||
@@ -47,6 +48,7 @@ function Toggle_diagnostics()
|
||||
end
|
||||
map("n", "<leader>lt", Toggle_diagnostics, { noremap = true, silent = true, desc = "Toggle vim diagnostics" })
|
||||
|
||||
-- Presistence mappings
|
||||
-- select a session to load
|
||||
map("n", "<leader>qs", function()
|
||||
require("persistence").select()
|
||||
@@ -62,80 +64,86 @@ map("n", "<leader>qd", function()
|
||||
require("persistence").stop()
|
||||
end, { desc = "Stop persistence" })
|
||||
|
||||
-- debug related stuff
|
||||
local dap = require "dap"
|
||||
-- mappings for wiki.vim
|
||||
map("n", "<leader>iw", function ()
|
||||
require("telescope.builtin").live_grep({
|
||||
prompt_title = "Search Wiki",
|
||||
cwd = vim.fn.expand("~/wiki"),
|
||||
})
|
||||
end, { desc = "Search Wiki" })
|
||||
|
||||
map("n", "<leader>db", function()
|
||||
dap.toggle_breakpoint()
|
||||
end, { desc = "Toggle breakpoint" })
|
||||
map("n", "<leader>jn", "<cmd>WikiJournalNext<cr>", { desc = "Next Journal" })
|
||||
map("n", "<leader>jp", "<cmd>WikiJournalPrev<cr>", { desc = "Previous Journal" })
|
||||
|
||||
map("n", "<leader>dc", function()
|
||||
dap.continue()
|
||||
end, { desc = "Continue" })
|
||||
|
||||
map("n", "<leader>dr", function()
|
||||
dap.repl.open()
|
||||
end, { desc = "Open REPL" })
|
||||
-- Mappings for Man using ripgrep
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local previewers = require("telescope.previewers")
|
||||
|
||||
map("n", "<leader>ds", function()
|
||||
dap.step_over()
|
||||
end, { desc = "Step over" })
|
||||
-- Define a custom previewer that runs 'man' in a terminal job:
|
||||
local man_previewer = previewers.new_termopen_previewer({
|
||||
get_command = function(entry)
|
||||
-- 'entry.value' will be the man-topic, e.g. "ls"
|
||||
if not entry or not entry.value then
|
||||
return { "echo", "" }
|
||||
end
|
||||
-- The pager string (col -bx | bat -l man -p) must be passed as one argument
|
||||
-- so that 'man' interprets it as a shell command for the pager:
|
||||
return {
|
||||
"man",
|
||||
"-P", "col -bx | bat -l man -p", -- all as a single argument to -P
|
||||
entry.value
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
map("n", "<leader>di", function()
|
||||
dap.step_into()
|
||||
end, { desc = "Step into" })
|
||||
-- Create a mapping that invokes Telescope with our custom previewer
|
||||
map("n", "<leader>mp", function()
|
||||
require("telescope.builtin").find_files({
|
||||
prompt_title = "Man Pages",
|
||||
find_command = {
|
||||
"bash", "-c",
|
||||
table.concat({
|
||||
-- Pipeline:
|
||||
-- 1) 'rg --files /usr/share/man'
|
||||
-- 2) strip directory paths (xargs basename)
|
||||
-- 3) remove trailing .x or .x.gz (sed)
|
||||
-- 4) sort + unique
|
||||
"rg --files /usr/share/man",
|
||||
"| xargs basename",
|
||||
"| sed 's/\\.[^.]*$//'",
|
||||
"| sort -u",
|
||||
}, " ")
|
||||
},
|
||||
-- Provide our custom previewer
|
||||
previewer = man_previewer,
|
||||
|
||||
map("n", "<leader>do", function()
|
||||
dap.step_out()
|
||||
end, { desc = "Step out" })
|
||||
-- 3) attach_mappings() lets us override what happens when we press <CR>
|
||||
attach_mappings = function(prompt_bufnr, map_telescope)
|
||||
local function open_man_page()
|
||||
local selection = action_state.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
-- Actually open the man page inside Neovim:
|
||||
vim.cmd("Man " .. selection.value)
|
||||
end
|
||||
|
||||
map("n", "<leader>dT", function()
|
||||
dap.terminate()
|
||||
end, { desc = "Terminate" })
|
||||
-- Bind <CR> in insert + normal mode to open the man page
|
||||
map_telescope("i", "<CR>", open_man_page)
|
||||
map_telescope("n", "<CR>", open_man_page)
|
||||
|
||||
map("n", "<leader>dl", function()
|
||||
dap.run_last()
|
||||
end, { desc = "Run Last" })
|
||||
return true
|
||||
end,
|
||||
})
|
||||
end, { desc = "Search manpages" })
|
||||
|
||||
map("n", "<leader>dC", function()
|
||||
dap.run_to_cursor()
|
||||
end, { desc = "Run to Cursor" })
|
||||
-- Mappings for Git stuff
|
||||
|
||||
-- dapui
|
||||
|
||||
local dapui = require "dapui"
|
||||
local widgets = require "dap.ui.widgets"
|
||||
|
||||
map("n", "<leader>du", function()
|
||||
dapui.toggle()
|
||||
end, { desc = "Toggle UI" })
|
||||
|
||||
map({ "n", "v" }, "<Leader>dh", function()
|
||||
widgets.hover()
|
||||
end, { desc = "Hover" })
|
||||
|
||||
map({ "n", "v" }, "<Leader>dp", function()
|
||||
widgets.preview()
|
||||
end, { desc = "Preview" })
|
||||
|
||||
map("n", "<Leader>df", function()
|
||||
widgets.centered_float(widgets.frames)
|
||||
end, { desc = "Frames" })
|
||||
|
||||
map("n", "<Leader>ds", function()
|
||||
widgets.centered_float(widgets.scopes)
|
||||
end, { desc = "Scopes" })
|
||||
|
||||
-- CodeCompletion mappings
|
||||
|
||||
map({ "n", "v" }, "<C-a>", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true, desc = "Code Actions" })
|
||||
map({ "n", "v" }, "<Leader>a", "<cmd>CodeCompanionChat Toggle<cr>", { noremap = true, silent = true, desc = "Code Chat" })
|
||||
map("v", "ga", "<cmd>CodeCompanionChat Add<cr>", { noremap = true, silent = true, desc = "Code Chat Add Visual" })
|
||||
map("v", "<Leader>ce", function()
|
||||
require("codecompanion").prompt("explain")
|
||||
end, { noremap = true, silent = true, desc = "Explain Selection" }
|
||||
)
|
||||
|
||||
-- Expand 'cc' into 'CodeCompanion' in the command line
|
||||
vim.cmd([[cab cc CodeCompanion]])
|
||||
-- Git blame
|
||||
map("v", "<leader>gb", "<cmd>lua require('gitsigns').blame_line()<cr>", { desc = "Git Blame line" })
|
||||
map("n", "<leader>gb", "<cmd>lua require('gitsigns').blame()<cr>", { desc = "Git Blame" })
|
||||
|
||||
-- Git diffview
|
||||
map("n", "<leader>gd", "<cmd>DiffviewOpen<cr>", { desc = "Git Diff File" })
|
||||
map("n", "<leader>gD", "<cmd>DiffviewOpen --cached<cr>", { desc = "Git Diff Staged" })
|
||||
map("n", "<leader>gh", "<cmd>DiffviewFileHistory<cr>", { desc = "Git File History" })
|
||||
|
||||
@@ -1,14 +1,27 @@
|
||||
require "nvchad.options"
|
||||
|
||||
-- add yours here!
|
||||
-- Set global options
|
||||
vim.o.cursorlineopt ='both' -- to enable cursorline!
|
||||
vim.o.scrolloff = 10
|
||||
vim.opt.relativenumber = true
|
||||
vim.g.wiki_root = "~/wiki"
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
|
||||
local o = vim.o
|
||||
local opt = vim.opt
|
||||
-- o.cursorlineopt ='both' -- to enable cursorline!
|
||||
-- Set vimtex options
|
||||
vim.g.tex_flavour = "latex"
|
||||
vim.g.vimtex_view_method = "skim"
|
||||
vim.g.vimtex_view_skim_reading_bar = 1
|
||||
vim.g.vimtex_view_skim_sync = 1
|
||||
-- vim.g.vimtex_quickfix_mode = 0
|
||||
vim.g.vimtex_compiler_method = "latexmk"
|
||||
vim.g.vimtex_mappings_prefix = "å"
|
||||
vim.g.complete_close_brackets = 1
|
||||
|
||||
o.scrolloff = 10
|
||||
opt.relativenumber = true
|
||||
-- Set luasnip path
|
||||
local snippets = require "luasnip.loaders.from_lua"
|
||||
snippets.load({ paths = "~/.config/nvim/lua/custom/snippets" })
|
||||
|
||||
-- Set window-local options
|
||||
local highlight_group = vim.api.nvim_create_augroup("yankhighlight", { clear = true })
|
||||
vim.api.nvim_create_autocmd("textyankpost", {
|
||||
callback = function()
|
||||
@@ -18,11 +31,26 @@ vim.api.nvim_create_autocmd("textyankpost", {
|
||||
pattern = "*",
|
||||
})
|
||||
|
||||
require "dap"
|
||||
-- Surround
|
||||
|
||||
local sign = vim.fn.sign_define
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "tex",
|
||||
callback = function()
|
||||
vim.b.surround_105 = "\\textit{" .. "\n" .. "}"
|
||||
vim.b.surround_101 = "\\emph{" .. "\n" .. "}"
|
||||
vim.b.surround_102 = "\\textbf{" .. "\n" .. "}"
|
||||
end,
|
||||
})
|
||||
|
||||
sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
|
||||
sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
|
||||
sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
|
||||
sign('DapStopped', { text='', texthl='DapStopped', linehl='DapStopped', numhl= 'DapStopped' })
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "tex",
|
||||
callback = function()
|
||||
-- Set a maximum line width of 88 characters
|
||||
vim.bo.textwidth = 88
|
||||
-- Ensure 'formatoptions' includes the 't' flag for text wrapping
|
||||
vim.bo.formatoptions = vim.bo.formatoptions .. "t"
|
||||
-- Disable conform’s formatter so that gq uses Vim’s native formatter
|
||||
vim.bo.formatexpr = ""
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -16,58 +16,13 @@ return {
|
||||
},
|
||||
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
lazy = true,
|
||||
"lervag/wiki.vim",
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
opts = {
|
||||
handlers = {},
|
||||
automatic_installations = {
|
||||
exclude = {
|
||||
"python",
|
||||
},
|
||||
},
|
||||
ensure_installed = {
|
||||
"python",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"mfussenegger/nvim-dap-python",
|
||||
lazy = true,
|
||||
config = function()
|
||||
local python = vim.fn.expand "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
|
||||
require("dap-python").setup(python)
|
||||
end,
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
config = true,
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
config = true,
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"mfussenegger/nvim-dap-python",
|
||||
"nvim-neotest/nvim-nio",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
},
|
||||
"lervag/vimtex",
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
{
|
||||
@@ -87,6 +42,10 @@ return {
|
||||
"lua",
|
||||
"python",
|
||||
"markdown",
|
||||
"latex",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -112,11 +71,6 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre", -- this will only start session saving when an actual file was opened
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvcommunity",
|
||||
{ import = "nvcommunity.git.diffview" },
|
||||
@@ -199,19 +153,6 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"olimorris/codecompanion.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require "configs.codecompanion"
|
||||
end,
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
-- Install a plugin
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
event = "InsertEnter",
|
||||
@@ -219,4 +160,33 @@ return {
|
||||
require("better_escape").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"aznhe21/actions-preview.nvim",
|
||||
keys = {
|
||||
{
|
||||
"<leader>gf",
|
||||
function()
|
||||
require("actions-preview").code_actions()
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Show code actions",
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("actions-preview").setup {
|
||||
highlight_command = {
|
||||
require("actions-preview.highlight").delta(),
|
||||
},
|
||||
}
|
||||
end,
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
{
|
||||
"barreiroleo/ltex-extra.nvim",
|
||||
ft = { "markdown", "tex" },
|
||||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user