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",
}, },
@ -26,9 +26,9 @@ vim.g.coq_settings = {
local coq = require('coq') local coq = require('coq')
require('coq_3p') { require('coq_3p') {
{ src = 'vimtex', short_name = 'TEX'}, { src = 'vimtex', short_name = 'TEX' },
{ src = 'nvimlua', short_name = 'NLUA', conf_only = true}, { src = 'nvimlua', short_name = 'NLUA', conf_only = true },
{ src = 'bc', short_name = 'CALC', precision = 8}, { src = 'bc', short_name = 'CALC', precision = 8 },
} }
@ -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 = {
@ -60,7 +63,7 @@ local lsp_confs = {
path = runtime_path, path = runtime_path,
}, },
diagnostics = { diagnostics = {
globals = {'vim'}, globals = { 'vim' },
}, },
workspace = { workspace = {
library = vim.api.nvim_get_runtime_file("", true), library = vim.api.nvim_get_runtime_file("", true),
@ -100,7 +103,7 @@ local lsp_confs = {
root_dir = find_repo_root({ root_dir = find_repo_root({
configfiles = { ".eslintrc", ".eslintrc.js", "package.json" } configfiles = { ".eslintrc", ".eslintrc.js", "package.json" }
}), }),
on_new_config = function (config, new_root_dir) on_new_config = function(config, new_root_dir)
local default_config = require('lspconfig.server_configurations.eslint').default_config local default_config = require('lspconfig.server_configurations.eslint').default_config
default_config.on_new_config(config, new_root_dir) default_config.on_new_config(config, new_root_dir)
@ -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')
@ -171,10 +178,10 @@ vim.diagnostic.config({
do -- signs do -- signs
local signs = { local signs = {
{'DiagnosticSignError', text='×', texthl='DiagnosticSignError'}, { 'DiagnosticSignError', text = '×', texthl = 'DiagnosticSignError' },
{'DiagnosticSignWarn', text='>', texthl='DiagnosticSignWarn'}, { 'DiagnosticSignWarn', text = '>', texthl = 'DiagnosticSignWarn' },
{'DiagnosticSignInfo', text='I', texthl='DiagnosticSignInfo'}, { 'DiagnosticSignInfo', text = 'I', texthl = 'DiagnosticSignInfo' },
{'DiagnosticSignHint', text='H', texthl='DiagnosticSignHint'}, { 'DiagnosticSignHint', text = 'H', texthl = 'DiagnosticSignHint' },
} }
for _, sign in pairs(signs) do for _, sign in pairs(signs) do
local name = sign[1] local name = sign[1]
@ -189,20 +196,50 @@ map(
'n', 'n',
'K', 'K',
[[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? 'K' : '<Cmd>lua vim.lsp.buf.hover()<CR>']], [[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? 'K' : '<Cmd>lua vim.lsp.buf.hover()<CR>']],
{noremap = true, expr = true} { noremap = true, expr = true }
) )
map( map(
'n', 'n',
'<C-]>', '<C-]>',
[[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? '<C-]>' : '<Cmd>lua vim.lsp.buf.definition()<CR>']], [[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? '<C-]>' : '<Cmd>lua vim.lsp.buf.definition()<CR>']],
{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

@ -18,27 +18,27 @@ o.termguicolors = true
vim.cmd('colorscheme theme') vim.cmd('colorscheme theme')
vim.g.airline_theme='theme' vim.g.airline_theme = 'theme'
map('n', '<Leader>s', ':%s//g<Left><Left>', {}) map('n', '<Leader>s', ':%s//g<Left><Left>', {})
map('n', '<Leader>e', ':make!<CR>', {noremap = true}) map('n', '<Leader>e', ':make!<CR>', { noremap = true })
map('n', '<C-o>', ':cclose<CR>', {noremap = true}) map('n', '<C-o>', ':cclose<CR>', { noremap = true })
map('n', '<C-L>', ':nohlsearch<CR><C-L>', {noremap = true, silent = true}) map('n', '<C-L>', ':nohlsearch<CR><C-L>', { noremap = true, silent = true })
map('n', ';', ':', {noremap = true}) map('n', ';', ':', { noremap = true })
map('v', ';', ':', {noremap = true}) map('v', ';', ':', { noremap = true })
for i = 1,9,1 do for i = 1, 9, 1 do
map('', '<Leader>' .. tostring(i), tostring(i) .. 'gt', {noremap = true}) map('', '<Leader>' .. tostring(i), tostring(i) .. 'gt', { noremap = true })
end end
map('n', '<C-Left>', ':tabprevious<CR>', {noremap = true}) map('n', '<C-Left>', ':tabprevious<CR>', { noremap = true })
map('n', '<C-Right>', ':tabnext<CR>', {noremap = true}) map('n', '<C-Right>', ':tabnext<CR>', { noremap = true })
map('', '<Leader>0', ':tablast<CR>', {noremap = true}) map('', '<Leader>0', ':tablast<CR>', { noremap = true })
map('n', 'ZX', '<Cmd>q<CR>', {noremap = true, silent = true}) map('n', 'ZX', '<Cmd>q<CR>', { noremap = true, silent = true })
map('t', '<Esc>', '<C-\\><C-n>', {noremap = true}) map('t', '<Esc>', '<C-\\><C-n>', { noremap = true })
o.list=true o.list = true
o.listchars = { o.listchars = {
tab = '', tab = '',
eol = '¬', eol = '¬',

View File

@ -4,7 +4,7 @@ local function import(name)
return ([[require '%s']]):format(name) return ([[require '%s']]):format(name)
end end
return require('packer').startup({function(use) return require('packer').startup({ function(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
use { use {
@ -35,7 +35,7 @@ return require('packer').startup({function(use)
'tpope/vim-fugitive', 'tpope/vim-fugitive',
config = function() config = function()
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
map('n', '<Leader>g', '<Cmd>Git<CR>', {noremap = true}) map('n', '<Leader>g', '<Cmd>Git<CR>', { noremap = true })
end, end,
} }
@ -55,11 +55,15 @@ return require('packer').startup({function(use)
config = function() config = function()
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
@ -71,7 +75,7 @@ return require('packer').startup({function(use)
'nvim-lua/plenary.nvim' 'nvim-lua/plenary.nvim'
}, },
config = function() config = function()
require('flutter-tools').setup{ require('flutter-tools').setup {
lsp = { lsp = {
color = { color = {
enabled = false enabled = false
@ -88,7 +92,7 @@ return require('packer').startup({function(use)
require('Comment').setup({}) require('Comment').setup({})
map('n', '<C-_>', map('n', '<C-_>',
'<Cmd>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<CR>', '<Cmd>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<CR>',
{noremap = true, silent = true}) { noremap = true, silent = true })
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',
@ -180,7 +196,6 @@ return require('packer').startup({function(use)
end end
end, 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,9 +1,8 @@
local telescope = require('telescope') local telescope = require('telescope')
telescope.setup({ telescope.setup({
defaults = { defaults = {
file_ignore_patterns = {'.git'}, file_ignore_patterns = { '.git' },
mappings = { mappings = {
i = { i = {
['<C-o>'] = { '<Esc>', type = 'command' }, ['<C-o>'] = { '<Esc>', type = 'command' },
@ -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,
@ -183,16 +184,17 @@ telescope.register_extension {
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
map('n', '<Leader>pf', '<Cmd>Telescope find_files<CR>', {noremap = true}) map('n', '<Leader>pf', '<Cmd>Telescope find_files<CR>', { noremap = true })
map('n', '<Leader>pb', '<Cmd>Telescope buffers<CR>', {noremap = true}) map('n', '<Leader>pb', '<Cmd>Telescope buffers<CR>', { noremap = true })
map('n', '<Leader>po', '<Cmd>Telescope lsp_document_symbols<CR>', {noremap = true}) map('n', '<Leader>po', '<Cmd>Telescope lsp_document_symbols<CR>', { noremap = true })
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>p', ':Telescope ', {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>.', ':lua vim.lsp.buf.code_action()<CR>', {noremap = true}) map('n', '<Leader>.', ':lua vim.lsp.buf.code_action()<CR>', { noremap = true })
-- vim.cmd [[ -- vim.cmd [[
-- function! s:telescope_hlsetup() abort -- function! s:telescope_hlsetup() abort
@ -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
-- ]] -- ]]