diff --git a/bin/install.sh b/bin/install.sh index 66a58fb..94bd07a 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -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 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/tex.lua ~/.config/nvim/after/ftplugin/tex.lua 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/indents.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/indents.scm diff --git a/dotfiles/neovim/after/ftplugin/tex.lua b/dotfiles/neovim/after/ftplugin/tex.lua new file mode 100644 index 0000000..5f56977 --- /dev/null +++ b/dotfiles/neovim/after/ftplugin/tex.lua @@ -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' }, + }, +} diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index fcf48c1..e3bc895 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -35,6 +35,10 @@ require('lazy').setup({ 'nvim-lualine/lualine.nvim', dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true } }, + { + 'lervag/vimtex', + ft = { 'tex', 'latex' }, + }, { 'lewis6991/gitsigns.nvim', }, 'neovim/nvim-lspconfig', { @@ -45,9 +49,13 @@ require('lazy').setup({ 'L3MON4D3/LuaSnip', -- snippets 'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip '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-cmdline', -- command line + 'hrsh7th/cmp-omni', -- source for omnifunc 'hrsh7th/cmp-nvim-lua', -- nvim lua }, }, @@ -134,6 +142,10 @@ end local ft = require('Comment.ft') ft.set('satysfi', '%%s') +----------------------------------------------------------- +-- vimtex +vim.g.vimtex_view_method = 'general' -- which is installed on both win and linux + ----------------------------------------------------------- -- gitsigns require('gitsigns').setup { @@ -392,7 +404,7 @@ cmp.setup { } -- cmdline completions -- `/` cmdline setup. -cmp.setup.cmdline('/', { +cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' }