First commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
})
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "rust" },
|
||||
sync_install = false,
|
||||
auto_install = false,
|
||||
ignore_install = { "javascript" },
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
--vim.api.nvim_create_autocmd("BufEnter", {
|
||||
-- pattern = "*",
|
||||
-- callback = function()
|
||||
-- vim.bo.tabstop = 8
|
||||
-- vim.bo.shiftwidth = 8
|
||||
-- vim.bo.expandtab = false
|
||||
-- end
|
||||
--})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "tex",
|
||||
callback = function()
|
||||
vim.bo.tabstop = 4
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.expandtab = false
|
||||
end
|
||||
})
|
||||
@@ -0,0 +1,58 @@
|
||||
set shiftwidth=8
|
||||
set tabstop=8
|
||||
"set expandtab=false
|
||||
set number
|
||||
set signcolumn=yes:1
|
||||
colorscheme slate
|
||||
|
||||
let mapleader = ","
|
||||
nnoremap <silent> <leader>n :lua vim.diagnostic.goto_next()<CR>
|
||||
nnoremap <silent> <leader>p :lua vim.diagnostic.goto_prev()<CR>
|
||||
nnoremap <silent> <leader>e :lua vim.diagnostic.open_float()<CR>
|
||||
|
||||
" vim-plug config
|
||||
|
||||
call plug#begin()
|
||||
" Plug 'williamboman/mason.nvim'
|
||||
" Plug 'williamboman/mason-lspconfig.nvim'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'hrsh7th/cmp-buffer'
|
||||
Plug 'hrsh7th/cmp-path'
|
||||
Plug 'hrsh7th/cmp-cmdline'
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
|
||||
Plug 'SirVer/ultisnips'
|
||||
Plug 'quangnguyen30192/cmp-nvim-ultisnips'
|
||||
|
||||
let g:UltiSnipsExpandTrigger = '<tab>'
|
||||
let g:UltiSnipsJumpForwardTrigger = '<s-tab>'
|
||||
let g:UltiSnipsJumpBackwardTrigger = '<c-tab>'
|
||||
|
||||
let g:UltiSnipsEditSplit="vertical"
|
||||
let g:UltiSnipsSnippetDirectories=["/home/furtest/files/scripts/config_files/nvim/ultisnips"]
|
||||
|
||||
Plug 'lervag/vimtex'
|
||||
|
||||
let g:tex_flavor='latex'
|
||||
let g:vimtex_view_method='zathura'
|
||||
|
||||
let g:vimtex_view_general_options = '-reuse-instance'
|
||||
|
||||
let g:vimtex_quickfix_mode=0
|
||||
set conceallevel=1
|
||||
let g:tex_conceal='abdmg'
|
||||
|
||||
Plug 'iamcco/markdown-preview.nvim'
|
||||
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
|
||||
" Plug 'voldikss/vim-floaterm' " Floating terminal window (useless)
|
||||
|
||||
call plug#end()
|
||||
|
||||
" Source nvim-cmp config
|
||||
lua require('nvim-cmp')
|
||||
" lua require("mason").setup()
|
||||
" lua require("mason-lspconfig").setup()
|
||||
lua require('config')
|
||||
@@ -0,0 +1,79 @@
|
||||
-- Set up nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<tab>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'ultisnips' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
}),
|
||||
matching = { disallow_symbol_nonprefix_matching = false }
|
||||
})
|
||||
|
||||
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lsp = require('lspconfig')
|
||||
|
||||
lsp.ccls.setup{
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
cache = {
|
||||
directory = vim.fn.expand("~/.cache/ccls") -- Store index globally
|
||||
},
|
||||
compilationDatabaseDirectory = "build", -- Uses 'build/compile_commands.json' if present
|
||||
highlight = { lsRanges = true }, -- Improves semantic highlighting
|
||||
index = {
|
||||
threads = 4, -- Adjust based on your CPU (more threads = faster indexing)
|
||||
initialBlacklist = { ".*_test.cpp", ".*_unittest.cpp" } -- Avoid indexing test files
|
||||
},
|
||||
completion = {
|
||||
detailedLabel = true -- Better completion info
|
||||
},
|
||||
diagnostics = {
|
||||
onChange = 300 -- Delay diagnostics updates for better performance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- clangd and ccls are both C and C++ language servers
|
||||
-- having them both active at the same time is useless
|
||||
-- lsp.clangd.setup {
|
||||
-- capabilities = capabilities,
|
||||
-- }
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
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 beg "begin{} / end{}" bA
|
||||
\\begin{$1}
|
||||
$0
|
||||
\\end{$1}
|
||||
endsnippet
|
||||
|
||||
|
||||
priority 100
|
||||
snippet ... "dots" iA
|
||||
\dots
|
||||
endsnippet
|
||||
|
||||
snippet km "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
|
||||
|
||||
|
||||
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
|
||||
|
||||
context "math()"
|
||||
snippet '([A-Za-z])_' "auto subscript2" wrA
|
||||
`!p snip.rv = match.group(1)`_{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet enum "Enumerate" bA
|
||||
\begin{enumerate}
|
||||
\item $0
|
||||
\end{enumerate}
|
||||
endsnippet
|
||||
|
||||
snippet item "Itemize" bA
|
||||
\begin{itemize}
|
||||
\item $0
|
||||
\end{itemize}
|
||||
endsnippet
|
||||
|
||||
snippet sum "sum" w
|
||||
\sum_{n=${1:1}}^{${2:\infty}} ${3:a_n z^n}
|
||||
endsnippet
|
||||
|
||||
context "math()"
|
||||
snippet mat "Matrice symbol" A
|
||||
\mathcal{M}_{${1:n},${2:p}}(${3:\mathbb{R}})$0
|
||||
endsnippet
|
||||
|
||||
snippet pmat "pmat" bA
|
||||
\begin{pmatrix}
|
||||
$0
|
||||
\end{pmatrix}
|
||||
endsnippet
|
||||
|
||||
snippet // "Fraction" iA
|
||||
\\frac{$1}{$2}$0
|
||||
endsnippet
|
||||
|
||||
context "math()"
|
||||
snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "Fraction" wrA
|
||||
\\frac{`!p snip.rv = match.group(1)`}{$1}$0
|
||||
endsnippet
|
||||
|
||||
context "math()"
|
||||
priority 1000
|
||||
snippet '^.*\)/' "() Fraction" 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 text "text zone" A
|
||||
\text{ $1 }$0
|
||||
endsnippet
|
||||
|
||||
snippet def "definition" bA
|
||||
\begin{definition}[$1]
|
||||
$0
|
||||
\end{definition}
|
||||
endsnippet
|
||||
|
||||
snippet space "space" i
|
||||
\hspace{3ex} $0
|
||||
endsnippet
|
||||
|
||||
context "math()"
|
||||
snippet bar "overline bar" iA
|
||||
\overline{$1}$0
|
||||
endsnippet
|
||||
Reference in New Issue
Block a user