coq setup

This commit is contained in:
~erin 2023-03-04 00:07:37 -05:00
parent d2041da6b5
commit 1f7d01fcdf
5 changed files with 44 additions and 186 deletions

View File

@ -33,8 +33,7 @@ vim.keymap.set('n', 'ar', '<cmd>AngryReviewer<cr>')
require("latex")
require("plugins")
require("plugins/statusline")
require("plugins/treesitter")
require("plugins/catppuccin")
require("plugins/lsp")
require("plugins/black")
require("plugins/FRC")
require("plugins/lsp")

View File

@ -49,20 +49,6 @@ return require('packer').startup(function(use)
run = '!python3 -m chadtree deps'
}
-- LSP
use 'neovim/nvim-lspconfig'
use 'simrat39/rust-tools.nvim'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-vsnip'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/vim-vsnip'
use 'amarakon/nvim-cmp-lua-latex-symbols'
use 'ray-x/cmp-treesitter'
use 'alaviss/nim.nvim'
-- Angry reviewer
use 'anufrievroman/vim-angry-reviewer'
@ -72,5 +58,20 @@ return require('packer').startup(function(use)
-- git
use 'tpope/vim-fugitive'
-- LSP
use 'neovim/nvim-lspconfig'
use 'simrat39/rust-tools.nvim'
-- coq
use {
'ms-jpq/coq_nvim', branch = 'coq'
}
use {
'ms-jpq/coq.artifacts', branch = 'artifacts'
}
use {
'ms-jpq/coq.thirdparty', branch = '3p'
}
end)

View File

@ -1,127 +1,23 @@
vim.opt.completeopt = "menu,menuone,noinsert"
local nvim_lsp = require'lspconfig'
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local opts = {
capabilities = capabilities,
tools = { -- rust-tools options
autoSetHints = true,
inlay_hints = {
show_parameter_hints = false,
parameter_hints_prefix = "",
other_hints_prefix = "",
},
},
-- all the opts to send to nvim-lspconfig
-- these override the defaults set by rust-tools.nvim
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
server = {
-- on_attach is a callback called when the language server attachs to the buffer
-- on_attach = on_attach,
settings = {
-- to enable rust-analyzer settings visit:
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
["rust-analyzer"] = {
-- enable clippy on save
checkOnSave = {
command = "clippy"
},
}
}
},
vim.g.coq_settings = {
auto_start = 'shut-up',
}
require('rust-tools').setup(opts)
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'pylsp', 'gdscript', 'ltex'}
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
capabilities = capabilities,
on_attach = on_attach,
flags = {
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
}
}
end
local lsp = require "lspconfig"
local coq = require "coq"
-- Java LSP (WPILib broken :/)
require'lspconfig'.java_language_server.setup{ cmd = { "/home/erin/src/java-language-server/dist/lang_server_linux.sh" } }
require("coq_3p") {
src = "nvimlua",
short_name = "nLUA",
}
-- Setup Completion
-- See https://github.com/hrsh7th/nvim-cmp#basic-configuration
local cmp = require'cmp'
cmp.setup({
-- Enable LSP snippets
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
-- Add tab support
['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<Tab>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
})
},
-- Installed sources
sources = {
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'buffer' },
{ name = 'lua-latex-symbols', option = { cache = true } },
{ name = 'treesitter' },
},
})
local api = vim.api
-- set updatetime for CursorHold
-- 300ms of no cursor movement to trigger CursorHold
vim.opt.updatetime = 300
-- show diagnostic popup on cursor hold
api.nvim_create_autocmd("CursorHold", {
command = "lua vim.diagnostic.open_float(nil, { focusable = false })",
})
-- fixed column for the diagnostics to appear in
vim.opt.signcolumn = "yes"
-- auto-format *.rs (rust) files prior to saving them
api.nvim_create_autocmd("BufWritePre", {
pattern = "*.rs",
command = "lua vim.lsp.buf.formatting_sync(nil, 1000)",
})
-- Code navigation shortcutst
vim.keymap.set('n', 'K', function()
return vim.lsp.buf.hover()
end, { silent = true })
vim.keymap.set('n', 'gr', function()
return vim.lsp.buf.references()
end, { silent = true, buffer = true })
vim.keymap.set('n', 'gd', function()
return vim.lsp.buf.definition()
end, { silent = true, buffer = true })
vim.keymap.set('n', 'ga', function()
return vim.lsp.buf.code_action()
end, { silent = true, buffer = true })
vim.keymap.set('n', '1gD', function()
return vim.lsp.buf.type_definition()
end, { silent = true, buffer = true })
lsp.pylsp.setup{coq.lsp_ensure_capabilities()}
lsp.gdscript.setup{coq.lsp_ensure_capabilities()}
lsp.ltex.setup{coq.lsp_ensure_capabilities()}
lsp.rust_analyzer.setup{coq.lsp_ensure_capabilities()}
lsp.gdscript.setup{coq.lsp_ensure_capabilities()}
lsp.asm_lsp.setup{coq.lsp_ensure_capabilities()}
-- lsp.java_language_server.setup{coq.lsp_ensure_capabilities{
-- cmd = {
-- "/home/erin/src/java-language-server/dist/lang_server_linux.sh"
-- },
-- }}

View File

@ -1,18 +0,0 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = { "c", "cpp", "lua", "vim", "help", "bash", "cmake", "make", "html", "css", "scss", "javascript", "latex", "markdown", "toml", "json", "yaml", "dockerfile", "gitattributes", "git_rebase", "gitcommit", "gdscript", "http", "java", "php" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = true,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
-- 'false' will disable the whole extension
enable = true,
additional_vim_regex_highlighting = false,
},
}

View File

@ -84,25 +84,20 @@ _G.packer_plugins = {
path = "/home/erin/.local/share/nvim/site/pack/packer/start/chadtree",
url = "https://github.com/ms-jpq/chadtree"
},
["cmp-buffer"] = {
["coq.artifacts"] = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
path = "/home/erin/.local/share/nvim/site/pack/packer/start/coq.artifacts",
url = "https://github.com/ms-jpq/coq.artifacts"
},
["cmp-nvim-lsp"] = {
["coq.thirdparty"] = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
path = "/home/erin/.local/share/nvim/site/pack/packer/start/coq.thirdparty",
url = "https://github.com/ms-jpq/coq.thirdparty"
},
["cmp-path"] = {
coq_nvim = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
["cmp-vsnip"] = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/cmp-vsnip",
url = "https://github.com/hrsh7th/cmp-vsnip"
path = "/home/erin/.local/share/nvim/site/pack/packer/start/coq_nvim",
url = "https://github.com/ms-jpq/coq_nvim"
},
fzf = {
loaded = true,
@ -125,16 +120,6 @@ _G.packer_plugins = {
path = "/home/erin/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["nim.nvim"] = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/nim.nvim",
url = "https://github.com/alaviss/nim.nvim"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
@ -180,11 +165,6 @@ _G.packer_plugins = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/vim-fugitive",
url = "https://github.com/tpope/vim-fugitive"
},
["vim-vsnip"] = {
loaded = true,
path = "/home/erin/.local/share/nvim/site/pack/packer/start/vim-vsnip",
url = "https://github.com/hrsh7th/vim-vsnip"
}
}