no coq for latex

This commit is contained in:
EvilMuffinHa 2022-11-08 20:32:39 -05:00
parent 5989e4213d
commit 914b98ff69
4 changed files with 492 additions and 439 deletions

View File

@ -1,5 +1,5 @@
vim.g.coq_settings = { vim.g.coq_settings = {
auto_start = 'shut-up', -- auto_start = 'shut-up',
keymap = { keymap = {
eval_snips = "<Leader>se", eval_snips = "<Leader>se",
}, },
@ -38,8 +38,8 @@ lspstatus.register_progress()
local function find_repo_root(names) local function find_repo_root(names)
local util = require("lspconfig.util") local util = require("lspconfig.util")
local config = names.configfiles local config = names.configfiles
for _, i in ipairs(config) do local function matcher(filename, _bufnr)
local gitroot = util.root_pattern('.git')(i) local gitroot = util.root_pattern('.git')(filename)
if gitroot then if gitroot then
for _, file in ipairs(config) do for _, file in ipairs(config) do
if util.path.is_file(util.path.join(gitroot, file)) then if util.path.is_file(util.path.join(gitroot, file)) then
@ -47,7 +47,10 @@ local function find_repo_root(names)
end end
end end
end end
return util.root_pattern(unpack(config))(filename)
end end
return matcher
end end
local lsp_confs = { local lsp_confs = {
@ -120,6 +123,10 @@ local lsp_confs = {
local lsp_special_setup = { local lsp_special_setup = {
} }
local function on_attach(client, _bufnr)
lspstatus.on_attach(client)
end
local lspconfig = require('lspconfig') local lspconfig = require('lspconfig')
@ -198,11 +205,41 @@ map(
{ noremap = true, expr = true } { noremap = true, expr = true }
) )
local M = {}
M.format_on_save_hook = function()
local enabled = vim.b.format_on_save
if enabled == nil then
enabled = true
end
if enabled ~= 0 and enabled ~= false then
vim.lsp.buf.format({ async = false })
end
end
vim.cmd [[ vim.cmd [[
augroup lspconfig augroup hoverlspconfig
au! au!
" diagnostic on hover " diagnostic on hover
au BufWritePre * lua require'lsp'.format_on_save_hook()
au CursorHold * lua vim.diagnostic.open_float({focus = false}) au CursorHold * lua vim.diagnostic.open_float({focus = false})
augroup END augroup END
]] ]]
vim.api.nvim_create_autocmd('FileType', {
pattern = "*",
callback = function()
if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" then
vim.cmd [[ :COQnow -s ]]
end
end
})
-- vim.cmd [[
-- augroup disabletexlsp
-- autocmd!
-- autocmd FileType tex :COQstop
-- augroup END
-- ]]
return M

View File

@ -56,10 +56,14 @@ return require('packer').startup({function(use)
require('gitsigns').setup { require('gitsigns').setup {
signs = { signs = {
add = { hl = 'GitSignsAdd', text = '', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' }, add = { hl = 'GitSignsAdd', text = '', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
change = {hl = 'GitSignsChange', text = '', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, change = { hl = 'GitSignsChange', text = '', numhl = 'GitSignsChangeNr',
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, linehl = 'GitSignsChangeLn' },
topdelete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteNr',
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, linehl = 'GitSignsDeleteLn' },
topdelete = { hl = 'GitSignsDelete', text = '', numhl = 'GitSignsDeleteNr',
linehl = 'GitSignsDeleteLn' },
changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr',
linehl = 'GitSignsChangeLn' },
}, },
} }
end end
@ -126,12 +130,24 @@ return require('packer').startup({function(use)
end, end,
} }
use {
'sirver/ultisnips',
ft = { 'latex', 'plaintex', 'tex' },
config = function()
vim.g.UltiSnipsExpandTrigger = '<tab>'
vim.g.UltiSnipsJumpForwardTrigger = '<tab>'
vim.g.UltiSnipsJumpBackwardTrigger = '<s-tab>'
end
}
use { use {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
-- commit = "607ff48b970b89c3e4e3825b88d9cfd05b7aaea5", -- commit = "607ff48b970b89c3e4e3825b88d9cfd05b7aaea5",
requires = { requires = {
'nvim-lua/lsp-status.nvim', 'nvim-lua/lsp-status.nvim',
{
'ms-jpq/coq.thirdparty', 'ms-jpq/coq.thirdparty',
},
{ {
'ms-jpq/coq_nvim', 'ms-jpq/coq_nvim',
run = ':COQdeps', run = ':COQdeps',
@ -183,4 +199,3 @@ end,
config = { config = {
compile_path = require('packer.util').join_paths(vim.fn.stdpath('data'), 'site', 'plugin', 'packer_compiled.lua'), compile_path = require('packer.util').join_paths(vim.fn.stdpath('data'), 'site', 'plugin', 'packer_compiled.lua'),
} }) } })

View File

@ -1,4 +1,3 @@
local telescope = require('telescope') local telescope = require('telescope')
telescope.setup({ telescope.setup({
@ -91,8 +90,10 @@ telescope.register_extension {
} }
table.insert(indexed_items, entry) table.insert(indexed_items, entry)
widths.idx = math.max(widths.idx, strings.strdisplaywidth(entry.idx)) widths.idx = math.max(widths.idx, strings.strdisplaywidth(entry.idx))
widths.command_title = math.max(widths.command_title, strings.strdisplaywidth(entry.add.command_title)) widths.command_title = math.max(widths.command_title,
widths.client_name = math.max(widths.client_name, strings.strdisplaywidth(entry.add.client_name)) strings.strdisplaywidth(entry.add.command_title))
widths.client_name = math.max(widths.client_name,
strings.strdisplaywidth(entry.add.client_name))
end end
return indexed_items, widths return indexed_items, widths
end, end,
@ -189,6 +190,7 @@ map('n', '<Leader>po', '<Cmd>Telescope lsp_document_symbols<CR>', {noremap = tru
map('n', '<Leader>ps', '<Cmd>Telescope lsp_workspace_symbols<CR>', { noremap = true }) map('n', '<Leader>ps', '<Cmd>Telescope lsp_workspace_symbols<CR>', { noremap = true })
map('n', '<Leader>pd', '<Cmd>Telescope lsp_definitions<CR>', { noremap = true }) map('n', '<Leader>pd', '<Cmd>Telescope lsp_definitions<CR>', { noremap = true })
map('n', '<Leader>pr', '<Cmd>Telescope lsp_references<CR>', { noremap = true }) map('n', '<Leader>pr', '<Cmd>Telescope lsp_references<CR>', { noremap = true })
map('n', '<Leader>pp', '<C-^>', { noremap = true })
map('n', '<Leader>p', ':Telescope ', { noremap = true }) map('n', '<Leader>p', ':Telescope ', { noremap = true })
map('n', '<Leader>p ', ':Telescope ', { noremap = true }) map('n', '<Leader>p ', ':Telescope ', { noremap = true })
@ -205,4 +207,3 @@ map('n', '<Leader>.', ':lua vim.lsp.buf.code_action()<CR>', {noremap = true})
-- au ColorScheme * call s:telescope_hlsetup() -- au ColorScheme * call s:telescope_hlsetup()
-- augroup END -- augroup END
-- ]] -- ]]