pull/339/head
Omixxx 2 years ago
parent 81c3cd2ac0
commit 0ae1cf0a07

@ -0,0 +1,644 @@
global !p
def math():
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
def comment():
return vim.eval('vimtex#syntax#in_comment()') == '1'
def env(name):
[x,y] = vim.eval("vimtex#env#is_inside('" + name + "')")
return x != '0' and y != '0'
endglobal
snippet template "Basic template" b
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[dutch]{babel}
\usepackage{amsmath, amssymb}
% figure support
\usepackage{import}
\usepackage{xifthen}
\pdfminorversion=7
\usepackage{pdfpages}
\usepackage{transparent}
\newcommand{\incfig}[1]{%
\def\svgwidth{\columnwidth}
\import{./figures/}{#1.pdf_tex}
}
\pdfsuppresswarningpagegroup=1
\begin{document}
$0
\end{document}
endsnippet
snippet beg "begin{} / end{}" bA
\\begin{$1}
$0
\\end{$1}
endsnippet
priority 100
snippet ... "ldots" iA
\ldots
endsnippet
snippet table "Table environment" b
\begin{table}[${1:htpb}]
\centering
\caption{${2:caption}}
\label{tab:${3:label}}
\begin{tabular}{${5:c}}
$0${5/((?<=.)c|l|r)|./(?1: & )/g}
\end{tabular}
\end{table}
endsnippet
snippet fig "Figure environment" b
\begin{figure}[${1:htpb}]
\centering
${2:\includegraphics[width=0.8\textwidth]{$3}}
\caption{${4:$3}}
\label{fig:${5:${3/\W+/-/g}}}
\end{figure}
endsnippet
snippet enum "Enumerate" bA
\begin{enumerate}
\item $0
\end{enumerate}
endsnippet
snippet item "Itemize" bA
\begin{itemize}
\item $0
\end{itemize}
endsnippet
snippet desc "Description" b
\begin{description}
\item[$1] $0
\end{description}
endsnippet
snippet pac "Package" b
\usepackage[${1:options}]{${2:package}}$0
endsnippet
snippet => "implies" Ai
\implies
endsnippet
snippet =< "implied by" Ai
\impliedby
endsnippet
context "math()"
snippet iff "iff" Ai
\iff
endsnippet
snippet mk "Math" wA
$${1}$`!p
if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']:
snip.rv = ' '
else:
snip.rv = ''
`$2
endsnippet
snippet dm "Math" wA
\[
${1:${VISUAL}}
.\] $0
endsnippet
snippet ali "Align" bA
\begin{align*}
${1:${VISUAL}}
.\end{align*}
endsnippet
context "math()"
snippet // "Fraction" iA
\\frac{$1}{$2}$0
endsnippet
snippet / "Fraction" i
\\frac{${VISUAL}}{$1}$0
endsnippet
context "math()"
snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "symbol frac" wrA
\\frac{`!p snip.rv = match.group(1)`}{$1}$0
endsnippet
priority 1000
context "math()"
snippet '^.*\)/' "() frac" wrA
`!p
stripped = match.string[:-1]
depth = 0
i = len(stripped) - 1
while True:
if stripped[i] == ')': depth += 1
if stripped[i] == '(': depth -= 1
if depth == 0: break;
i-=1
snip.rv = stripped[0:i] + "\\frac{" + stripped[i+1:-1] + "}"
`{$1}$0
endsnippet
context "math()"
snippet '([A-Za-z])(\d)' "auto subscript" wrA
`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
endsnippet
context "math()"
snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA
`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`}
endsnippet
snippet sympy "sympyblock " w
sympy $1 sympy$0
endsnippet
priority 10000
snippet 'sympy(.*)sympy' "sympy" wr
`!p
from sympy import *
x, y, z, t = symbols('x y z t')
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)
init_printing()
snip.rv = eval('latex(' + match.group(1).replace('\\', '').replace('^', '**').replace('{', '(').replace('}', ')') + ')')
`
endsnippet
priority 1000
snippet math "mathematicablock" w
math $1 math$0
endsnippet
priority 10000
snippet 'math(.*)math' "math" wr
`!p
import subprocess
code = match.group(1)
code = 'ToString[' + code + ', TeXForm]'
snip.rv = subprocess.check_output(['wolframscript', '-code', code])
`
endsnippet
snippet == "equals" iA
&= $1 \\\\
endsnippet
snippet != "equals" iA
\neq
endsnippet
context "math()"
snippet ceil "ceil" iA
\left\lceil $1 \right\rceil $0
endsnippet
context "math()"
snippet floor "floor" iA
\left\lfloor $1 \right\rfloor$0
endsnippet
snippet pmat "pmat" iA
\begin{pmatrix} $1 \end{pmatrix} $0
endsnippet
snippet bmat "bmat" iA
\begin{bmatrix} $1 \end{bmatrix} $0
endsnippet
context "math()"
snippet () "left( right)" iA
\left( ${1:${VISUAL}} \right) $0
endsnippet
snippet lr "left( right)" i
\left( ${1:${VISUAL}} \right) $0
endsnippet
snippet lr( "left( right)" i
\left( ${1:${VISUAL}} \right) $0
endsnippet
snippet lr| "left| right|" i
\left| ${1:${VISUAL}} \right| $0
endsnippet
snippet lr{ "left\{ right\}" i
\left\\{ ${1:${VISUAL}} \right\\} $0
endsnippet
snippet lrb "left\{ right\}" i
\left\\{ ${1:${VISUAL}} \right\\} $0
endsnippet
snippet lr[ "left[ right]" i
\left[ ${1:${VISUAL}} \right] $0
endsnippet
snippet lra "leftangle rightangle" iA
\left<${1:${VISUAL}} \right>$0
endsnippet
context "math()"
snippet conj "conjugate" iA
\overline{$1}$0
endsnippet
snippet sum "sum" w
\sum_{n=${1:1}}^{${2:\infty}} ${3:a_n z^n}
endsnippet
snippet taylor "taylor" w
\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0
endsnippet
snippet lim "limit" w
\lim_{${1:n} \to ${2:\infty}}
endsnippet
snippet limsup "limsup" w
\limsup_{${1:n} \to ${2:\infty}}
endsnippet
snippet prod "product" w
\prod_{${1:n=${2:1}}}^{${3:\infty}} ${4:${VISUAL}} $0
endsnippet
snippet part "d/dx" w
\frac{\partial ${1:V}}{\partial ${2:x}} $0
endsnippet
context "math()"
snippet sq "\sqrt{}" iA
\sqrt{${1:${VISUAL}}} $0
endsnippet
context "math()"
snippet sr "^2" iA
^2
endsnippet
context "math()"
snippet cb "^3" iA
^3
endsnippet
context "math()"
snippet td "to the ... power" iA
^{$1}$0
endsnippet
context "math()"
snippet rd "to the ... power" iA
^{($1)}$0
endsnippet
snippet __ "subscript" iA
_{$1}$0
endsnippet
snippet ooo "\infty" iA
\infty
endsnippet
snippet rij "mrij" i
(${1:x}_${2:n})_{${3:$2}\\in${4:\\N}}$0
endsnippet
snippet <= "leq" iA
\le
endsnippet
snippet >= "geq" iA
\ge
endsnippet
context "math()"
snippet EE "geq" iA
\exists
endsnippet
context "math()"
snippet AA "forall" iA
\forall
endsnippet
context "math()"
snippet xnn "xn" iA
x_{n}
endsnippet
context "math()"
snippet ynn "yn" iA
y_{n}
endsnippet
context "math()"
snippet xii "xi" iA
x_{i}
endsnippet
context "math()"
snippet yii "yi" iA
y_{i}
endsnippet
context "math()"
snippet xjj "xj" iA
x_{j}
endsnippet
context "math()"
snippet yjj "yj" iA
y_{j}
endsnippet
context "math()"
snippet xp1 "x" iA
x_{n+1}
endsnippet
context "math()"
snippet xmm "x" iA
x_{m}
endsnippet
snippet R0+ "R0+" iA
\\R_0^+
endsnippet
snippet plot "Plot" w
\begin{figure}[$1]
\centering
\begin{tikzpicture}
\begin{axis}[
xmin= ${2:-10}, xmax= ${3:10},
ymin= ${4:-10}, ymax = ${5:10},
axis lines = middle,
]
\addplot[domain=$2:$3, samples=${6:100}]{$7};
\end{axis}
\end{tikzpicture}
\caption{$8}
\label{${9:$8}}
\end{figure}
endsnippet
snippet nn "Tikz node" w
\node[$5] (${1/[^0-9a-zA-Z]//g}${2}) ${3:at (${4:0,0}) }{$${1}$};
$0
endsnippet
context "math()"
snippet mcal "mathcal" iA
\mathcal{$1}$0
endsnippet
snippet lll "l" iA
\ell
endsnippet
context "math()"
snippet nabl "nabla" iA
\nabla
endsnippet
context "math()"
snippet xx "cross" iA
\times
endsnippet
priority 100
snippet ** "cdot" iA
\cdot
endsnippet
context "math()"
snippet norm "norm" iA
\|$1\|$0
endsnippet
priority 100
context "math()"
snippet '(?<!\\)(sin|cos|arccot|cot|csc|ln|log|exp|star|perp)' "ln" rwA
\\`!p snip.rv = match.group(1)`
endsnippet
priority 300
context "math()"
snippet dint "integral" wA
\int_{${1:-\infty}}^{${2:\infty}} ${3:${VISUAL}} $0
endsnippet
priority 200
context "math()"
snippet '(?<!\\)(arcsin|arccos|arctan|arccot|arccsc|arcsec|pi|zeta|int)' "ln" rwA
\\`!p snip.rv = match.group(1)`
endsnippet
priority 100
context "math()"
snippet -> "to" iA
\to
endsnippet
priority 200
context "math()"
snippet <-> "leftrightarrow" iA
\leftrightarrow
endsnippet
context "math()"
snippet !> "mapsto" iA
\mapsto
endsnippet
context "math()"
snippet invs "inverse" iA
^{-1}
endsnippet
context "math()"
snippet compl "complement" iA
^{c}
endsnippet
context "math()"
snippet \\\ "setminus" iA
\setminus
endsnippet
snippet >> ">>" iA
\gg
endsnippet
snippet << "<<" iA
\ll
endsnippet
snippet ~~ "~" iA
\sim
endsnippet
context "math()"
snippet set "set" wA
\\{$1\\} $0
endsnippet
snippet || "mid" iA
\mid
endsnippet
context "math()"
snippet cc "subset" Ai
\subset
endsnippet
snippet notin "not in " iA
\not\in
endsnippet
context "math()"
snippet inn "in " iA
\in
endsnippet
snippet NN "n" iA
\N
endsnippet
snippet Nn "cap" iA
\cap
endsnippet
snippet UU "cup" iA
\cup
endsnippet
snippet uuu "bigcup" iA
\bigcup_{${1:i \in ${2: I}}} $0
endsnippet
snippet nnn "bigcap" iA
\bigcap_{${1:i \in ${2: I}}} $0
endsnippet
snippet OO "emptyset" iA
\O
endsnippet
snippet RR "real" iA
\R
endsnippet
snippet QQ "Q" iA
\Q
endsnippet
snippet ZZ "Z" iA
\Z
endsnippet
snippet <! "normal" iA
\triangleleft
endsnippet
snippet <> "hokje" iA
\diamond
endsnippet
context "math()"
snippet '(?<!i)sts' "text subscript" irA
_\text{$1} $0
endsnippet
context "math()"
snippet tt "text" iA
\text{$1}$0
endsnippet
context "math()"
snippet case "cases" wA
\begin{cases}
$1
\end{cases}
endsnippet
snippet SI "SI" iA
\SI{$1}{$2}
endsnippet
snippet bigfun "Big function" iA
\begin{align*}
$1: $2 &\longrightarrow $3 \\\\
$4 &\longmapsto $1($4) = $0
.\end{align*}
endsnippet
snippet cvec "column vector" iA
\begin{pmatrix} ${1:x}_${2:1}\\\\ \vdots\\\\ $1_${2:n} \end{pmatrix}
endsnippet
priority 10
context "math()"
snippet "bar" "bar" riA
\overline{$1}$0
endsnippet
priority 100
context "math()"
snippet "([a-zA-Z])bar" "bar" riA
\overline{`!p snip.rv=match.group(1)`}
endsnippet
priority 10
context "math()"
snippet "hat" "hat" riA
\hat{$1}$0
endsnippet
priority 100
context "math()"
snippet "([a-zA-Z])hat" "hat" riA
\hat{`!p snip.rv=match.group(1)`}
endsnippet
snippet letw "let omega" iA
Let $\Omega \subset \C$ be open.
endsnippet
snippet HH "H" iA
\mathbb{H}
endsnippet
snippet DD "D" iA
\mathbb{D}
endsnippet
# vim:ft=snippets

@ -1,8 +1,7 @@
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
==================== READ THIS BEFORE CONTINUING ==================== =====================================================================
Kickctart.nvim is *not* a distribution.
@ -81,10 +80,10 @@ require('lazy').setup({
-- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below.
{ -- LSP Configuration & Plugins
{
-- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
@ -100,7 +99,8 @@ require('lazy').setup({
},
},
{ -- Autocompletion
{
-- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip',
'rafamadriz/friendly-snippets',
@ -110,9 +110,12 @@ require('lazy').setup({
end
},
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes
{
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
@ -127,7 +130,8 @@ require('lazy').setup({
},
{ -- Add indentation guides even on blank lines
{
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
@ -138,7 +142,6 @@ require('lazy').setup({
show_current_context = true,
}
end,
},
-- "gc" to comment visual regions/lines
@ -160,7 +163,8 @@ require('lazy').setup({
end,
},
{ -- Highlight, edit, and navigate code
{
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
@ -326,6 +330,9 @@ vim.api.nvim_set_keymap('v', '<leader>v', '"_d', { noremap = true, silent = true
vim.api.nvim_set_keymap('i', '<C-k>', '<C-W>', { noremap = true, desc = "delete word" })
vim.api.nvim_set_keymap('n', '<leader>ol', ":!zathura <C-r>-expand('%:r')<cr>.pdf &<cr>",
{ noremap = true, silent = true, desc = "[O]pen [L]atex" })
-- trucco sul relplace.
-- selezionare la sezione in cui si vuole rimpiazzare una parola (si puo anche non
@ -346,13 +353,13 @@ vim.api.nvim_set_keymap('i', '<C-k>', '<C-W>', { noremap = true, desc = "delete
-- disable swap file beacause it cause crashes in neovide and neovim
vim.o.swapfile = false
-- set the default tab size to 2
vim.cmd("set shiftwidth=3")
vim.cmd("set tabstop=3")
-- changing the color mapping for the neotree mapping
vim.g.nvim_tree_highlight_opened_files = 1
-- custom requirements
config = function()
require("config.auto-session").setup {}
@ -393,8 +400,8 @@ require('telescope').setup {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
@ -447,41 +454,41 @@ require('nvim-treesitter.configs').setup {
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
['<leader>A'] = '@parameter.inner',
},
},
},
@ -594,14 +601,14 @@ cmp.setup {
end,
},
mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs( -4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
@ -610,11 +617,11 @@ cmp.setup {
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable( -1) then
luasnip.jump( -1)
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end

@ -0,0 +1,15 @@
-- install texlive-most
return {
'lervag/vimtex',
'sirver/ultisnips',
'KeitaNakamura/tex-conceal.vim',
config = function()
vim.g.UltiSnipsExpandTrigger = '<tab>'
vim.g.UltiSnipsJumpForwardTrigger = '<tab>'
vim.g.UltiSnipsJumpBackwardTrigger = '<s-tab>'
vim.g.tex_flavor = 'latex'
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_quickfix_mode = 0
vim.g.tex_conceal = 'abdmg',
end
}

@ -0,0 +1,59 @@
return {
"ThePrimeagen/refactoring.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" }
},
config = function()
require('refactoring').setup({
prompt_func_return_type = {
go = false,
java = false,
cpp = false,
c = false,
h = false,
hpp = false,
cxx = false,
},
prompt_func_param_type = {
go = false,
java = false,
cpp = false,
c = false,
h = false,
hpp = false,
cxx = false,
},
printf_statements = {},
print_var_statements = {},
})
-- Remaps for the refactoring operations currently offered by the plugin
vim.api.nvim_set_keymap("v", "<leader>re",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]],
{ noremap = true, silent = true, expr = false })
vim.api.nvim_set_keymap("v", "<leader>rf",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]],
{ noremap = true, silent = true, expr = false, desc = "Extract function to file" })
vim.api.nvim_set_keymap("v", "<leader>rv",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]],
{ noremap = true, silent = true, expr = false, desc = "Extract variable" })
vim.api.nvim_set_keymap("v", "<leader>ri",
[[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]],
{ noremap = true, silent = true, expr = false, desc = "Inline variable" })
-- Extract block doesn't need visual mode
vim.api.nvim_set_keymap("n", "<leader>rb",
[[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]],
{ noremap = true, silent = true, expr = false, desc = "Extract block" })
vim.api.nvim_set_keymap("n", "<leader>rbf",
[[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]],
{ noremap = true, silent = true, expr = false, desc = "Extract block to file" })
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
vim.api.nvim_set_keymap("n", "<leader>ri",
[[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]],
{ noremap = true, silent = true, expr = false, desc = "Inline variable" })
end
}

@ -1,13 +1,10 @@
return {
{
'folke/tokyonight.nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'tokyonight-night'
end,
},
{ -- Theme inspired by Atom
@ -15,11 +12,45 @@ return {
},
{
"ellisonleao/gruvbox.nvim",
-- config = function()
-- vim.o.background = "light"
-- vim.cmd.colorscheme 'gruvbox'
-- end,
config = function()
-- setup must be called before loading the colorscheme
-- Default options:
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = true,
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "hard", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {
SignColumn = { bg = "#1d2021" }
},
dim_inactive = false,
transparent_mode = false,
})
vim.o.background = "dark"
vim.cmd.colorscheme 'gruvbox'
end,
},
{
"sainnhe/edge",
},
{
"catppuccin/nvim",
"rmehri01/onenord.nvim",
"AlexvZyl/nordic.nvim",
'marko-cerovac/material.nvim',
"Shatur/neovim-ayu",
'doums/darcula',
"sainnhe/gruvbox-material",
config = function()
end
}

Loading…
Cancel
Save