Update
This commit is contained in:
@@ -5,3 +5,11 @@
|
||||
if vim.g.neovide then
|
||||
vim.cmd([[ cd $HOME ]])
|
||||
end
|
||||
|
||||
-- Disable spell checking for markdown and text files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "markdown", "text", "tex" },
|
||||
callback = function()
|
||||
vim.opt_local.spell = false
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
|
||||
vim.lsp.log.set_level(vim.log.levels.OFF)
|
||||
vim.opt.timeoutlen = 150
|
||||
vim.opt.spell = true
|
||||
vim.opt.spelllang = { "en", "cjk" }
|
||||
@@ -10,13 +11,15 @@ vim.opt.backup = false
|
||||
vim.g.maplocalleader = "\\"
|
||||
vim.g.autoformat = false
|
||||
|
||||
vim.g.node_host_prog = "/opt/homebrew/bin/neovim-node-host"
|
||||
local indent = 2
|
||||
-- vim.opt.expandtab = true -- Use spaces instead of tabs
|
||||
vim.opt.softtabstop = indent -- Number of spaces that a <Tab> counts for while performing editing operations
|
||||
vim.opt.tabstop = indent -- Number of spaces tabs count for
|
||||
vim.opt.shiftwidth = indent -- Size of an indent
|
||||
|
||||
vim.g.node_host_prog = "/opt/homebrew/bin/neovim-node-host"
|
||||
-- vim.opt.expandtab = true -- Use spaces instead of tabs
|
||||
|
||||
if vim.g.neovide then
|
||||
vim.o.guifont = "Maple Mono:h16"
|
||||
vim.g.neovide_scale_factor = 1.0
|
||||
|
||||
@@ -50,6 +50,7 @@ return {
|
||||
python = "python -u",
|
||||
sh = "bash",
|
||||
rust = "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
|
||||
r = "cd $dir && R < $filename --no-save",
|
||||
},
|
||||
project_path = "", -- No default path defined
|
||||
project = {},
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
return {
|
||||
-- {
|
||||
-- "zbirenbaum/copilot.lua",
|
||||
-- opts = {
|
||||
-- copilot_model = "claude-3.7-sonnet",
|
||||
-- suggestion = {
|
||||
-- keymap = {
|
||||
-- accept = "<D-l>",
|
||||
-- next = "<D-]>",
|
||||
-- prev = "<D-[>",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
opts = {
|
||||
copilot_model = "claude-opus-4",
|
||||
suggestion = {
|
||||
keymap = {
|
||||
accept = "<D-l>",
|
||||
next = "<D-]>",
|
||||
prev = "<D-[>",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
tinymist = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function()
|
||||
return {
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "latex" },
|
||||
additional_vim_regex_highlighting = { "latex", "markdown" },
|
||||
},
|
||||
indent = { enable = true, disable = { "python" } },
|
||||
context_commentstring = { enable = true, enable_autocmd = false },
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"html",
|
||||
"json",
|
||||
"lua",
|
||||
"luap",
|
||||
"markdown",
|
||||
"make",
|
||||
"markdown_inline",
|
||||
"scala",
|
||||
"python",
|
||||
"query",
|
||||
"toml",
|
||||
"regex",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<cr>",
|
||||
node_incremental = "<cr>",
|
||||
scope_incremental = "\\",
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
rainbow = {
|
||||
enable = true,
|
||||
-- list of languages you want to disable the plugin for
|
||||
disable = { "jsx", "cpp" },
|
||||
-- Which query to use for finding delimiters
|
||||
query = "rainbow-parens",
|
||||
-- Highlight the entire buffer all at once
|
||||
},
|
||||
|
||||
keys = function()
|
||||
return {
|
||||
{ "<cr>", desc = "Increment selection" },
|
||||
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,36 +1,40 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
-- commit = "a1332a7925e5b3234a94480f77713d396ca895c1",
|
||||
opts = function()
|
||||
local parsers = {
|
||||
"typst",
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"html",
|
||||
"json",
|
||||
"lua",
|
||||
"luap",
|
||||
"markdown",
|
||||
"make",
|
||||
"markdown_inline",
|
||||
"scala",
|
||||
"python",
|
||||
"latex",
|
||||
"query",
|
||||
"toml",
|
||||
"regex",
|
||||
"vim",
|
||||
"yaml",
|
||||
}
|
||||
table.insert(parsers, "latex")
|
||||
return {
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "latex" },
|
||||
disable = { "tex, latex" },
|
||||
-- additional_vim_regex_highlighting = { "markdown" },
|
||||
},
|
||||
-- ignore_install = { "latex" },
|
||||
indent = { enable = true, disable = { "python" } },
|
||||
context_commentstring = { enable = true, enable_autocmd = false },
|
||||
ensure_installed = {
|
||||
"latex",
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"html",
|
||||
"json",
|
||||
"lua",
|
||||
"luap",
|
||||
"markdown",
|
||||
"make",
|
||||
"markdown_inline",
|
||||
"scala",
|
||||
"python",
|
||||
"query",
|
||||
"toml",
|
||||
"regex",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
ensure_installed = parsers,
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
|
||||
@@ -5,7 +5,7 @@ return {
|
||||
init = function()
|
||||
vim.g.vimtex_syntax_conceal_disable = 1
|
||||
vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover
|
||||
vim.g.vimtex_view_method = "sioyek"
|
||||
vim.g.vimtex_view_method = "skim"
|
||||
-- vim.g.vimtex_view_general_viewer = "open -a UPDF"
|
||||
vim.g.vimtex_view_skim_sync = 1
|
||||
vim.g.vimtex_compiler_silent = 1
|
||||
|
||||
16
lua/plugins/lang/typst.lua
Normal file
16
lua/plugins/lang/typst.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
{
|
||||
"chomosuke/typst-preview.nvim",
|
||||
ft = "typst",
|
||||
version = "1.*",
|
||||
opts = {
|
||||
dependencies_bin = {
|
||||
["tinymist"] = "tinymist",
|
||||
},
|
||||
-- open_cmd = "brave %s --class typst-preview",
|
||||
},
|
||||
keys = {
|
||||
{ "<localleader>lp", "<cmd>TypstPreview<cr>", desc = "Open Typst Preview" },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
return {
|
||||
{ "mason-org/mason.nvim", version = "^1.0.0" },
|
||||
{ "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
|
||||
-- { "mason-org/mason.nvim", version = "^1.0.0" },
|
||||
-- { "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
return {
|
||||
-- Lazy
|
||||
{
|
||||
"maxmx03/solarized.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
---@type solarized.config
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
vim.o.termguicolors = true
|
||||
vim.o.background = "light"
|
||||
require("solarized").setup(opts)
|
||||
vim.cmd.colorscheme("solarized")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
@@ -13,7 +26,7 @@ return {
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "catppuccin",
|
||||
colorscheme = "solarized",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ local MATH_NODES = {
|
||||
math_environment = true,
|
||||
}
|
||||
|
||||
local ts_utils = require("nvim-treesitter.ts_utils")
|
||||
|
||||
M.in_env_md = function(env)
|
||||
local node = ts_utils.get_node_at_cursor()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local node = vim.treesitter.get_node({ bufnr = 0, pos = { row - 1, col } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
while node do
|
||||
if node:type() == "generic_environment" then
|
||||
@@ -29,12 +28,56 @@ M.in_env = function(env)
|
||||
return pos[1] ~= 0 or pos[2] ~= 0
|
||||
end
|
||||
|
||||
-- For markdown
|
||||
M.in_mathzone_md = function()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local node = vim.treesitter.get_node({ bufnr = 0, pos = { row - 1, col } })
|
||||
while node do
|
||||
if MATH_NODES[node:type()] then
|
||||
return true
|
||||
end
|
||||
node = node:parent()
|
||||
end
|
||||
return false
|
||||
end
|
||||
M.in_text_md = function()
|
||||
return not M.in_mathzone_md()
|
||||
end
|
||||
|
||||
-- For typst
|
||||
M.in_mathzone_typ = function()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local node = vim.treesitter.get_node({ bufnr = 0, pos = { row - 1, col } })
|
||||
while node do
|
||||
if node:type() == "math" then
|
||||
return true
|
||||
end
|
||||
node = node:parent()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
M.in_mathzone_tex = function()
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local node = vim.treesitter.get_node({ bufnr = 0, pos = { row - 1, col } })
|
||||
while node do
|
||||
if MATH_NODES[node:type()] then
|
||||
return true
|
||||
end
|
||||
node = node:parent()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
M.in_mathzone = function()
|
||||
local ft = vim.bo.filetype
|
||||
if ft == "tex" then
|
||||
return vim.api.nvim_eval("vimtex#syntax#in_mathzone()") == 1
|
||||
return M.in_mathzone_tex()
|
||||
elseif ft == "markdown" then
|
||||
return M.in_mathzone_md()
|
||||
elseif ft == "typst" then
|
||||
return M.in_mathzone_typ()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -58,21 +101,6 @@ M.in_algo = function()
|
||||
return M.in_env("algorithmic")
|
||||
end
|
||||
|
||||
-- For markdown
|
||||
M.in_mathzone_md = function()
|
||||
local node = ts_utils.get_node_at_cursor()
|
||||
while node do
|
||||
if MATH_NODES[node:type()] then
|
||||
return true
|
||||
end
|
||||
node = node:parent()
|
||||
end
|
||||
return false
|
||||
end
|
||||
M.in_text_md = function()
|
||||
return not M.in_mathzone_md()
|
||||
end
|
||||
|
||||
-- M.clean = function()
|
||||
-- local current_dir = vim.fn.expand("%:p:h")
|
||||
-- local file_types = { "aux", "log", "out", "fls", "fdb_latexmk", "bcf", "run.xml", "toc", "DS_Store", "bak*", "dvi" }
|
||||
|
||||
Reference in New Issue
Block a user