[nvim] a bunch of things
This commit is contained in:
parent
ae228da2ce
commit
e296716fa2
14 changed files with 526 additions and 392 deletions
4
.config/nvim/.luarc.json
Normal file
4
.config/nvim/.luarc.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||
"runtime.version": "LuaJIT"
|
||||
}
|
1
.config/nvim/ftdetect/why3.vim
Normal file
1
.config/nvim/ftdetect/why3.vim
Normal file
|
@ -0,0 +1 @@
|
|||
au BufRead,BufNewFile *.why,*.mlw set filetype=why3
|
|
@ -1,6 +1,5 @@
|
|||
require("core.variables")
|
||||
require('core.package_manager')
|
||||
require('plugins.remote-theme')
|
||||
require('winbar')
|
||||
require('core.theme')
|
||||
require('impatient')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" },
|
||||
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
|
||||
"catppuccin": { "branch": "main", "commit": "c0de3b46811fe1ce3912e2245a9dfbea6b41c300" },
|
||||
"cinnamon.nvim": { "branch": "master", "commit": "c406ffda3a0302f32c23b24ab756ea20467d6578" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
|
@ -9,8 +9,8 @@
|
|||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"copilot.lua": { "branch": "master", "commit": "03f825956ec49e550d07875d867ea6e7c4dc8c00" },
|
||||
"distant.nvim": { "branch": "v0.3", "commit": "de7288b1af6fdb2d2e7a8aa00f07a236261c2491" },
|
||||
"conform.nvim": { "branch": "master", "commit": "34b81e70da83e26c048290204de44268eb59814e" },
|
||||
"copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "60404ba67044c6ab01894dd5bf77bd64ea5e09aa" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
|
||||
|
@ -18,40 +18,38 @@
|
|||
"impatient.nvim": { "branch": "main", "commit": "47302af74be7b79f002773011f0d8e85679a7618" },
|
||||
"instant.nvim": { "branch": "master", "commit": "294b6d08143b3db8f9db7f606829270149e1a786" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
|
||||
"leap.nvim": { "branch": "main", "commit": "90ca1ded0608c891ba7a63de059ce5bc8533f060" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"ltex-extra.nvim": { "branch": "master", "commit": "42dd3572cb09b52a137e91e515f2dff5eb631b1e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" },
|
||||
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
|
||||
"mini.animate": { "branch": "main", "commit": "82519630b2760ffc516ebc387bef632f9c07b9f5" },
|
||||
"nerdy.nvim": { "branch": "main", "commit": "7c9a4ea4a9ca7063e86dbcf7ce0f233cb59bdc10" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "4715e3e0480152dbbca1a3b5d09f070508a54691" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||
"nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" },
|
||||
"nvim-ghost.nvim": { "branch": "main", "commit": "a1ca0b2dac59881066d7ac9373cf64d59ba29d6a" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ec7d51a619049c7c597f469f81ea199db6794651" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "c932a56bf25167b1e88d2a1ebe35bb774b41019a" },
|
||||
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "18aa5ae3fd7245137bc41b5348102fe254405509" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "b8d1ffe58a88e0356da56b167373e89c4579ce15" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "0bb67ef952ea3eb7b1bac9c011281471d99a27bc" },
|
||||
"oil.nvim": { "branch": "master", "commit": "132b4ea0740c417b9d717411cab4cf187e1fd095" },
|
||||
"orgmode": { "branch": "master", "commit": "36424ff2491ee3d2efb2a074a5ed1862a6d060c6" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" },
|
||||
"oil.nvim": { "branch": "master", "commit": "c437f3c5b0da0a9cc6a222d87212cce11b80ba75" },
|
||||
"pastify.nvim": { "branch": "main", "commit": "47317b9bb7bf5fb7dfd994a6eb9bec8f00628dc0" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "b44e1db9056d74cc491aa4a3f625f8bdca0d6743" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "44465eec3c1b9f7c6620274218fd8e9e60d6618e" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
|
||||
"tla.nvim": { "branch": "master", "commit": "e419c75e805ab6d9967c7325bf35734c372d3d4b" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
|
||||
"typst.vim": { "branch": "main", "commit": "ff57d27cf5ee7427941a63fb537714f9a80e0246" },
|
||||
"undotree": { "branch": "master", "commit": "9dbbf3b7d19dda0d22ceca461818e4739ad8154d" },
|
||||
"vim-alloy": { "branch": "master", "commit": "5bd57c4890be39e221dd3e1f6735457dce454bbd" },
|
||||
"vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" },
|
||||
"vim-jukit": { "branch": "master", "commit": "73214c9a8abc4b6aa7a6266b5bc2ddbf8b3e3c00" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-tpipeline": { "branch": "master", "commit": "649f079a0bee19565978b82b672d831c6641d952" },
|
||||
"vimtex": { "branch": "master", "commit": "afac40289eed684ab1301390dcd246b1609f8119" },
|
||||
"vimtex": { "branch": "master", "commit": "0cb12b4092cca1e5328a181c76b3ab8c088d52f1" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
--KEYBINDINGS
|
||||
local map = vim.api.nvim_set_keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Move to previous/next
|
||||
map('n', '<A-h>', '<Cmd>BufferLineCyclePrev<CR>', opts)
|
||||
map('n', '<A-l>', '<Cmd>BufferLineCycleNext<CR>', opts)
|
||||
-- Re-order to previous/next
|
||||
map('n', '<A-H>', '<Cmd>BufferLineMovePrev<CR>', opts)
|
||||
map('n', '<A-L>', '<Cmd>BufferLineMoveNext<CR>', opts)
|
||||
-- Goto buffer in position...
|
||||
map('n', '<A-1>', '<Cmd>BufferLineGoToBuffer 1<CR>', opts)
|
||||
map('n', '<A-2>', '<Cmd>BufferLineGoToBuffer 2<CR>', opts)
|
||||
map('n', '<A-3>', '<Cmd>BufferLineGoToBuffer 3<CR>', opts)
|
||||
map('n', '<A-4>', '<Cmd>BufferLineGoToBuffer 4<CR>', opts)
|
||||
map('n', '<A-5>', '<Cmd>BufferLineGoToBuffer 5<CR>', opts)
|
||||
map('n', '<A-6>', '<Cmd>BufferLineGoToBuffer 6<CR>', opts)
|
||||
map('n', '<A-7>', '<Cmd>BufferLineGoToBuffer 7<CR>', opts)
|
||||
map('n', '<A-8>', '<Cmd>BufferLineGoToBuffer 8<CR>', opts)
|
||||
map('n', '<A-9>', '<Cmd>BufferLineGoToBuffer 9<CR>', opts)
|
||||
-- Close buffer
|
||||
map('n', '<A-c>', '<Cmd>BufferLinePickClose<CR>', opts)
|
||||
|
||||
-- Set bufferline's options
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "buffers",
|
||||
numbers = "none",
|
||||
close_command = "bdelete! %d",
|
||||
right_mouse_command = "bdelete! %d",
|
||||
left_mouse_command = "buffer %d",
|
||||
middle_mouse_command = "bdelete! %d",
|
||||
indicator = {
|
||||
icon = "▎",
|
||||
style = "icon",
|
||||
},
|
||||
buffer_close_icon = '',
|
||||
modified_icon = '●',
|
||||
close_icon = '',
|
||||
left_trunc_marker = '',
|
||||
right_trunc_marker = '',
|
||||
max_name_length = 18,
|
||||
max_prefix_length = 15,
|
||||
truncate_names = true,
|
||||
tab_size = 18,
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_update_in_insert = true,
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
return "(" .. count .. ")"
|
||||
end,
|
||||
color_icons = true,
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_buffer_default_icon = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
show_duplicate_prefix = true,
|
||||
persist_buffer_sort = true,
|
||||
separator_style = "slant",
|
||||
enforce_regular_tabs = true,
|
||||
always_show_bufferline = true,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = { 'close' }
|
||||
},
|
||||
sort_by = 'insert_after_current',
|
||||
custom_filter = function(buf_number, buf_numbers)
|
||||
-- filter out filetypes you don't want to see
|
||||
if vim.bo[buf_number].filetype ~= "" then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
}
|
||||
})
|
|
@ -10,10 +10,23 @@ end
|
|||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col "." - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
|
||||
local col = vim.fn.col(".") - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||
end
|
||||
|
||||
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
||||
if not lspkind_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
cmp.event:on("menu_opened", function()
|
||||
vim.b.copilot_suggestion_hidden = true
|
||||
end)
|
||||
|
||||
cmp.event:on("menu_closed", function()
|
||||
vim.b.copilot_suggestion_hidden = false
|
||||
end)
|
||||
|
||||
-- some other good icons
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
|
@ -46,26 +59,27 @@ local kind_icons = {
|
|||
}
|
||||
-- find more here: https://www.nerdfonts.com/cheat-sheet
|
||||
|
||||
cmp.setup {
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<C-y>"] = cmp.mapping(
|
||||
cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
{ "i", "c" }
|
||||
),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
["<C-e>"] = cmp.mapping {
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
},
|
||||
-- Accept currently selected item. If none selected, do nothing.
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false
|
||||
},
|
||||
["<C-k>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
|
@ -83,47 +97,29 @@ cmp.setup {
|
|||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
end),
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
-- Kind icons
|
||||
-- if vim.tbl_contains({ "nvim_lsp" }, entry.source.name) then
|
||||
-- tailwind = require("tailwindcss-colorizer-cmp")
|
||||
-- return tailwind.formatter(entry, vim_item)
|
||||
-- else
|
||||
vim_item.kind = string.format('[%s %s]', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
["vim-dadbod-completion"] = "[]",
|
||||
nvim_lua = "[LSP]",
|
||||
path = "[Path]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
-- end
|
||||
end,
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text", -- show only symbol annotations
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
-- can also be a function to dynamically calculate max width such as
|
||||
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
|
||||
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
|
||||
-- The function below will be called before any actual modifications from lspkind
|
||||
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
|
||||
before = function(entry, vim_item)
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[LSP]",
|
||||
path = "[Path]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
},
|
||||
sorting = {
|
||||
comparators = {
|
||||
|
@ -133,8 +129,8 @@ cmp.setup {
|
|||
|
||||
--Make entries that start with underline appear after
|
||||
function(entry1, entry2)
|
||||
local _, entry1_under = entry1.completion_item.label:find "^_+"
|
||||
local _, entry2_under = entry2.completion_item.label:find "^_+"
|
||||
local _, entry1_under = entry1.completion_item.label:find("^_+")
|
||||
local _, entry2_under = entry2.completion_item.label:find("^_+")
|
||||
entry1_under = entry1_under or 0
|
||||
entry2_under = entry2_under or 0
|
||||
if entry1_under > entry2_under then
|
||||
|
@ -143,51 +139,17 @@ cmp.setup {
|
|||
return true
|
||||
end
|
||||
end,
|
||||
}
|
||||
},
|
||||
sources = cmp.config.sources(
|
||||
{
|
||||
{
|
||||
name = "nvim_lsp",
|
||||
entry_filter = function(entry, context)
|
||||
local kind = entry:get_kind()
|
||||
vim.api.nvim_out_write(kind .. '\n')
|
||||
if kind == "Text" then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
},
|
||||
|
||||
{ name = 'orgmode' },
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'luasnip' },
|
||||
--{ name = "vim-dadbod-completion" },
|
||||
{ name = "path" },
|
||||
},
|
||||
{
|
||||
--This sources will only show up if there aren't any sources from the other list
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
}
|
||||
),
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None"
|
||||
})
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
}),
|
||||
})
|
||||
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false,
|
||||
native_menu = false,
|
||||
},
|
||||
}
|
||||
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
|
10
.config/nvim/lua/plugins/conform.lua
Normal file
10
.config/nvim/lua/plugins/conform.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
python = { "black" },
|
||||
javascript = { "prettierd" },
|
||||
markdown = { "mdformat" },
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
},
|
||||
})
|
|
@ -1,28 +1,29 @@
|
|||
require('copilot').setup({
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<C-h>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = false,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<C-h>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
--Option key + ] or [
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
yaml = false,
|
||||
markdown = true,
|
||||
help = false,
|
||||
gitcommit = false,
|
||||
gitrebase = false,
|
||||
hgcommit = false,
|
||||
svn = false,
|
||||
cvs = false,
|
||||
["."] = false,
|
||||
},
|
||||
copilot_node_command = 'node', -- Node.js version must be > 16.x
|
||||
server_opts_overrides = {},
|
||||
filetypes = {
|
||||
yaml = false,
|
||||
markdown = true,
|
||||
help = false,
|
||||
gitcommit = false,
|
||||
gitrebase = false,
|
||||
hgcommit = false,
|
||||
svn = false,
|
||||
cvs = false,
|
||||
["."] = false,
|
||||
},
|
||||
copilot_node_command = 'node', -- Node.js version must be > 16.x
|
||||
server_opts_overrides = {},
|
||||
})
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
local dap = require("dap")
|
||||
|
||||
dap.adapters.lldb = {
|
||||
type = 'server',
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = '/Users/afonso/.local/share/nvim/mason/bin/codelldb',
|
||||
args = {"--port", "${port}"},
|
||||
}
|
||||
type = 'server',
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = '/Users/afonso/.local/share/nvim/mason/bin/codelldb',
|
||||
args = { "--port", "${port}" },
|
||||
}
|
||||
}
|
||||
dap.adapters.codelldb = {
|
||||
type = 'server',
|
||||
host = '127.0.0.1',
|
||||
port = 13000
|
||||
}
|
||||
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "codelldb: With args",
|
||||
name = "Manually start codelldb",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
|
@ -24,6 +29,19 @@ dap.configurations.c = {
|
|||
cwd = '${workspaceFolder}',
|
||||
stopOnEntry = false,
|
||||
},
|
||||
{
|
||||
name = "Auto start codelldb",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
args = function()
|
||||
local args = vim.fn.input('Arguments: ')
|
||||
return args ~= '' and { args } or nil
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopOnEntry = false,
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
local lazy = require('lazy')
|
||||
local lazy = require("lazy")
|
||||
|
||||
lazy.setup({
|
||||
|
||||
'lewis6991/impatient.nvim',
|
||||
"lewis6991/impatient.nvim",
|
||||
|
||||
-------------------------------------------THEMES------------------------------------------
|
||||
{
|
||||
'catppuccin/nvim',
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {}
|
||||
opts = {},
|
||||
},
|
||||
|
||||
'sainnhe/gruvbox-material',
|
||||
"sainnhe/gruvbox-material",
|
||||
|
||||
-------------------------------------------------------MFP---------------------------------
|
||||
{
|
||||
'susliko/tla.nvim',
|
||||
opts = {}
|
||||
"susliko/tla.nvim",
|
||||
opts = {},
|
||||
},
|
||||
-------------------------------------------------------QOL---------------------------------
|
||||
|
||||
{
|
||||
'jbyuki/instant.nvim',
|
||||
"jbyuki/instant.nvim",
|
||||
config = function()
|
||||
vim.g.instant_username = 'afonso'
|
||||
end
|
||||
vim.g.instant_username = "afonso"
|
||||
end,
|
||||
},
|
||||
|
||||
'vimpostor/vim-tpipeline',
|
||||
"vimpostor/vim-tpipeline",
|
||||
|
||||
{
|
||||
'TobinPalmer/pastify.nvim',
|
||||
cmd = { 'Pastify' },
|
||||
opts = {}
|
||||
"TobinPalmer/pastify.nvim",
|
||||
cmd = { "Pastify" },
|
||||
opts = {},
|
||||
},
|
||||
|
||||
--Python notebooks
|
||||
{
|
||||
'luk400/vim-jukit',
|
||||
"luk400/vim-jukit",
|
||||
config = function()
|
||||
require 'plugins.jukit'
|
||||
require("plugins.jukit")
|
||||
end,
|
||||
ft = { 'python', 'json' }
|
||||
ft = { "python", "json" },
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -51,49 +51,49 @@ lazy.setup({
|
|||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require 'plugins.copilot'
|
||||
require("plugins.copilot")
|
||||
end,
|
||||
},
|
||||
|
||||
--Nvim to browser
|
||||
'subnut/nvim-ghost.nvim',
|
||||
"subnut/nvim-ghost.nvim",
|
||||
|
||||
{
|
||||
'declancm/cinnamon.nvim',
|
||||
"declancm/cinnamon.nvim",
|
||||
opts = {
|
||||
scroll_limit = 10000,
|
||||
always_scroll = true,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {}
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{
|
||||
'folke/zen-mode.nvim',
|
||||
"folke/zen-mode.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
vim.keymap.set('n', '<leader>z', '<Cmd> ZenMode <CR>', { noremap = true, silent = true })
|
||||
}
|
||||
vim.keymap.set("n", "<leader>z", "<Cmd> ZenMode <CR>", { noremap = true, silent = true }),
|
||||
},
|
||||
},
|
||||
|
||||
--Change add and remove surroundings from words
|
||||
'tpope/vim-surround',
|
||||
"tpope/vim-surround",
|
||||
|
||||
{
|
||||
'NvChad/nvim-colorizer.lua',
|
||||
opts = {}
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
'mbbill/undotree',
|
||||
"mbbill/undotree",
|
||||
|
||||
--Tmux navigation
|
||||
{
|
||||
'alexghergh/nvim-tmux-navigation',
|
||||
"alexghergh/nvim-tmux-navigation",
|
||||
opts = {
|
||||
disable_when_zoomed = true, -- defaults to false
|
||||
keybindings = {
|
||||
|
@ -101,56 +101,57 @@ lazy.setup({
|
|||
down = "<F6>",
|
||||
up = "<F7>",
|
||||
right = "<F8>",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Rename variable pop up
|
||||
'stevearc/dressing.nvim',
|
||||
"stevearc/dressing.nvim",
|
||||
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require 'plugins.autopairs'
|
||||
end
|
||||
require("plugins.autopairs")
|
||||
end,
|
||||
},
|
||||
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", opt = true },
|
||||
config = function()
|
||||
require 'plugins.lualine'
|
||||
end
|
||||
require("plugins.lualine")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'stevearc/oil.nvim',
|
||||
opts = {}
|
||||
"stevearc/oil.nvim",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-------------------------------------------------------LSP----------------------------------------------
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp', -- lsp
|
||||
'hrsh7th/cmp-nvim-lua', -- Nvim API completions
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help', -- Show function signatures
|
||||
'hrsh7th/cmp-buffer', --buffer completions
|
||||
'hrsh7th/cmp-path', --path completions
|
||||
'hrsh7th/cmp-cmdline', --cmdline completions
|
||||
'L3MON4D3/LuaSnip',
|
||||
'rafamadriz/friendly-snippets',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
"hrsh7th/cmp-nvim-lsp", -- lsp
|
||||
"hrsh7th/cmp-nvim-lua", -- Nvim API completions
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help", -- Show function signatures
|
||||
"hrsh7th/cmp-buffer", --buffer completions
|
||||
"hrsh7th/cmp-path", --path completions
|
||||
"hrsh7th/cmp-cmdline", --cmdline completions
|
||||
"L3MON4D3/LuaSnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"onsails/lspkind.nvim", --lspkind icons
|
||||
},
|
||||
config = function()
|
||||
require 'plugins.cmp'
|
||||
end
|
||||
require("plugins.cmp")
|
||||
end,
|
||||
},
|
||||
|
||||
--LSP Status
|
||||
'j-hui/fidget.nvim',
|
||||
"j-hui/fidget.nvim",
|
||||
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
|
@ -169,7 +170,7 @@ lazy.setup({
|
|||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
|
@ -179,84 +180,89 @@ lazy.setup({
|
|||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
opts = {
|
||||
handlers = {}
|
||||
handlers = {},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
require 'plugins.dap'
|
||||
end
|
||||
require("plugins.dap")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require 'plugins.mason'
|
||||
end
|
||||
require("plugins.mason")
|
||||
end,
|
||||
},
|
||||
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require 'plugins.lspconfig'
|
||||
end
|
||||
require("plugins.lspconfig")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvimtools/none-ls.nvim',
|
||||
event = "VeryLazy",
|
||||
"stevearc/conform.nvim",
|
||||
config = function()
|
||||
require 'plugins.none-ls'
|
||||
end
|
||||
require("plugins.conform")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'lervag/vimtex',
|
||||
"lervag/vimtex",
|
||||
config = function()
|
||||
require 'plugins.vimtex'
|
||||
end
|
||||
require("plugins.vimtex")
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = '^4', -- Recommended
|
||||
ft = { 'rust' },
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^4", -- Recommended
|
||||
ft = { "rust" },
|
||||
},
|
||||
|
||||
"barreiroleo/ltex-extra.nvim",
|
||||
|
||||
-------------------------------------------------------------------------------------------
|
||||
-- Syntax Highlighting
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
config = function()
|
||||
require 'plugins.treesitter'
|
||||
end
|
||||
require("plugins.treesitter")
|
||||
end,
|
||||
},
|
||||
|
||||
'kaarmu/typst.vim',
|
||||
"kaarmu/typst.vim",
|
||||
|
||||
--Sticky headers
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
config = function()
|
||||
require 'plugins.treesitter-context'
|
||||
end
|
||||
require("plugins.treesitter-context")
|
||||
end,
|
||||
},
|
||||
|
||||
"runoshun/vim-alloy",
|
||||
|
||||
--does so much
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.4',
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.4",
|
||||
-- or , branch = '0.1.x',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function() require('plugins.telescope') end
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("plugins.telescope")
|
||||
end,
|
||||
},
|
||||
|
||||
--Discord Rich Presence
|
||||
'andweeb/presence.nvim'
|
||||
|
||||
"andweeb/presence.nvim",
|
||||
|
||||
--Vim be good
|
||||
'ThePrimeagen/vim-be-good',
|
||||
})
|
||||
|
|
|
@ -1,75 +1,91 @@
|
|||
local mason_lspconfig = require "mason-lspconfig"
|
||||
local lspconfig = require "lspconfig"
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
mason_lspconfig.setup({
|
||||
automatic_installation = false
|
||||
automatic_installation = false,
|
||||
})
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
local telescope = require("telescope.builtin")
|
||||
local conform = require("conform")
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = ev.buf }
|
||||
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, bufopts)
|
||||
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, bufopts)
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set("n", "gd", telescope.lsp_definitions, bufopts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set("n", "gi", telescope.lsp_implementations, bufopts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set("n", "gr", telescope.lsp_references, bufopts)
|
||||
vim.keymap.set("n", "<space>ge", function() vim.diagnostic.goto_next() end, bufopts)
|
||||
vim.keymap.set("n", "<space>gE", function() vim.diagnostic.goto_prev() end, bufopts)
|
||||
vim.keymap.set("n", "<space>fo", function() conform.format({ lsp_fallback = true }) end, bufopts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- ADD NVIM CMP AS A CAPABILITY
|
||||
local lsp_defaults = lspconfig.util.default_config
|
||||
local capabilities =
|
||||
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
library = {
|
||||
unpack(vim.api.nvim_get_runtime_file('', true))
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
["hls"] = function()
|
||||
lspconfig["hls"].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { 'haskell', 'lhaskell', 'cabal' },
|
||||
})
|
||||
end,
|
||||
["ltex"] = function()
|
||||
lspconfig["ltex"].setup({
|
||||
capabilities = capabilities,
|
||||
--Local on attach
|
||||
on_attach = function(_, _)
|
||||
-- rest of your on_attach process.
|
||||
require("ltex_extra").setup()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>ge', function() vim.diagnostic.goto_next() end, bufopts)
|
||||
vim.keymap.set('n', '<space>gE', function() vim.diagnostic.goto_prev() end, bufopts)
|
||||
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
end
|
||||
|
||||
-- ADD NVIM CMP AS A CAPABILITY
|
||||
local lsp_defaults = lspconfig.util.default_config
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
'force',
|
||||
lsp_defaults.capabilities,
|
||||
require('cmp_nvim_lsp').default_capabilities()
|
||||
)
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
|
||||
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
lspconfig["ocamllsp"].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities
|
||||
capabilities = capabilities,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
M.change_theme = function(scheme)
|
||||
vim.cmd('colorscheme ' .. scheme)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local present, silicon = pcall(require,'silicon')
|
||||
|
||||
-- Generate image of lines in a visual selection
|
||||
vim.keymap.set('v', '<Leader>s', function() silicon.visualise_api() end )
|
||||
-- Generate image of a whole buffer, with lines in a visual selection highlighted
|
||||
vim.keymap.set('v', '<Leader>bs', function() silicon.visualise_api({to_clip = true, show_buf = true}) end )
|
208
.config/nvim/syntax/why3.vim
Normal file
208
.config/nvim/syntax/why3.vim
Normal file
|
@ -0,0 +1,208 @@
|
|||
" Vim syntax file
|
||||
" Language: Why3
|
||||
" Filenames: *.why *.mlw
|
||||
"
|
||||
" Adapted from syntax file for Ocaml
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax") && b:current_syntax == "why3"
|
||||
finish
|
||||
endif
|
||||
|
||||
" Why3 is case sensitive.
|
||||
syn case match
|
||||
|
||||
" " Script headers highlighted like comments
|
||||
" syn match whyComment "^#!.*"
|
||||
|
||||
" lowercase identifier - the standard way to match
|
||||
syn match whyLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/
|
||||
|
||||
syn match whyKeyChar "|"
|
||||
|
||||
" Errors
|
||||
syn match whyBraceErr "}"
|
||||
syn match whyBrackErr "\]"
|
||||
syn match whyParenErr ")"
|
||||
|
||||
syn match whyCommentErr "\*)"
|
||||
|
||||
syn match whyCountErr "\<downto\>"
|
||||
syn match whyCountErr "\<to\>"
|
||||
|
||||
syn match whyDoErr "\<do\>"
|
||||
syn match whyDoneErr "\<done\>"
|
||||
syn match whyThenErr "\<then\>"
|
||||
syn match whyTheoryErr "\<theory\>"
|
||||
syn match whyModuleErr "\<module\>"
|
||||
syn match whyEndErr "\<end\>"
|
||||
|
||||
" Some convenient clusters
|
||||
syn cluster whyAllErrs contains=whyBraceErr,whyBrackErr,whyParenErr,whyCommentErr,whyCountErr,whyDoErr,whyDoneErr,whyEndErr,whyThenErr,whyTheoryErr,whyModuleErr
|
||||
|
||||
syn cluster whyContained contains=whyTodo,whyImport,whyExport,whyTheoryContents,whyModuleContents,whyScopeContents,whyModuleKeyword
|
||||
" ,whyPreDef,whyModParam,whyModParam1,whyPreMPRestr,whyMPRestr,whyMPRestr1,whyMPRestr2,whyMPRestr3,whyModRHS,whyFuncWith,whyFuncStruct,whyModTypeRestr,whyModTRWith,whyWith,whyWithRest,whyModType,whyFullMod,whyVal
|
||||
|
||||
" Enclosing delimiters
|
||||
syn region whyEncl transparent matchgroup=whyKeyChar start="(" matchgroup=whyKeyChar end=")" contains=ALLBUT,@whyContained,whyParenErr
|
||||
syn region whyEncl transparent matchgroup=whyKeyChar start="{" matchgroup=whyKeyChar end="}" contains=ALLBUT,@whyContained,whyBraceErr
|
||||
syn region whyEncl transparent start="\[" end="\]" contains=ALLBUT,@whyContained,whyBrackErr
|
||||
|
||||
" Comments
|
||||
syn region whyComment start="(\*" end="\*)" contains=whyComment,whyTodo
|
||||
syn match whyOperator "(\*)"
|
||||
|
||||
syn keyword whyTodo contained TODO FIXME XXX NOTE
|
||||
|
||||
" Blocks
|
||||
" FIXME? match and try should detect the absence of "with" ?
|
||||
syn region whyEnd matchgroup=whyKeyword start="\<begin\>" matchgroup=whyKeyword end="\<end\>" contains=ALLBUT,@whyContained,whyEndErr
|
||||
syn region whyEnd matchgroup=whyKeyword start="\<match\>" matchgroup=whyKeyword end="\<end\>" contains=ALLBUT,@whyContained,whyEndErr
|
||||
syn region whyEnd matchgroup=whyKeyword start="\<try\>" matchgroup=whyKeyword end="\<end\>" contains=ALLBUT,@whyContained,whyEndErr
|
||||
syn region whyNone matchgroup=whyKeyword start="\<for\>" matchgroup=whyKeyword end="\<\(to\|downto\)\>" contains=ALLBUT,@whyContained,whyCountErr
|
||||
syn region whyDo matchgroup=whyKeyword start="\<do\>" matchgroup=whyKeyword end="\<done\>" contains=ALLBUT,@whyContained,whyDoneErr
|
||||
syn region whyNone matchgroup=whyKeyword start="\<if\>" matchgroup=whyKeyword end="\<then\>" contains=ALLBUT,@whyContained,whyThenErr
|
||||
|
||||
" Theories and modules
|
||||
|
||||
syn region whyTheory matchgroup=whyKeyword start="\<theory\>" matchgroup=whyModSpec end="\<\u\(\w\|'\)*\>" contains=@whyAllErrs,whyComment skipwhite skipempty nextgroup=whyModuleContents
|
||||
syn region whyModule matchgroup=whyKeyword start="\<module\>" matchgroup=whyModSpec end="\<\u\(\w\|'\)*\>" contains=@whyAllErrs,whyComment skipwhite skipempty nextgroup=whyModuleContents
|
||||
syn region whyScope matchgroup=whyKeyword start="\<scope\>" matchgroup=whyModSpec end="\<\u\(\w\|'\)*\>" contains=@whyAllErrs,whyComment,whyImport skipwhite skipempty nextgroup=whyModuleContents
|
||||
|
||||
syn region whyModuleContents start="" matchgroup=whyModSpec end="\<end\>" contained contains=ALLBUT,@whyContained,whyEndErr,whyTheory,whyModule
|
||||
|
||||
syn region whyNone matchgroup=whyKeyword start="\<\(use\|clone\)\>" matchgroup=whyModSpec end="\<\(\w\+\.\)*\u\(\w\|'\)*\>" contains=@whyAllErrs,whyComment,whyString,whyImport,whyExport
|
||||
syn keyword whyExport contained export
|
||||
syn keyword whyImport contained import
|
||||
|
||||
syn region whyNone matchgroup=whyKeyword start="\<import\>" matchgroup=whyModSpec end="\<\(\u\(\w\|'\)*\.\)*\u\(\w\|'\)*\>" contains=@whyAllErrs,whyComment
|
||||
|
||||
syn region whyNone matchgroup=whyKeyword start="\<\(axiom\|lemma\|goal\)\>" matchgroup=whyNone end="\<\w\(\w\|'\)\>\|" contains=@whyAllErrs,whyComment
|
||||
|
||||
syn keyword whyKeyword abstract any as break by
|
||||
syn keyword whyKeyword coinductive constant continue
|
||||
syn keyword whyKeyword else epsilon exists exception
|
||||
syn keyword whyKeyword forall fun function ghost
|
||||
syn keyword whyKeyword if in inductive
|
||||
syn keyword whyKeyword label let
|
||||
syn keyword whyKeyword meta model mutable not
|
||||
syn keyword whyKeyword partial predicate private
|
||||
syn keyword whyKeyword raise rec return so then type
|
||||
syn keyword whyKeyword val while with
|
||||
|
||||
syn keyword whyBoolean true false
|
||||
|
||||
syn keyword whyType bool float int list map option real range
|
||||
syn keyword whyType array ref unit
|
||||
|
||||
syn keyword whySpec absurd alias assert assume check diverges ensures invariant
|
||||
syn keyword whySpec pure raises reads requires returns variant writes at old
|
||||
|
||||
syn match whyConstructor "(\s*)"
|
||||
syn match whyConstructor "\u\(\w\|'\)*\>"
|
||||
syn match whyModPath "\u\(\w\|'\)*\."he=e-1
|
||||
|
||||
syn region whyString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
|
||||
syn match whyOperator "->"
|
||||
syn match whyOperator "<->\?"
|
||||
syn match whyOperator "/\\"
|
||||
syn match whyOperator "\\/"
|
||||
syn match whyOperator "&&"
|
||||
syn match whyOperator "<>"
|
||||
syn match whyKeyChar "|"
|
||||
syn match whyKeyChar ";"
|
||||
" FIXME? is this too inefficient?
|
||||
syn match whyOperator "[^<>~=:+*/%$&@^.|#!?]=[^<>~=:+*/%$&@^.|#!?]"ms=s+1,me=e-1
|
||||
syn match whyOperator "^=[^<>~=:+*/%$&@^.|#!?]"me=e-1
|
||||
syn match whyOperator "[^<>~=:+*/%$&@^.|#!?]=$"ms=s+1
|
||||
|
||||
syn match whyAnyVar "\<_\>"
|
||||
|
||||
syn match whyNumber "\<-\=\d\(_\|\d\)*\>"
|
||||
syn match whyNumber "\<-\=0[x|X]\(\x\|_\)\+\>"
|
||||
syn match whyNumber "\<-\=0[o|O]\(\o\|_\)\+\>"
|
||||
syn match whyNumber "\<-\=0[b|B]\([01]\|_\)\+\>"
|
||||
syn match whyFloat "\<-\=\d\+[eE][-+]\=\d\+\>"
|
||||
syn match whyFloat "\<-\=\d\+\.\d*\([eE][-+]\=\d\+\)\=\>"
|
||||
syn match whyFloat "\<-\=0[x|X]\x\+\.\?\x*[pP][-+]\=\d\+\>"
|
||||
|
||||
" Synchronization
|
||||
syn sync minlines=50
|
||||
syn sync maxlines=500
|
||||
|
||||
syn sync match whyDoSync grouphere whyDo "\<do\>"
|
||||
syn sync match whyDoSync groupthere whyDo "\<done\>"
|
||||
|
||||
syn sync match whyEndSync grouphere whyEnd "\<\(begin\|match\|try\)\>"
|
||||
syn sync match whyEndSync groupthere whyEnd "\<end\>"
|
||||
|
||||
syn sync match whyTheorySync grouphere whyTheory "\<theory\>"
|
||||
syn sync match whyTheorySync groupthere whyTheory "\<end\>"
|
||||
|
||||
syn sync match whyModuleSync grouphere whyModule "\<module\>"
|
||||
syn sync match whyModuleSync groupthere whyModule "\<end\>"
|
||||
|
||||
syn sync match whyScopeSync grouphere whyScope "\<scope\>"
|
||||
syn sync match whyScopeSync groupthere whyScope "\<end\>"
|
||||
|
||||
" Define the default highlighting.
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||
if version >= 508 || !exists("did_why_syntax_inits")
|
||||
if version < 508
|
||||
let did_why_syntax_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink whyBraceErr Error
|
||||
HiLink whyBrackErr Error
|
||||
HiLink whyParenErr Error
|
||||
HiLink whyCommentErr Error
|
||||
HiLink whyCountErr Error
|
||||
HiLink whyDoErr Error
|
||||
HiLink whyDoneErr Error
|
||||
HiLink whyEndErr Error
|
||||
HiLink whyThenErr Error
|
||||
HiLink whyTheoryErr Error
|
||||
HiLink whyModuleErr Error
|
||||
|
||||
HiLink whyComment Comment
|
||||
|
||||
HiLink whyModPath Include
|
||||
HiLink whyModSpec Include
|
||||
HiLink whyImport Keyword
|
||||
HiLink whyExport Keyword
|
||||
HiLink whyModuleKeyword Keyword
|
||||
|
||||
HiLink whyConstructor Constant
|
||||
|
||||
HiLink whyKeyword Keyword
|
||||
HiLink whyKeyChar Operator
|
||||
HiLink whyAnyVar Operator
|
||||
HiLink whyOperator Operator
|
||||
HiLink whySpec Identifier
|
||||
|
||||
HiLink whyNumber Number
|
||||
HiLink whyFloat Float
|
||||
HiLink whyString String
|
||||
HiLink whyBoolean Boolean
|
||||
|
||||
HiLink whyType Type
|
||||
|
||||
HiLink whyTodo Todo
|
||||
|
||||
HiLink whyEncl Keyword
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "why3"
|
||||
|
||||
" vim: ts=8
|
||||
|
Loading…
Reference in a new issue