mirror of
https://github.com/Derisis13/dotfiles.git
synced 2025-12-07 03:42:50 +01:00
feat(nvim): added molten.nvim for jupyter-like behavior
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local options = {
|
||||
|
||||
base46 = {
|
||||
theme = "catppuccin", -- default theme
|
||||
theme = "chadracula-evondev", -- default theme
|
||||
hl_add = {},
|
||||
hl_override = {},
|
||||
integrations = {},
|
||||
@@ -11,7 +11,7 @@ local options = {
|
||||
},
|
||||
},
|
||||
transparency = true,
|
||||
theme_toggle = { "catppuccin", "one_light" },
|
||||
theme_toggle = { "chadracula-evondev", "one_light" },
|
||||
},
|
||||
|
||||
ui = {
|
||||
|
||||
@@ -34,7 +34,7 @@ return {
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
-- "rplugin",
|
||||
"syntax",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
|
||||
@@ -97,3 +97,22 @@ end, { desc = "Gitsigns Blame line" })
|
||||
map("n", "<leader>td", function()
|
||||
require("gitsigns").toggle_deleted()
|
||||
end, { desc = "Gitsigns Toggle deleted" })
|
||||
|
||||
-- molten related mappings
|
||||
map("n", "<localleader>ip", function()
|
||||
local venv = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX")
|
||||
if venv ~= nil then
|
||||
-- in the form of /home/ha5pls/.local/state/virtualenvs/VENV_NAME
|
||||
venv = string.match(venv, "/.+/(.+)")
|
||||
vim.cmd(("MoltenInit %s"):format(venv))
|
||||
else
|
||||
vim.cmd("MoltenInit python3")
|
||||
end
|
||||
end, { desc = "Initialize Molten for python3" })
|
||||
map("n", "<leader>mi", ":MoltenInit<CR>")
|
||||
map("n", "<leader>me", ":MoltenEvaluateOperator<CR>")
|
||||
map("n", "<leader>rr", ":MoltenReevaluateCell<CR>")
|
||||
map("v", "<leader>r", ":<C-u>MoltenEvaluateVisual<CR>gv")
|
||||
map("n", "<leader>os", ":noautocmd MoltenEnterOutput<CR>")
|
||||
map("n", "<leader>oh", ":MoltenHideOutput<CR>")
|
||||
map("n", "<leader>md", ":MoltenDelete<CR>")
|
||||
|
||||
@@ -15,15 +15,15 @@ vim.filetype.add({
|
||||
})
|
||||
-- Hyprlang LSP
|
||||
autocmd({'BufEnter', 'BufWinEnter'}, {
|
||||
pattern = {"*.hl", "hypr*.conf"},
|
||||
callback = function(event)
|
||||
print(string.format("starting hyprls for %s", vim.inspect(event)))
|
||||
vim.lsp.start {
|
||||
name = "hyprlang",
|
||||
cmd = {"hyprls"},
|
||||
root_dir = vim.fn.getcwd(),
|
||||
}
|
||||
end
|
||||
pattern = {"*.hl", "hypr*.conf"},
|
||||
callback = function(event)
|
||||
print(string.format("starting hyprls for %s", vim.inspect(event)))
|
||||
vim.lsp.start {
|
||||
name = "hyprlang",
|
||||
cmd = {"hyprls"},
|
||||
root_dir = vim.fn.getcwd(),
|
||||
}
|
||||
end
|
||||
})
|
||||
|
||||
vim.g.vscode_snippets_path = "~/.config/nvim/snippets"
|
||||
@@ -31,3 +31,16 @@ vim.opt.relativenumber = true
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
-- use prepared venv, mostly for molten
|
||||
local enable_providers = {
|
||||
"python3_provider",
|
||||
-- and so on
|
||||
}
|
||||
|
||||
for _, plugin in pairs(enable_providers) do
|
||||
vim.g["loaded_" .. plugin] = nil
|
||||
vim.cmd("runtime " .. plugin)
|
||||
end
|
||||
|
||||
vim.g.python3_host_prog = vim.fn.expand(os.getenv("XDG_STATE_HOME") .. "/virtualenvs/neovim/bin/python3")
|
||||
|
||||
@@ -1,110 +1,145 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
-- event = 'BufWritePre', -- uncomment for format on save
|
||||
config = function()
|
||||
require "configs.conform"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require "nvchad.configs.lspconfig"
|
||||
require "configs.lspconfig"
|
||||
end, -- Override to setup mason-lspconfig
|
||||
},
|
||||
|
||||
-- override plugin configs
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
|
||||
-- python
|
||||
"pyright@1.1.351", -- newer versions have node skill issue
|
||||
"autopep8",
|
||||
|
||||
-- latex/markdown stuff
|
||||
"ltex-ls",
|
||||
"bibtex-tidy",
|
||||
|
||||
-- shell
|
||||
"shellcheck",
|
||||
|
||||
-- Hyprlang
|
||||
"hyrpls",
|
||||
|
||||
-- hdl
|
||||
"rust_hdl",
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
-- event = 'BufWritePre', -- uncomment for format on save
|
||||
config = function()
|
||||
require "configs.conform"
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"c",
|
||||
"cpp",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"yaml",
|
||||
"python",
|
||||
"latex",
|
||||
"vhdl",
|
||||
"hyprlang",
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
-- disable = {
|
||||
-- "python"
|
||||
-- },
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require "nvchad.configs.lspconfig"
|
||||
require "configs.lspconfig"
|
||||
end, -- Override to setup mason-lspconfig
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = {
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
-- override plugin configs
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
|
||||
-- python
|
||||
"pyright@1.1.351", -- newer versions have node skill issue
|
||||
"autopep8",
|
||||
|
||||
-- latex/markdown stuff
|
||||
"ltex-ls",
|
||||
"bibtex-tidy",
|
||||
|
||||
-- shell
|
||||
"shellcheck",
|
||||
|
||||
-- Hyprlang
|
||||
"hyrpls",
|
||||
|
||||
-- hdl
|
||||
"rust_hdl",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
-- for users those who want auto-save conform + lazyloading!
|
||||
event = "BufWritePre",
|
||||
config = function()
|
||||
require "configs.conform"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"c",
|
||||
"cpp",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"yaml",
|
||||
"python",
|
||||
"latex",
|
||||
"vhdl",
|
||||
"hyprlang",
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
-- disable = {
|
||||
-- "python"
|
||||
-- },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"godlygeek/tabular",
|
||||
-- ft = "vhdl", -- temporary solution, but I only need it for vhdl. To be replaced with a real formatter long-term
|
||||
cmd = { "GTabularize", "Tabularize" },
|
||||
-- lazy = false
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = {
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
-- for users those who want auto-save conform + lazyloading!
|
||||
event = "BufWritePre",
|
||||
config = function()
|
||||
require "configs.conform"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"godlygeek/tabular",
|
||||
-- ft = "vhdl", -- temporary solution, but I only need it for vhdl. To be replaced with a real formatter long-term
|
||||
cmd = { "GTabularize", "Tabularize" },
|
||||
},
|
||||
|
||||
{
|
||||
"benlubas/molten-nvim",
|
||||
-- version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes
|
||||
dependencies = { "3rd/image.nvim" },
|
||||
build = ":UpdateRemotePlugins",
|
||||
init = function()
|
||||
vim.g.molten_image_provider = "image.nvim"
|
||||
vim.g.molten_use_border_highlights = true
|
||||
end,
|
||||
-- lazy = false
|
||||
},
|
||||
{
|
||||
-- see the image.nvim readme for more information about configuring this plugin
|
||||
"3rd/image.nvim",
|
||||
opts = {
|
||||
backend = "kitty", -- whatever backend you would like to use
|
||||
max_width = 100,
|
||||
max_height = 12,
|
||||
max_height_window_percentage = math.huge,
|
||||
max_width_window_percentage = math.huge,
|
||||
window_overlap_clear_enabled = true, -- toggles images when windows are overlapped
|
||||
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = false,
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
only_render_image_at_cursor_mode = "popup",
|
||||
floating_windows = false, -- if true, images will be rendered in floating markdown windows
|
||||
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
|
||||
},
|
||||
}, -- do whatever you want with image.nvim's integrations
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user