add: nvim: vimtex

This commit is contained in:
qwjyh 2023-03-14 00:15:04 +09:00
parent b81618e0c8
commit 7ff8ff7744
3 changed files with 38 additions and 2 deletions

View file

@ -27,6 +27,7 @@ mkdir -p ~/.config/nvim/lua/lspconfig/server_configurations
ln -sf $(pwd)/dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua ~/.config/nvim/lua/lspconfig/server_configurations/satysfi_ls.lua ln -sf $(pwd)/dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua ~/.config/nvim/lua/lspconfig/server_configurations/satysfi_ls.lua
mkdir -p ~/.config/nvim/after/ftplugin mkdir -p ~/.config/nvim/after/ftplugin
ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/satysfi.lua ~/.config/nvim/after/ftplugin/satysfi.lua ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/satysfi.lua ~/.config/nvim/after/ftplugin/satysfi.lua
ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/tex.lua ~/.config/nvim/after/ftplugin/tex.lua
mkdir -p ~/.config/nvim/after/queries/satysfi mkdir -p ~/.config/nvim/after/queries/satysfi
curl -o ~/.config/nvim/after/queries/satysfi/highlights.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/highlights.scm curl -o ~/.config/nvim/after/queries/satysfi/highlights.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/highlights.scm
curl -o ~/.config/nvim/after/queries/satysfi/indents.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/indents.scm curl -o ~/.config/nvim/after/queries/satysfi/indents.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/indents.scm

View file

@ -0,0 +1,23 @@
-- restore completion order of nvim-cmp
-- source from `:help vimtex-complete-nvim-cmp`
local cmp = require'cmp'
cmp.setup.buffer {
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
omni = (vim.inspect(vim_item.menu):gsub('%"', "")),
buffer = "[Buffer]",
-- formatting for other sources
})[entry.source.name]
return vim_item
end,
},
sources = cmp.config.sources{
{ name = 'omni' },
{ name = 'buffer' },
-- { name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
{ name = 'path' },
},
}

View file

@ -35,6 +35,10 @@ require('lazy').setup({
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true } dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true }
}, },
{
'lervag/vimtex',
ft = { 'tex', 'latex' },
},
{ 'lewis6991/gitsigns.nvim', }, { 'lewis6991/gitsigns.nvim', },
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
{ {
@ -45,9 +49,13 @@ require('lazy').setup({
'L3MON4D3/LuaSnip', -- snippets 'L3MON4D3/LuaSnip', -- snippets
'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip 'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip
'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words 'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words
{
'kdheepak/cmp-latex-symbols', -- latex math 'kdheepak/cmp-latex-symbols', -- latex math
ft = { 'julia', },
},
'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths 'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths
'hrsh7th/cmp-cmdline', -- command line 'hrsh7th/cmp-cmdline', -- command line
'hrsh7th/cmp-omni', -- source for omnifunc
'hrsh7th/cmp-nvim-lua', -- nvim lua 'hrsh7th/cmp-nvim-lua', -- nvim lua
}, },
}, },
@ -134,6 +142,10 @@ end
local ft = require('Comment.ft') local ft = require('Comment.ft')
ft.set('satysfi', '%%s') ft.set('satysfi', '%%s')
-----------------------------------------------------------
-- vimtex
vim.g.vimtex_view_method = 'general' -- which is installed on both win and linux
----------------------------------------------------------- -----------------------------------------------------------
-- gitsigns -- gitsigns
require('gitsigns').setup { require('gitsigns').setup {
@ -392,7 +404,7 @@ cmp.setup {
} }
-- cmdline completions -- cmdline completions
-- `/` cmdline setup. -- `/` cmdline setup.
cmp.setup.cmdline('/', { cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = { sources = {
{ name = 'buffer' } { name = 'buffer' }