mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 22:59:15 +00:00
ref(nix): drop neovim legacy support
This commit is contained in:
parent
83bdeb6977
commit
8e78bef74b
30 changed files with 1 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
|||
home.file = {
|
||||
neovim = {
|
||||
recursive = true;
|
||||
source = ../../../../.config/nvim;
|
||||
source = ./nvim;
|
||||
target = ".config/nvim";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
24
nix/home/common/neovim/nvim/after/plugin/autopairs.lua
Normal file
24
nix/home/common/neovim/nvim/after/plugin/autopairs.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
local Rule = require "nvim-autopairs.rule"
|
||||
local cond = require "nvim-autopairs.conds"
|
||||
local npairs = require "nvim-autopairs"
|
||||
|
||||
npairs.setup()
|
||||
|
||||
-- Intergration with `cmp`
|
||||
local cmp = require "cmp"
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
-------------------
|
||||
-- Tex and Typst --
|
||||
-------------------
|
||||
npairs.add_rules {
|
||||
Rule("$", "$", { "tex", "typst" })
|
||||
:with_pair(cond.not_before_regex "%a")
|
||||
:with_pair(cond.not_after_regex "%a")
|
||||
:with_move(cond.done),
|
||||
|
||||
Rule("```", "```", "typst")
|
||||
:with_pair(cond.not_before_text "```")
|
||||
:with_cr(cond.done),
|
||||
}
|
||||
229
nix/home/common/neovim/nvim/after/plugin/cmp.lua
Normal file
229
nix/home/common/neovim/nvim/after/plugin/cmp.lua
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
local cmp = require "cmp"
|
||||
local ls = require "luasnip"
|
||||
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local cr = function() return t { "", "" } end -- linebreak
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local l = require "luasnip.extras".lambda
|
||||
local rep = require "luasnip.extras".rep
|
||||
local p = require "luasnip.extras".partial
|
||||
local m = require "luasnip.extras".match
|
||||
local n = require "luasnip.extras".nonempty
|
||||
local dl = require "luasnip.extras".dynamic_lambda
|
||||
local fmt = require "luasnip.extras.fmt".fmt
|
||||
local fmta = require "luasnip.extras.fmt".fmta
|
||||
local types = require "luasnip.util.types"
|
||||
local conds = require "luasnip.extras.conditions"
|
||||
local conds_expand = require "luasnip.extras.conditions.expand"
|
||||
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
|
||||
end
|
||||
|
||||
-----------------
|
||||
-- Lazy loader --
|
||||
-----------------
|
||||
require "luasnip.loaders.from_vscode".lazy_load { paths = { "./snippets" } }
|
||||
|
||||
----------
|
||||
-- Init --
|
||||
----------
|
||||
ls.setup { update_events = { "TextChanged", "TextChangedI" } }
|
||||
|
||||
-----------
|
||||
-- Typst --
|
||||
-----------
|
||||
local function show_date_typst_entry()
|
||||
return os.date "(year: %Y, month: %m, day: %d, hour: %H, minute: %M, second: %S)"
|
||||
end
|
||||
ls.add_snippets("typst", {
|
||||
s("entry", {
|
||||
t "#entry(",
|
||||
f(show_date_typst_entry),
|
||||
t { ")[", "" },
|
||||
i(0),
|
||||
t { "", "]" },
|
||||
}),
|
||||
})
|
||||
|
||||
local function get_cms()
|
||||
assert(vim.bo.commentstring ~= "", "comment string is not set")
|
||||
local left = vim.bo.commentstring:gsub("%s*%%s.*", "")
|
||||
local right = vim.bo.commentstring:gsub(".*%%s%s*", "")
|
||||
if right == "" then right = left end
|
||||
return { left = left, right = right }
|
||||
end
|
||||
local function horizon(args)
|
||||
local cms = get_cms()
|
||||
local chr = cms.left:sub(-1)
|
||||
local len = vim.fn.strdisplaywidth(args[1][1])
|
||||
|
||||
local acc = cms.left
|
||||
for _ = cms.left:len(), len + cms.right:len() + 1, 1 do
|
||||
acc = acc .. chr
|
||||
end
|
||||
acc = acc .. cms.right
|
||||
|
||||
return acc
|
||||
end
|
||||
local function left()
|
||||
local cms = get_cms()
|
||||
return cms.left .. " "
|
||||
end
|
||||
local function right()
|
||||
local cms = get_cms()
|
||||
return " " .. cms.right
|
||||
end
|
||||
ls.add_snippets("all", {
|
||||
s("banner", {
|
||||
f(horizon, { 1 }),
|
||||
t { "", "" },
|
||||
f(left), i(1), f(right),
|
||||
t { "", "" },
|
||||
f(horizon, { 1 }),
|
||||
}),
|
||||
})
|
||||
|
||||
------------
|
||||
-- Ledger --
|
||||
------------
|
||||
local function show_date_ledger_entry()
|
||||
return os.date "%Y-%m-%d"
|
||||
end
|
||||
-- shortcuts
|
||||
ls.add_snippets("ledger", {
|
||||
s("lessive", {
|
||||
f(show_date_ledger_entry), t " ", t "Lessive (CROUS)", cr(),
|
||||
t "\texpenses 3,00 EUR", cr(),
|
||||
t "\tassets:compte_courant -3,00 EUR", cr(),
|
||||
}),
|
||||
s("sechoir", {
|
||||
f(show_date_ledger_entry), t " ", t "Sechoir (CROUS)", cr(),
|
||||
t "\texpenses 1,50 EUR", cr(),
|
||||
t "\tassets:compte_courant -1,50 EUR", cr(),
|
||||
}),
|
||||
})
|
||||
|
||||
-- generalized entry
|
||||
local id = function(args) return args[1][1] end
|
||||
ls.add_snippets("ledger", {
|
||||
s("entry", {
|
||||
f(show_date_ledger_entry), t " ", i(1), cr(),
|
||||
t "\texpenses:", i(2), t " ", i(3), t " EUR", cr(),
|
||||
t "\tassets:compte_courant -", f(id, { 3 }), t " EUR", cr(),
|
||||
}),
|
||||
s("entry'", {
|
||||
i(1), t " ", i(2), cr(),
|
||||
t "\texpenses:", i(3), t " ", i(4), t " EUR", cr(),
|
||||
t "\tassets:compte_courant -", f(id, { 4 }), t " EUR", cr(),
|
||||
}),
|
||||
})
|
||||
|
||||
-------------
|
||||
-- Haskell --
|
||||
-------------
|
||||
local haskell_snippets = require "haskell-snippets".all
|
||||
ls.add_snippets("haskell", haskell_snippets, { key = "haskell" })
|
||||
|
||||
---------------
|
||||
-- Setup CMP --
|
||||
---------------
|
||||
local Contains = require "utils".Contains
|
||||
local of_filetype = function(fts)
|
||||
local ft = vim.bo.filetype
|
||||
return Contains(fts, ft)
|
||||
end
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
ls.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<Tab>"] = cmp.mapping(function(fallback) -- Next or jump
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif ls.expand_or_locally_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback) -- Previous
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<A-Tab>"] = cmp.mapping(function(fallback) -- Force jump
|
||||
if ls.expand_or_locally_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<CR>"] = cmp.mapping(function(fallback) -- Confirm
|
||||
if cmp.visible() then
|
||||
cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
} ()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-CR>"] = cmp.mapping(function(fallback) -- Confirm and replace
|
||||
if cmp.visible() then
|
||||
cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
} ()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
{
|
||||
name = "buffer", keyword_length = 10,
|
||||
option = {
|
||||
enable_in_context = function()
|
||||
return of_filetype {
|
||||
"tex",
|
||||
"markdown",
|
||||
"typst",
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "spell", keyword_length = 10,
|
||||
option = {
|
||||
keep_all_entries = true,
|
||||
enable_in_context = function()
|
||||
return of_filetype {
|
||||
"tex",
|
||||
"markdown",
|
||||
"typst",
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
21
nix/home/common/neovim/nvim/after/plugin/colorizer.lua
Normal file
21
nix/home/common/neovim/nvim/after/plugin/colorizer.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local default = {
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes
|
||||
names = false, -- "Name" codes like Blue or blue
|
||||
RRGGBBAA = false, -- #RRGGBBAA hex codes
|
||||
AARRGGBB = false, -- 0xAARRGGBB hex codes
|
||||
rgb_fn = false, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = false, -- CSS hsl() and hsla() functions
|
||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
|
||||
mode = "background",
|
||||
always_update = true,
|
||||
}
|
||||
|
||||
require "colorizer".setup {
|
||||
filetypes = {
|
||||
"*",
|
||||
},
|
||||
user_default_options = default,
|
||||
}
|
||||
38
nix/home/common/neovim/nvim/after/plugin/gitsigns.lua
Normal file
38
nix/home/common/neovim/nvim/after/plugin/gitsigns.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
require "gitsigns".setup {
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map("n", "<leader>hj", gs.next_hunk)
|
||||
map("n", "<leader>hk", gs.prev_hunk)
|
||||
|
||||
-- Actions
|
||||
map("n", "<leader>hs", gs.stage_hunk)
|
||||
map("n", "<leader>hu", gs.undo_stage_hunk)
|
||||
map("n", "<leader>hr", gs.reset_hunk)
|
||||
|
||||
map("v", "<leader>hs", function() gs.stage_hunk { vim.fn.line ".", vim.fn.line "v" } end)
|
||||
map("v", "<leader>hr", function() gs.reset_hunk { vim.fn.line ".", vim.fn.line "v" } end)
|
||||
|
||||
map("n", "<leader>hS", gs.stage_buffer)
|
||||
map("n", "<leader>hR", gs.reset_buffer)
|
||||
|
||||
map("n", "<leader>hp", gs.preview_hunk)
|
||||
map("n", "<leader>hb", function() gs.blame_line { full = true } end)
|
||||
map("n", "<leader>tb", gs.toggle_current_line_blame)
|
||||
|
||||
map("n", "<leader>hd", gs.diffthis)
|
||||
map("n", "<leader>hD", function() gs.diffthis "~" end)
|
||||
|
||||
map("n", "<leader>pd", gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
||||
end,
|
||||
}
|
||||
19
nix/home/common/neovim/nvim/after/plugin/harpoon.lua
Normal file
19
nix/home/common/neovim/nvim/after/plugin/harpoon.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
require "harpoon".setup()
|
||||
|
||||
local ui = require "harpoon.ui"
|
||||
local mark = require "harpoon.mark"
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- add and view
|
||||
map({ "n", "i" }, "<A-c>", function() mark.add_file() end)
|
||||
map({ "n", "i" }, "<A-g>", function() ui.toggle_quick_menu() end)
|
||||
|
||||
-- switch it up!
|
||||
map({ "n", "i" }, "<A-h>", function() ui.nav_file(1) end)
|
||||
map({ "n", "i" }, "<A-t>", function() ui.nav_file(2) end)
|
||||
map({ "n", "i" }, "<A-n>", function() ui.nav_file(3) end)
|
||||
map({ "n", "i" }, "<A-s>", function() ui.nav_file(4) end)
|
||||
map({ "n", "i" }, "<A-m>", function() ui.nav_file(5) end)
|
||||
map({ "n", "i" }, "<A-w>", function() ui.nav_file(6) end)
|
||||
map({ "n", "i" }, "<A-v>", function() ui.nav_file(7) end)
|
||||
map({ "n", "i" }, "<A-z>", function() ui.nav_file(8) end)
|
||||
290
nix/home/common/neovim/nvim/after/plugin/lsp.lua
Normal file
290
nix/home/common/neovim/nvim/after/plugin/lsp.lua
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
local map = vim.keymap.set
|
||||
|
||||
local Foreach = require "utils".Foreach
|
||||
|
||||
----------------------
|
||||
-- Language servers --
|
||||
----------------------
|
||||
-- NOTE: put settings into `settings`
|
||||
-- use another `on_attach` field if needed
|
||||
local servers = {
|
||||
bashls = {}, -- Bash
|
||||
clangd = {}, -- C/CPP
|
||||
cssls = {}, -- CSS
|
||||
html = {}, -- HTML
|
||||
jsonls = {}, -- JSON
|
||||
lemminx = {}, -- XML
|
||||
marksman = {}, -- Markdown
|
||||
phpactor = {}, -- PHP
|
||||
pylsp = {}, -- Python
|
||||
pyright = {},
|
||||
taplo = {}, -- TOML
|
||||
texlab = {}, -- texlab
|
||||
tsserver = {}, -- TypeScript
|
||||
vimls = {}, -- Vim Script
|
||||
ocamllsp = {}, -- OCaml
|
||||
|
||||
typst_lsp = { -- Typst
|
||||
settings = {
|
||||
root_dir =
|
||||
vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1])
|
||||
or vim.loop.cwd(),
|
||||
exportPdf = "never",
|
||||
},
|
||||
},
|
||||
|
||||
lua_ls = { -- Lua
|
||||
settings = {
|
||||
Lua = {
|
||||
format = {
|
||||
defaultConfig = {
|
||||
-- Learn more:
|
||||
-- https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/docs/format_config.md
|
||||
indent_style = "space",
|
||||
quote_style = "double",
|
||||
call_arg_parentheses = "remove",
|
||||
trailing_table_separator = "smart",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
nil_ls = { -- Nix
|
||||
on_attach = function(_, bufno)
|
||||
vim.api.nvim_buf_set_option(bufno, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
map("n", "<leader>f",
|
||||
function()
|
||||
vim.cmd ":w"
|
||||
vim.cmd [[silent exec "!alejandra %"]]
|
||||
vim.cmd ":e"
|
||||
end,
|
||||
{ buffer = bufno })
|
||||
end,
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
-------------
|
||||
-- Helpers --
|
||||
-------------
|
||||
local on_attach = function(client, bufno)
|
||||
vim.api.nvim_buf_set_option(bufno, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
local ts = require "telescope.builtin"
|
||||
local opts = { buffer = bufno }
|
||||
|
||||
map("n", "K", vim.lsp.buf.hover, opts)
|
||||
map("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||
map("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
map("n", "gd", vim.lsp.buf.definition, opts)
|
||||
map("n", "gtd", vim.lsp.buf.type_definition, opts)
|
||||
map("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
map("n", "gu", ts.lsp_references, opts)
|
||||
map("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
map("n", "<leader>cl", vim.lsp.codelens.run, opts)
|
||||
map("n", "<leader>r", vim.lsp.buf.rename, opts)
|
||||
map("n", "<leader>f", function() vim.lsp.buf.format { async = true } end, opts)
|
||||
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
require "nvim-navic".attach(client, bufno)
|
||||
end
|
||||
end
|
||||
|
||||
-- Helix style border
|
||||
local border = {
|
||||
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
|
||||
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
|
||||
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
|
||||
{ " ", "FloatBorder" }, { " ", "FloatBorder" },
|
||||
}
|
||||
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
|
||||
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
||||
opts = opts or {}
|
||||
opts.border = border
|
||||
return orig_util_open_floating_preview(contents, syntax, opts, ...)
|
||||
end
|
||||
|
||||
-- Type signature
|
||||
require "lsp_signature".setup {
|
||||
doc_lines = 7,
|
||||
bind = true,
|
||||
border = border,
|
||||
hint_enable = false,
|
||||
}
|
||||
|
||||
-- Diagnostic display configuration
|
||||
vim.diagnostic.config { virtual_text = false, severity_sort = true }
|
||||
|
||||
-- Set log level
|
||||
vim.lsp.set_log_level "off"
|
||||
|
||||
-- Gutter symbols setup
|
||||
vim.fn.sign_define("DiagnosticSignError",
|
||||
{ text = "E", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" })
|
||||
vim.fn.sign_define("DiagnosticSignWarn", { text = "W", texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" })
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "H", texthl = "DiagnosticSignHint", numhl = "DiagnosticSignHint" })
|
||||
vim.fn.sign_define("DiagnosticSignInfo", { text = "·", texthl = "DiagnosticSignInfo", numhl = "DiagnosticSignInfo" })
|
||||
|
||||
-- Capabilities
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require "cmp_nvim_lsp".default_capabilities(capabilities)
|
||||
|
||||
----------
|
||||
-- Init --
|
||||
----------
|
||||
require "fidget".setup { text = { spinner = "dots" } }
|
||||
require "neodev".setup()
|
||||
|
||||
-- Folding
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local suffix = (" %d "):format(endLnum - lnum)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||
return newVirtText
|
||||
end
|
||||
require "ufo".setup { fold_virt_text_handler = handler }
|
||||
|
||||
Foreach(servers,
|
||||
function(k, v)
|
||||
require "lspconfig"[k].setup {
|
||||
capabilities = capabilities,
|
||||
settings = v.settings,
|
||||
on_attach = function(client, bufno)
|
||||
on_attach(client, bufno)
|
||||
v.on_attach(client, bufno)
|
||||
end,
|
||||
}
|
||||
end)
|
||||
|
||||
------------------------
|
||||
-- Standalone plugins --
|
||||
------------------------
|
||||
-- Java
|
||||
local config = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
cmd = {
|
||||
-- https://github.com/NixOS/nixpkgs/issues/232822#issuecomment-1564243667
|
||||
-- `-data` argument is necessary
|
||||
"jdt-language-server",
|
||||
"-data", vim.fn.expand "~/.cache/jdtls" .. vim.fn.expand "%:p:h",
|
||||
},
|
||||
root_dir = vim.fs.dirname(vim.fs.find({ "gradlew", ".git", "mvnw" }, { upward = true })[1]),
|
||||
}
|
||||
local jdtls_group = vim.api.nvim_create_augroup("jdtls", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "java" },
|
||||
callback = function()
|
||||
require "jdtls".start_or_attach(config)
|
||||
end,
|
||||
group = jdtls_group,
|
||||
})
|
||||
|
||||
-- Scala
|
||||
local metals = require "metals"
|
||||
local metals_config = metals.bare_config()
|
||||
metals_config.capabilities = capabilities
|
||||
metals_config.settings.useGlobalExecutable = true
|
||||
|
||||
require "dap".configurations.scala = {
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "RunOrTest",
|
||||
metals = { runType = "runOrTestFile" },
|
||||
},
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Test Target",
|
||||
metals = { runType = "testTarget" },
|
||||
},
|
||||
}
|
||||
|
||||
metals_config.on_attach = function(client, bufnr)
|
||||
metals.setup_dap()
|
||||
|
||||
map("n", "<leader>ws", metals.hover_worksheet)
|
||||
|
||||
map("n", "<leader>dc", require "dap".continue)
|
||||
map("n", "<leader>dr", require "dap".repl.toggle)
|
||||
map("n", "<leader>dK", require "dap.ui.widgets".hover)
|
||||
map("n", "<leader>dt", require "dap".toggle_breakpoint)
|
||||
map("n", "<leader>dso", require "dap".step_over)
|
||||
map("n", "<leader>dsi", require "dap".step_into)
|
||||
map("n", "<leader>dl", require "dap".run_last)
|
||||
|
||||
on_attach(client, bufnr)
|
||||
end
|
||||
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "scala", "sbt" },
|
||||
callback = function()
|
||||
require "metals".initialize_or_attach(metals_config)
|
||||
end,
|
||||
group = nvim_metals_group,
|
||||
})
|
||||
|
||||
-- Haskell
|
||||
vim.g.haskell_tools = {
|
||||
tools = {
|
||||
log = { level = vim.log.levels.OFF },
|
||||
hover = {
|
||||
border = border,
|
||||
stylize_markdown = true,
|
||||
},
|
||||
},
|
||||
hls = {
|
||||
on_attach = function(client, bufnr)
|
||||
local ht = require "haskell-tools"
|
||||
local opts = { buffer = bufnr }
|
||||
|
||||
map("n", "<leader>hhe", ht.lsp.buf_eval_all, opts)
|
||||
map("n", "<leader>hhs", ht.hoogle.hoogle_signature, opts)
|
||||
map("n", "<leader>hhr", ht.repl.toggle, opts)
|
||||
|
||||
vim.opt_local.shiftwidth = 2
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
default_settings = {
|
||||
haskell = {
|
||||
-- formattingProvider = "fourmolu",
|
||||
formattingProvider = "stylish-haskell",
|
||||
cabalFormattingProvider = "cabal-fmt",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Rust
|
||||
require "rust-tools".setup {
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
cmd = { "rustup", "run", "stable", "rust-analyzer" },
|
||||
},
|
||||
}
|
||||
70
nix/home/common/neovim/nvim/after/plugin/lualine.lua
Normal file
70
nix/home/common/neovim/nvim/after/plugin/lualine.lua
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
local function diagnostic_message()
|
||||
local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local ds = vim.diagnostic.get(0, { lnum = row - 1 })
|
||||
if #ds >= 1 then
|
||||
return ds[1].message:gsub("%%", "%%%%");
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local grey = {
|
||||
a = { bg = "#e4e4e5" },
|
||||
b = { bg = "#e4e4e5" },
|
||||
c = { bg = "#e4e4e5" },
|
||||
x = { bg = "#e4e4e5" },
|
||||
y = { bg = "#e4e4e5" },
|
||||
z = { bg = "#e4e4e5" },
|
||||
}
|
||||
|
||||
local curry_theme = {
|
||||
normal = grey,
|
||||
insert = grey,
|
||||
visual = grey,
|
||||
replace = grey,
|
||||
inactive = grey,
|
||||
}
|
||||
|
||||
|
||||
local sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {
|
||||
{
|
||||
"diagnostics",
|
||||
colored = true,
|
||||
symbols = { error = "E", warn = "W", info = "·", hint = "H" },
|
||||
},
|
||||
diagnostic_message,
|
||||
},
|
||||
lualine_c = { "navic" },
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = { "progress", "branch" },
|
||||
}
|
||||
|
||||
require "lualine".setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = curry_theme,
|
||||
component_separators = {},
|
||||
section_separators = {},
|
||||
disabled_filetypes = {
|
||||
statusline = { "fugitive" },
|
||||
winbar = { "fugitive" },
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = sections,
|
||||
inactive_sections = sections,
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
tabline = {},
|
||||
extensions = {},
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
require "no-neck-pain".setup {
|
||||
width = 75,
|
||||
buffers = {
|
||||
right = { enabled = false },
|
||||
},
|
||||
}
|
||||
32
nix/home/common/neovim/nvim/after/plugin/oil.lua
Normal file
32
nix/home/common/neovim/nvim/after/plugin/oil.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
require "oil".setup {
|
||||
default_file_explorer = false,
|
||||
columns = {
|
||||
"icon",
|
||||
"permissions",
|
||||
-- "size",
|
||||
-- "mtime",
|
||||
},
|
||||
skip_confirm_for_simple_edits = true,
|
||||
prompt_save_on_select_new_entry = false,
|
||||
keymaps = {
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-v>"] = "actions.select_vsplit",
|
||||
["<C-x>"] = "actions.select_split",
|
||||
["<C-t>"] = "actions.select_tab",
|
||||
["<C-p>"] = "actions.preview",
|
||||
["<C-c>"] = "actions.close",
|
||||
["<C-l>"] = "actions.refresh",
|
||||
["-"] = "actions.parent",
|
||||
["_"] = "actions.open_cwd",
|
||||
["`"] = "actions.cd",
|
||||
["~"] = "actions.tcd",
|
||||
["gs"] = "actions.change_sort",
|
||||
["gx"] = "actions.open_external",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
["g\\"] = "actions.toggle_trash",
|
||||
},
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
}
|
||||
46
nix/home/common/neovim/nvim/after/plugin/telescope.lua
Normal file
46
nix/home/common/neovim/nvim/after/plugin/telescope.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
local ts = require "telescope"
|
||||
local actions = require "telescope.actions"
|
||||
local themes = require "telescope.themes"
|
||||
local config = require "telescope.config"
|
||||
local builtin = require "telescope.builtin"
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- Clone the default Telescope configuration
|
||||
local vimgrep_arguments = { unpack(config.values.vimgrep_arguments) }
|
||||
|
||||
table.insert(vimgrep_arguments, "--hidden") -- search hidden
|
||||
table.insert(vimgrep_arguments, "--glob") -- ignore git
|
||||
table.insert(vimgrep_arguments, "!**/.git/*")
|
||||
|
||||
ts.setup {
|
||||
defaults = {
|
||||
vimgrep_arguments = vimgrep_arguments,
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require "telescope".load_extension, "fzf")
|
||||
|
||||
|
||||
map("n", "<leader>/",
|
||||
function()
|
||||
builtin.current_buffer_fuzzy_find(themes.get_dropdown { previewer = false })
|
||||
end
|
||||
)
|
||||
map("n", "<leader>sf", builtin.find_files)
|
||||
map("n", "<leader>gf", builtin.git_files)
|
||||
map("n", "<leader>?", builtin.help_tags)
|
||||
map("n", "<leader>sw", builtin.grep_string)
|
||||
map("n", "<leader>sg", builtin.live_grep)
|
||||
map("n", "<leader>sd", builtin.diagnostics)
|
||||
map("n", "<leader>b", builtin.buffers)
|
||||
11
nix/home/common/neovim/nvim/after/plugin/todo-comments.lua
Normal file
11
nix/home/common/neovim/nvim/after/plugin/todo-comments.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
require "todo-comments".setup {
|
||||
keywords = {
|
||||
FIX = { icon = " ", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } },
|
||||
TODO = { icon = " ", color = "info" },
|
||||
HACK = { icon = "!", color = "warning", alt = { "DEBUG" } },
|
||||
WARN = { icon = "!", color = "warning", alt = { "WARNING", "XXX" } },
|
||||
NOTE = { icon = "·", color = "hint", alt = { "INFO" } },
|
||||
TEST = { icon = "T", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
Q = { icon = "?", color = "warning" },
|
||||
},
|
||||
}
|
||||
56
nix/home/common/neovim/nvim/after/plugin/treesitter.lua
Normal file
56
nix/home/common/neovim/nvim/after/plugin/treesitter.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
require "nvim-treesitter.configs".setup {
|
||||
|
||||
ensure_installed = {},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
|
||||
-- Disable for large files
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
-- Text objets
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
selection_modes = {
|
||||
["@parameter.outer"] = "v", -- charwise
|
||||
["@function.outer"] = "V", -- linewise
|
||||
["@class.outer"] = "<c-v>", -- blockwise
|
||||
},
|
||||
include_surrounding_whitespace = true,
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>a"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>A"] = "@parameter.inner",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require "treesitter-context".setup {
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
max_lines = 2, -- How many lines the window should span. Values < = 0 mean no limit.
|
||||
min_window_height = 0, -- Minimum editor window height to enable context. Values < = 0 mean no limit.
|
||||
line_numbers = true,
|
||||
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
|
||||
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = "topline", -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
zindex = 20, -- The Z-index of the context window
|
||||
}
|
||||
168
nix/home/common/neovim/nvim/init.lua
Normal file
168
nix/home/common/neovim/nvim/init.lua
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require "keymap"
|
||||
require "options"
|
||||
require "autocmds"
|
||||
|
||||
require "lazy".setup {
|
||||
|
||||
----------------------
|
||||
-- Misc / utilities --
|
||||
----------------------
|
||||
"nvim-tree/nvim-web-devicons", -- Icons
|
||||
"tpope/vim-sleuth", -- Tab / Space detection
|
||||
"tpope/vim-surround", -- Surround motions
|
||||
"tpope/vim-fugitive", -- Git util
|
||||
"windwp/nvim-autopairs", -- Pair symbols
|
||||
"mbbill/undotree", -- Treeview of history
|
||||
"godlygeek/tabular", -- Vertical alignment
|
||||
"uga-rosa/ccc.nvim", -- Color picker
|
||||
"stevearc/oil.nvim", -- File manager
|
||||
-- `gc` to comment
|
||||
{ "numToStr/Comment.nvim", opts = {} },
|
||||
-- Jump anywhere
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
dependencies = "tpope/vim-repeat",
|
||||
config = function() require "leap".add_default_mappings() end,
|
||||
},
|
||||
-- Folding
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
dependencies = "kevinhwang91/promise-async",
|
||||
},
|
||||
-- Generate `.gitignore`
|
||||
{
|
||||
"wintermute-cell/gitignore.nvim",
|
||||
dependencies = "nvim-telescope/telescope.nvim",
|
||||
},
|
||||
|
||||
----------------
|
||||
-- Style / UI --
|
||||
----------------
|
||||
"folke/twilight.nvim", -- Zen mode
|
||||
{ "shortcuts/no-neck-pain.nvim", version = "*" }, -- Align buffer
|
||||
"lewis6991/gitsigns.nvim", -- Gitsigns in gutter
|
||||
"NvChad/nvim-colorizer.lua", -- Show color
|
||||
-- Jump like a ninja
|
||||
{ "ThePrimeagen/harpoon", dependencies = "nvim-lua/plenary.nvim" },
|
||||
-- Highlight comments
|
||||
{ "folke/todo-comments.nvim", dependencies = "nvim-lua/plenary.nvim" },
|
||||
-- Status line
|
||||
"nvim-lualine/lualine.nvim",
|
||||
-- Breadcrumbs
|
||||
{ "SmiteshP/nvim-navic", dependencies = "neovim/nvim-lspconfig" },
|
||||
|
||||
---------------
|
||||
-- LSP / DAP --
|
||||
---------------
|
||||
{
|
||||
"neovim/nvim-lspconfig", -- (official) basic LSP Configuration & Plugins
|
||||
dependencies = {
|
||||
{ "j-hui/fidget.nvim", tag = "legacy" }, -- LSP Spinner
|
||||
"folke/neodev.nvim", -- Additional lua configuration
|
||||
},
|
||||
},
|
||||
"mfussenegger/nvim-dap", -- DAP
|
||||
{ "ray-x/lsp_signature.nvim", event = "VeryLazy" },
|
||||
|
||||
-----------------------
|
||||
-- Language specific --
|
||||
-----------------------
|
||||
-- Java
|
||||
"mfussenegger/nvim-jdtls",
|
||||
-- Scala
|
||||
{ "scalameta/nvim-metals", dependencies = "nvim-lua/plenary.nvim" },
|
||||
-- Rust
|
||||
{ "simrat39/rust-tools.nvim", dependencies = "neovim/nvim-lspconfig" },
|
||||
-- Haskell
|
||||
{
|
||||
"mrcjkb/haskell-tools.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" },
|
||||
ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
|
||||
branch = "2.x.x",
|
||||
},
|
||||
-- Typst
|
||||
{
|
||||
"kaarmu/typst.vim",
|
||||
ft = "typst",
|
||||
lazy = false,
|
||||
},
|
||||
-- HTML / JavaScript (live preview)
|
||||
{
|
||||
"turbio/bracey.vim",
|
||||
build = "npm install --prefix server",
|
||||
},
|
||||
|
||||
---------------
|
||||
-- Telescope --
|
||||
---------------
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
cond = vim.fn.executable "make" == 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
----------------
|
||||
-- TreeSitter --
|
||||
----------------
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
{ "nvim-treesitter/nvim-treesitter-context" },
|
||||
{ "nvim-treesitter/playground", enabled = false },
|
||||
|
||||
-----------
|
||||
-- Games --
|
||||
-----------
|
||||
"ThePrimeagen/vim-be-good",
|
||||
"Eandrju/cellular-automaton.nvim",
|
||||
"wakatime/vim-wakatime",
|
||||
|
||||
------------------
|
||||
-- Colorschemes --
|
||||
------------------
|
||||
"owickstrom/vim-colors-paramount",
|
||||
{ "https://git.earth2077.fr/leana/curry.nvim", branch = "lua" },
|
||||
|
||||
----------------
|
||||
-- Completion --
|
||||
----------------
|
||||
{
|
||||
"hrsh7th/nvim-cmp", -- Autocompletion
|
||||
dependencies = {
|
||||
"L3MON4D3/LuaSnip", -- Snippet Engine
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lsp", -- LSP completion
|
||||
"rafamadriz/friendly-snippets", -- Adds a number of user-friendly snippets
|
||||
"hrsh7th/cmp-buffer", -- Buffer cmp Source
|
||||
"f3fora/cmp-spell", -- Spell cmp source
|
||||
"mrcjkb/haskell-snippets.nvim", -- Haskell snippets
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
vim.cmd.colorscheme "curry"
|
||||
56
nix/home/common/neovim/nvim/lazy-lock.json
Normal file
56
nix/home/common/neovim/nvim/lazy-lock.json
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "68153ebb03e65d8a437c6240553645c57f17cf99" },
|
||||
"bracey.vim": { "branch": "master", "commit": "4e1a22acc01787814819df1057d039d4ecf357eb" },
|
||||
"ccc.nvim": { "branch": "main", "commit": "ec6e23fd2c0bf4ffcf71c1271acdcee6e2c6f49c" },
|
||||
"cellular-automaton.nvim": { "branch": "main", "commit": "b7d056dab963b5d3f2c560d92937cb51db61cb5b" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"curry.nvim": { "branch": "lua", "commit": "cbd7769bd905a6c9f7616d73cce577633a4fc74f" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
|
||||
"gitignore.nvim": { "branch": "master", "commit": "e0e0c511595681ef826a91a9e8449e86049406a0" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "3e6e91b09f0468c32d3b96dcacf4b947f037ce25" },
|
||||
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
|
||||
"haskell-snippets.nvim": { "branch": "master", "commit": "76ac831abfbe260e5c85ceb7ac73bbf29a684fa2" },
|
||||
"haskell-tools.nvim": { "branch": "2.x.x", "commit": "92e097c6832405fb64e4c44a7ce8bebe7836cae6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||
"leap.nvim": { "branch": "main", "commit": "b63f14d7474002573710d10f02f1af33a4910490" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "fed2c8389c148ff1dfdcdca63c2b48d08a50dea0" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "be8d4d4cab6c13c6a572269c9d6a63774baba9a0" },
|
||||
"no-neck-pain.nvim": { "branch": "main", "commit": "b305821ca45897db6276e9ae5893747bb24040c7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||
"nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" },
|
||||
"nvim-jdtls": { "branch": "master", "commit": "66b5ace68a5d1c45fdfb1afa8d847e87af2aa1f8" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" },
|
||||
"nvim-metals": { "branch": "main", "commit": "1e269f1f01e6b970603d51e9e044824d9d8114e7" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "5032f9952ad2a3a7f7792ac438c4f9e2bd53e0b9" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "652ec514d6ba8bc4a3c2de76c855fe668e2c7196" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "c6d88523f574024b788f1c3400c5d5b9bb1a0407" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" },
|
||||
"oil.nvim": { "branch": "master", "commit": "a128e6f75c6a71b7b9ac7ea663949a5209771cd5" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||
"promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
|
||||
"twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
|
||||
"typst.vim": { "branch": "main", "commit": "630bb8b7faf1fe02c253673a37a70c135ad43a40" },
|
||||
"undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" },
|
||||
"vim-be-good": { "branch": "master", "commit": "c290810728a4f75e334b07dc0f3a4cdea908d351" },
|
||||
"vim-colors-paramount": { "branch": "master", "commit": "a5601d36fb6932e8d1a6f8b37b179a99b1456798" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" },
|
||||
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-wakatime": { "branch": "master", "commit": "8c8856327815a077cbebeba8c7456312a3d2c39c" }
|
||||
}
|
||||
86
nix/home/common/neovim/nvim/lua/autocmds.lua
Normal file
86
nix/home/common/neovim/nvim/lua/autocmds.lua
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
local map = vim.keymap.set
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local usercmd = vim.api.nvim_create_user_command
|
||||
|
||||
vim.filetype.add { extension = { typ = "typst" } }
|
||||
vim.filetype.add { extension = { skel = "skel", sk = "skel" } }
|
||||
vim.filetype.add { extension = { mlw = "why3" } }
|
||||
|
||||
autocmd("TextYankPost", {
|
||||
callback = function() vim.highlight.on_yank() end,
|
||||
})
|
||||
|
||||
autocmd("FileType", {
|
||||
pattern = { "markdown", "tex", "typst" },
|
||||
callback = function()
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.textwidth = 80
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd("Filetype", {
|
||||
pattern = "skel",
|
||||
callback = function()
|
||||
vim.opt_local.commentstring = "(* %s *)"
|
||||
map("n", "<leader>f",
|
||||
function()
|
||||
vim.cmd ":w"
|
||||
vim.cmd [[silent exec "!necroprint % -o %"]]
|
||||
vim.cmd ":e"
|
||||
end,
|
||||
{ buffer = true })
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd("Filetype", {
|
||||
pattern = "why3",
|
||||
callback = function()
|
||||
vim.opt_local.commentstring = "(* %s *)"
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
end,
|
||||
})
|
||||
|
||||
-- Using `sudoedit` would create gibberish extension names,
|
||||
-- detection using extension would hence not work.
|
||||
autocmd("BufEnter", {
|
||||
pattern = "*Caddyfile*",
|
||||
callback = function()
|
||||
vim.opt_local.filetype = "Caddy"
|
||||
vim.opt_local.commentstring = "# %s"
|
||||
end,
|
||||
})
|
||||
|
||||
-- Update leading indent guide
|
||||
-- source: https://github.com/thaerkh/vim-indentguides
|
||||
autocmd("OptionSet", {
|
||||
pattern = "shiftwidth",
|
||||
callback = function()
|
||||
if vim.o.expandtab then
|
||||
-- leadmultispace is shiftwidth agnostic
|
||||
local c = ""
|
||||
for _ = c:len(), vim.o.shiftwidth + 1, 1 do c = c .. " " end
|
||||
vim.opt.listchars:append { leadmultispace = c }
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Retab file with specified shiftwidth
|
||||
usercmd("Retab", function(opts)
|
||||
if #opts.fargs ~= 2 then
|
||||
print "should have two arguments"
|
||||
return
|
||||
end
|
||||
local src = tonumber(opts.fargs[1])
|
||||
local dst = tonumber(opts.fargs[2])
|
||||
vim.opt.shiftwidth = src
|
||||
vim.opt.tabstop = src
|
||||
vim.opt.expandtab = false
|
||||
vim.cmd "%retab!"
|
||||
vim.opt.shiftwidth = dst
|
||||
vim.opt.tabstop = dst
|
||||
vim.opt.expandtab = true
|
||||
vim.cmd "%retab!"
|
||||
end, { nargs = "+" })
|
||||
125
nix/home/common/neovim/nvim/lua/keymap.lua
Normal file
125
nix/home/common/neovim/nvim/lua/keymap.lua
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
local map = vim.keymap.set
|
||||
local unmap = vim.keymap.del
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- Move
|
||||
map("v", "J", ":m '>+1<CR>gv=gv")
|
||||
map("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Centered motions
|
||||
map("n", "<C-d>", "<C-d>zz")
|
||||
map("n", "<C-u>", "<C-u>zz")
|
||||
map("n", "n", "nzzzv")
|
||||
map("n", "N", "Nzzzv")
|
||||
map("n", "J", "mzJ`z")
|
||||
|
||||
-- Better clipboard
|
||||
map({ "n", "x", "v" }, "<leader>d", '"_d')
|
||||
map({ "n", "x", "v" }, "<leader>c", '"_dc')
|
||||
map({ "n", "x", "v" }, "<leader>p", '"_dP')
|
||||
map({ "n", "x", "v" }, "<leader>y", '"+y')
|
||||
|
||||
-- Linewrap jk
|
||||
-- Only use gj et al. when needed
|
||||
local function linewrap_jk_on()
|
||||
map("n", "j", "gj")
|
||||
map("n", "k", "gk")
|
||||
map("n", "<Down>", "g<Down>")
|
||||
map("n", "<Up>", "g<Up>")
|
||||
end
|
||||
local function linewrap_jk_off()
|
||||
unmap("n", "j")
|
||||
unmap("n", "k")
|
||||
unmap("n", "<Down>")
|
||||
unmap("n", "<Up>")
|
||||
end
|
||||
map("n", "<leader>w", function()
|
||||
vim.o.wrap = not vim.o.wrap
|
||||
if vim.o.wrap then linewrap_jk_on() else linewrap_jk_off() end
|
||||
end)
|
||||
|
||||
-- Replace selected token
|
||||
map("v", "<leader>r", [["ry:%s/\(<C-r>r\)//g<Left><Left>]])
|
||||
|
||||
map("n", "<leader>pv", function() vim.cmd "Oil" end) -- Project View
|
||||
map("n", "<leader>nf", function() vim.cmd "enew" end) -- New File
|
||||
map("n", "<leader>so", function() vim.cmd "so %" end) -- Source buffer
|
||||
map("c", "#capl", [[\(.\{-}\)]]) -- helpers in regex
|
||||
map("c", "#capm", [[\(.*\)]])
|
||||
map("n", "<leader>+x", function() vim.cmd "!chmod +x %" end) -- Permission
|
||||
map("n", "<leader>-x", function() vim.cmd "!chmod -x %" end)
|
||||
map("n", "<leader>hg", function() vim.cmd "Inspect" end) -- Highlight Group
|
||||
map("n", "Q", "<nop>") -- *do not* repeat the last recorded register [count] times.
|
||||
|
||||
-- Diagnostics
|
||||
map("n", "<leader>e", vim.diagnostic.open_float)
|
||||
map("n", "<leader>pe", vim.diagnostic.goto_prev)
|
||||
map("n", "<leader>ne", vim.diagnostic.goto_next)
|
||||
|
||||
map("t", "<Leader><ESC>", "<C-\\><C-n>")
|
||||
|
||||
-- Resize window using shift + arrow keys
|
||||
-- Credit: github.com/GrizzlT
|
||||
map("n", "<S-Up>", "<cmd>resize +2<cr>")
|
||||
map("n", "<S-Down>", "<cmd>resize -2<cr>")
|
||||
map("n", "<S-Left>", "<cmd>vertical resize -2<cr>")
|
||||
map("n", "<S-Right>", "<cmd>vertical resize +2<cr>")
|
||||
|
||||
-------------
|
||||
-- Plugins --
|
||||
-------------
|
||||
|
||||
-- Tabular
|
||||
map("n", "<leader>ta", function() vim.cmd "Tabularize /=" end)
|
||||
map("n", "<leader>tc", function() vim.cmd "Tabularize /:" end)
|
||||
map("n", "<leader>tC", function() vim.cmd "Tabularize trailing_c_comments" end)
|
||||
|
||||
-- Twilight
|
||||
map("n", "<leader>tw", function() vim.cmd "Twilight" end)
|
||||
|
||||
-- Gitsigns
|
||||
map("n", "<leader>gl",
|
||||
function()
|
||||
vim.cmd "Gitsigns toggle_numhl"
|
||||
vim.cmd "Gitsigns toggle_signs"
|
||||
end
|
||||
)
|
||||
|
||||
-- Fugitive
|
||||
map("n", "<leader>gP", function() vim.cmd "G push" end)
|
||||
map("n", "<leader>gp", function() vim.cmd "G pull" end)
|
||||
|
||||
map("n", "<leader><space>", ":Git<CR>5<Down>")
|
||||
map("n", "<leader>gu", ":diffget //2<CR>")
|
||||
map("n", "<leader>gh", ":diffget //3<CR>")
|
||||
autocmd("FileType", {
|
||||
pattern = "fugitive",
|
||||
callback = function() map("n", "<leader><space>", ":q<CR>", { buffer = true }) end,
|
||||
})
|
||||
map("n", "<leader>gb", ":Git blame<CR>")
|
||||
autocmd("FileType", {
|
||||
pattern = "fugitiveblame",
|
||||
callback = function() map("n", "<leader>gb", ":q<CR>", { buffer = true }) end,
|
||||
})
|
||||
|
||||
-- NoNeckPain
|
||||
map("n", "<leader>z", ":NoNeckPain<CR>")
|
||||
|
||||
-- Todo-Comments
|
||||
map("n", "<leader>td", function() vim.cmd "TodoTelescope" end)
|
||||
|
||||
-- Undotree
|
||||
map("n", "<leader>u", function()
|
||||
vim.cmd "UndotreeToggle"
|
||||
vim.cmd "UndotreeFocus"
|
||||
end)
|
||||
autocmd("FileType", {
|
||||
pattern = "undotree",
|
||||
callback = function() map("n", "<leader>gb", ":q<CR>", { buffer = true }) end,
|
||||
})
|
||||
|
||||
-- color-picker
|
||||
map("n", "<C-c>", function() vim.cmd "CccPick" end, { silent = true })
|
||||
47
nix/home/common/neovim/nvim/lua/options.lua
Normal file
47
nix/home/common/neovim/nvim/lua/options.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
local opt = vim.opt
|
||||
|
||||
opt.hlsearch = false
|
||||
opt.incsearch = true
|
||||
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.cursorline = true
|
||||
opt.signcolumn = "yes"
|
||||
|
||||
opt.tabstop = 4
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 4
|
||||
|
||||
opt.wrap = false -- Slows the editor
|
||||
opt.linebreak = true
|
||||
opt.breakindent = true
|
||||
opt.filetype = "on"
|
||||
|
||||
opt.swapfile = false
|
||||
opt.backup = false
|
||||
opt.undofile = true
|
||||
|
||||
opt.termguicolors = true
|
||||
opt.mouse = "a"
|
||||
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.autoindent = true
|
||||
opt.smartindent = true
|
||||
|
||||
opt.scrolloff = 3
|
||||
|
||||
opt.colorcolumn = "80"
|
||||
|
||||
opt.foldlevel = 99
|
||||
opt.foldlevelstart = 99
|
||||
opt.foldenable = true
|
||||
|
||||
opt.winbar = "%{%v:lua.require'winbar'.eval()%}"
|
||||
|
||||
opt.showmode = false
|
||||
|
||||
opt.listchars = { tab = "│ ", trail = "␣" }
|
||||
opt.list = true
|
||||
|
||||
vim.g.netrw_banner = 0
|
||||
47
nix/home/common/neovim/nvim/lua/utils.lua
Normal file
47
nix/home/common/neovim/nvim/lua/utils.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
M = {}
|
||||
|
||||
M.Map = function(tbl, f)
|
||||
local t = {}
|
||||
for k, v in pairs(tbl) do
|
||||
t[k] = f(v)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
M.Foreach = function(tbl, f)
|
||||
for k, v in pairs(tbl) do
|
||||
f(k, v)
|
||||
end
|
||||
end
|
||||
|
||||
M.Contains = function(tbl, elem)
|
||||
for _, v in pairs(tbl) do
|
||||
if v == elem then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
M.Filter = function(tbl, pred)
|
||||
local t = {}
|
||||
for k, v in pairs(tbl) do
|
||||
if pred(v) then
|
||||
t[k] = v
|
||||
end
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
M.Concat = function(tbl1, tbl2)
|
||||
local t = {}
|
||||
for k, v in pairs(tbl1) do
|
||||
t[k] = v
|
||||
end
|
||||
for k, v in pairs(tbl2) do
|
||||
t[k] = v
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
return M
|
||||
36
nix/home/common/neovim/nvim/lua/winbar.lua
Normal file
36
nix/home/common/neovim/nvim/lua/winbar.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
local M = {}
|
||||
|
||||
local api = vim.api
|
||||
local fn = vim.fn
|
||||
|
||||
api.nvim_set_hl(0, "WinBar", { fg = "#dedede" })
|
||||
api.nvim_set_hl(0, "WinBarPath", { bg = "#dedede" })
|
||||
api.nvim_set_hl(0, "WinBarModified", { bg = "#dedede", bold = true })
|
||||
|
||||
function M.eval()
|
||||
local buffer = api.nvim_win_get_buf(0)
|
||||
local bufname = fn.bufname(buffer)
|
||||
local modified = ""
|
||||
local readonly = ""
|
||||
|
||||
if vim.bo[buffer].readonly then
|
||||
readonly = "[RO] "
|
||||
end
|
||||
|
||||
if vim.bo[buffer].modified then
|
||||
modified = "[+] "
|
||||
end
|
||||
|
||||
bufname = fn.fnamemodify(bufname, ":p:~")
|
||||
|
||||
return "%="
|
||||
.. "%#WinBarModified#"
|
||||
.. readonly
|
||||
.. modified
|
||||
.. "%*"
|
||||
.. "%#WinBarPath#"
|
||||
.. bufname
|
||||
.. "%*"
|
||||
end
|
||||
|
||||
return M
|
||||
27
nix/home/common/neovim/nvim/snippets/c.json
Normal file
27
nix/home/common/neovim/nvim/snippets/c.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"Create main function": {
|
||||
"prefix": "main",
|
||||
"body": [
|
||||
"int main()",
|
||||
"{",
|
||||
"\t$0",
|
||||
"\treturn 0;",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"Debug expression": {
|
||||
"prefix": "dbg",
|
||||
"body": [
|
||||
"printf(\"${1:expression}: ${2:format}\\n\", ${1:expression});"
|
||||
]
|
||||
},
|
||||
"Check pointer": {
|
||||
"prefix": "cpt",
|
||||
"body": [
|
||||
"if (${1:ptr} == NULL) {",
|
||||
"\treturn $2;",
|
||||
"}",
|
||||
"$0"
|
||||
]
|
||||
}
|
||||
}
|
||||
35
nix/home/common/neovim/nvim/snippets/package.json
Normal file
35
nix/home/common/neovim/nvim/snippets/package.json
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "leana-snippets",
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": "c",
|
||||
"path": "./c.json"
|
||||
},
|
||||
{
|
||||
"language": "python",
|
||||
"path": "./python.json"
|
||||
},
|
||||
{
|
||||
"language": "rust",
|
||||
"path": "./rust.json"
|
||||
},
|
||||
{
|
||||
"language": "scala",
|
||||
"path": "./scala.json"
|
||||
},
|
||||
{
|
||||
"language": "tex",
|
||||
"path": "./tex.json"
|
||||
},
|
||||
{
|
||||
"language": "typst",
|
||||
"path": "./typst.json"
|
||||
},
|
||||
{
|
||||
"language": "xml",
|
||||
"path": "./xml.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
41
nix/home/common/neovim/nvim/snippets/python.json
Normal file
41
nix/home/common/neovim/nvim/snippets/python.json
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"Dict comprehension": {
|
||||
"prefix": "dc",
|
||||
"body": [
|
||||
"{",
|
||||
"\t${3:key}:${4:value}",
|
||||
"\tfor ${1:var} in ${2:iterated}",
|
||||
"}",
|
||||
""
|
||||
]
|
||||
},
|
||||
"List comprehension": {
|
||||
"prefix": "lc",
|
||||
"body": [
|
||||
"[",
|
||||
"\t${3:var}${4:transformation}",
|
||||
"\tfor ${1:var} in ${2:iterated}",
|
||||
"]",
|
||||
""
|
||||
]
|
||||
},
|
||||
"For": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for ${1:var} in ${2:iterable}:",
|
||||
"\t"
|
||||
]
|
||||
},
|
||||
"Open, read and save file to variable": {
|
||||
"prefix": "open",
|
||||
"body": [
|
||||
"${1:var} = []",
|
||||
"with open(\"${2:file.txt}\") as f:",
|
||||
"\t${1:var} = [",
|
||||
"\t\tline.strip()",
|
||||
"\t\tfor line in f.readlines() if line != '\\n'",
|
||||
"\t]",
|
||||
""
|
||||
]
|
||||
}
|
||||
}
|
||||
9
nix/home/common/neovim/nvim/snippets/rust.json
Normal file
9
nix/home/common/neovim/nvim/snippets/rust.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Create main function": {
|
||||
"prefix": "main",
|
||||
"body": [
|
||||
"${0}",
|
||||
"fn main() {}"
|
||||
]
|
||||
}
|
||||
}
|
||||
12
nix/home/common/neovim/nvim/snippets/scala.json
Normal file
12
nix/home/common/neovim/nvim/snippets/scala.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"Debug a flow chain of consecutive methods": {
|
||||
"prefix": ".dbg",
|
||||
"body": [
|
||||
".map(x => {",
|
||||
"// DEBUG: this in an identity function that debugs to println",
|
||||
"\tprintln(x)",
|
||||
"\tx",
|
||||
"})"
|
||||
]
|
||||
}
|
||||
}
|
||||
25
nix/home/common/neovim/nvim/snippets/tex.json
Normal file
25
nix/home/common/neovim/nvim/snippets/tex.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"Verbatim mode": {
|
||||
"prefix": "```",
|
||||
"body": [
|
||||
"\\begin{BVerbatim}[commandchars=\\\\\\\\\\{\\\\}]",
|
||||
"$0",
|
||||
"\\end{BVerbatim}"
|
||||
],
|
||||
"description": "Verbatim mode mapped to markdown's codeblock"
|
||||
},
|
||||
"Opening French quotes": {
|
||||
"prefix": "<<",
|
||||
"body": [
|
||||
"«~"
|
||||
],
|
||||
"description": "Opening French quote with non breaking space"
|
||||
},
|
||||
"Closing French quote": {
|
||||
"prefix": ">>",
|
||||
"body": [
|
||||
"~»"
|
||||
],
|
||||
"description": "Closing French quote with non breaking space"
|
||||
}
|
||||
}
|
||||
91
nix/home/common/neovim/nvim/snippets/typst.json
Normal file
91
nix/home/common/neovim/nvim/snippets/typst.json
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"Enum item": {
|
||||
"prefix": "ei",
|
||||
"body": [
|
||||
"#enum.item[",
|
||||
"$0",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
"List item": {
|
||||
"prefix": "li",
|
||||
"body": [
|
||||
"#list.item[",
|
||||
"$0",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
"code": {
|
||||
"prefix": "sc",
|
||||
"body": [
|
||||
"#code[```$1",
|
||||
"$0",
|
||||
"```]"
|
||||
]
|
||||
},
|
||||
"showybox": {
|
||||
"prefix": "sb",
|
||||
"body": [
|
||||
"#showybox(title: [ $1 ],",
|
||||
"[ $0 ]",
|
||||
")"
|
||||
]
|
||||
},
|
||||
"showybox definition": {
|
||||
"prefix": "sd",
|
||||
"body": [
|
||||
"#showybox_definition(title: [ $1 ],",
|
||||
"[ $0 ]",
|
||||
")"
|
||||
]
|
||||
},
|
||||
"showybox remark": {
|
||||
"prefix": "sr",
|
||||
"body": [
|
||||
"#showybox_remark(title: [ $1 ],",
|
||||
"[ $0 ]",
|
||||
")"
|
||||
]
|
||||
},
|
||||
"showybox example": {
|
||||
"prefix": "se",
|
||||
"body": [
|
||||
"#showybox_example(title: [ $1 ],",
|
||||
"[ $0 ]",
|
||||
")"
|
||||
]
|
||||
},
|
||||
"showybox file": {
|
||||
"prefix": "sf",
|
||||
"body": [
|
||||
"#showybox_file(title: [ $1 ],",
|
||||
"[ $0 ]",
|
||||
")"
|
||||
]
|
||||
},
|
||||
"algorithm": {
|
||||
"prefix": "algo",
|
||||
"body": [
|
||||
"#algorithm(",
|
||||
"\tcaption: [ $1 ],",
|
||||
"\t{",
|
||||
"\t\tpseudocode(",
|
||||
"\t\t$0",
|
||||
"\t)},",
|
||||
")"
|
||||
]
|
||||
},
|
||||
"Config report": {
|
||||
"prefix": "report",
|
||||
"body": [
|
||||
"#import \"template/report.typ\": *",
|
||||
"",
|
||||
"#show: conf.with(",
|
||||
" title : \"${1}\",",
|
||||
" author : \"${2:Léana CHIANG}\",",
|
||||
" lang : \"${3:fr}\",",
|
||||
")",
|
||||
"$0"
|
||||
]
|
||||
}
|
||||
}
|
||||
16
nix/home/common/neovim/nvim/snippets/xml.json
Normal file
16
nix/home/common/neovim/nvim/snippets/xml.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"Tag": {
|
||||
"prefix": "<",
|
||||
"body": [
|
||||
"<${1:element}${2:property}>",
|
||||
"${0}",
|
||||
"</${1:element}>"
|
||||
]
|
||||
},
|
||||
"Auto-closing tag": {
|
||||
"prefix": "</",
|
||||
"body": [
|
||||
"<${1:element}/>"
|
||||
]
|
||||
}
|
||||
}
|
||||
81
nix/home/common/neovim/nvim/syntax/skel.vim
Normal file
81
nix/home/common/neovim/nvim/syntax/skel.vim
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
" Vim syntax file
|
||||
" Language: skeletal semantics
|
||||
" Filename: *.sk *.ski
|
||||
" Maintainer: Victoire Noizet
|
||||
" Latest revision: 28 Feb. 2020
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax") && b:current_syntax == "skel"
|
||||
finish
|
||||
endif
|
||||
|
||||
" skel is case sensitive
|
||||
syn case match
|
||||
|
||||
syn match skelLCI /\<\(\l\|_\)\(\w\|'\)*\>/
|
||||
syn match skelConstructor /\<\(\u\)\(\w\|'\)*\>/
|
||||
|
||||
syn keyword PreProc require clone open
|
||||
syn keyword skelDeclaration val type binder
|
||||
syn keyword skelTodo contained TODO FIXME XXX NOTE LATER
|
||||
syn keyword skelOr contained or
|
||||
syn keyword skelWith contained with
|
||||
syn match skelQuestion contained "?"
|
||||
|
||||
" Errors
|
||||
syn match skelOrErr "\<or\>"
|
||||
syn match skelOrErr "\<with\>"
|
||||
syn match skelEndErr "\<end\>"
|
||||
syn match skelInErr "\<in\>"
|
||||
syn match skelAngleErr ">"
|
||||
syn match skelParErr ")"
|
||||
syn match skelCommaErr ","
|
||||
|
||||
syn region skelBranching matchgroup=skelStruct start="\<branch\>" matchgroup=skelStruct end="\<end\>" contains=ALLBUT,skelOrErr,skelEndErr
|
||||
syn region skelBranching matchgroup=skelStruct start="\<match\>" matchgroup=skelStruct end="\<end\>" contains=ALLBUT,skelWithErr,skelEndErr
|
||||
syn region skelLetIn matchgroup=skelStruct start="\<let\>" matchgroup=skelStruct end="\<in\>" contains=ALLBUT,skelInErr
|
||||
|
||||
syn region skelAngleStruct matchgroup=NONE start="<" matchgroup=NONE end=">" contains=ALLBUT,skelAngleErr,skelCommaErr
|
||||
syn region skelParenStruct matchgroup=NONE start="(" matchgroup=NONE end=")" contains=ALLBUT,skelParErr,skelCommaErr
|
||||
|
||||
syn region skelComment start="(\*" end="\*)" contains=skelTodo,skelComment
|
||||
syn region skelMeaningfulComment start="(\*\*" end="\*)" contains=skelComment
|
||||
|
||||
syn match skelKeyChar ":"
|
||||
syn match skelKeyChar "→"
|
||||
syn match skelKeyChar "->"
|
||||
syn match skelKeyChar "λ"
|
||||
syn match skelKeyChar "\\"
|
||||
syn match skelKeyChar "|"
|
||||
syn match skelKeyChar "="
|
||||
syn match skelKeyChar ";"
|
||||
|
||||
hi def link skelLCI Identifier
|
||||
hi def link skelDeclaration Keyword
|
||||
hi def link skelConstructor Function
|
||||
hi def link skelComment Comment
|
||||
hi def link skelMeaningfulComment Comment
|
||||
hi def link skelTodo Todo
|
||||
hi def link skelOr Statement
|
||||
hi def link skelWith Statement
|
||||
|
||||
hi def link skelErr Error
|
||||
hi def link skelOrErr skelErr
|
||||
hi def link skelWithErr skelErr
|
||||
hi def link skelInErr skelErr
|
||||
hi def link skelParErr skelErr
|
||||
hi def link skelEndErr skelErr
|
||||
hi def link skelAngleErr skelErr
|
||||
hi def link skelCommaErr skelErr
|
||||
|
||||
hi def link skelKeyChar Operator
|
||||
hi def link skelStruct Statement
|
||||
hi def link skelBranching Bold
|
||||
|
||||
""""" Folding of comments of type (** * sthg *)
|
||||
syn region skelCommentLvl1 keepend transparent start="(\* \* " end="(\* \*"me=e-7 skip="(\* \*\*" contains=ALL fold
|
||||
syn region skelCommentLvl2 keepend transparent start="(\* \*\* " end="(\* \*"me=e-7 skip="(\* \*\*\*" contains=ALL fold
|
||||
syn region skelCommentLvl3 keepend transparent start="(\* \*\*\* " end="(\* \*"me=e-7 skip="(\* \*\*\*\*" contains=ALL fold
|
||||
syn region skelCommentLvl4 keepend transparent start="(\* \*\*\*\* " end="(\* \*"me=e-7 skip="(\* \*\*\*\*\*" contains=ALL fold
|
||||
syn region skelCommentLvl5 keepend transparent start="(\* \*\*\*\*\* " end="(\* \*"me=e-7 contains=ALL fold
|
||||
set foldmethod=syntax
|
||||
63
nix/home/common/neovim/nvim/syntax/why3.vim
Normal file
63
nix/home/common/neovim/nvim/syntax/why3.vim
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
" Vim syntax file
|
||||
" Language: why3
|
||||
" Filename: *.mlw
|
||||
" Maintainer: Léana CHIANG
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax") && b:current_syntax == "why3"
|
||||
finish
|
||||
endif
|
||||
|
||||
" be case sensitive
|
||||
syn case match
|
||||
|
||||
syn match whyOperator "="
|
||||
syn match whyOperator ":="
|
||||
syn match whyOperator "+"
|
||||
syn match whyOperator "-"
|
||||
syn match whyOperator "*"
|
||||
syn match whyOperator "/"
|
||||
syn match whyOperator "\\/"
|
||||
syn match whyOperator "/\\"
|
||||
syn match whyOperator "<"
|
||||
syn match whyOperator ">"
|
||||
syn match whyOperator "<="
|
||||
syn match whyOperator ">="
|
||||
|
||||
syn match whyIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/
|
||||
syn match whyConstructor /\<\(\u\)\(\w\|'\)*\>/
|
||||
syn match whyStructure /\<\(\u\)\(\w\|'\)*\>/
|
||||
syn match whyNum /-\?\d\+/
|
||||
|
||||
syn keyword whyInclude module use end
|
||||
syn keyword whyBinding val let in type
|
||||
syn keyword whyType int ref
|
||||
syn keyword whyKeyword if then else match with
|
||||
syn keyword whyFunction function predicate assert requires ensures invariant variant
|
||||
syn keyword WhyResult result contained
|
||||
|
||||
syn region whyParened matchgroup=NONE start="(" matchgroup=NONE end=")" contains=ALLBUT,whyParErr
|
||||
syn region whyBraced matchgroup=NONE start="{" matchgroup=NONE end="}" contains=ALLBUT,whyBraceErr
|
||||
syn region whyEnsureClause matchgroup=NONE start="ensures" matchgroup=NONE end="}" contains=whyResult
|
||||
syn region whyModuleClause matchgroup=NONE start="module" matchgroup=NONE end=/$/ contains=whyStructure
|
||||
syn region whyComment start="(\*" end="\*)"
|
||||
|
||||
syn match whyParErr ")"
|
||||
syn match whyBraceErr "}"
|
||||
|
||||
hi def link whyIdentifier Identifier
|
||||
hi def link whyInclude Include
|
||||
hi def link whyStructure Structure
|
||||
hi def link whyKeyword Keyword
|
||||
hi def link whyFunction Function
|
||||
hi def link whyBinding Keyword
|
||||
hi def link whyType Type
|
||||
hi def link whyNum Number
|
||||
hi def link whyResult Constant
|
||||
hi def link whyConstructor Function
|
||||
hi def link whyComment Comment
|
||||
hi def link whyOperator Operator
|
||||
|
||||
hi def link whyErr Error
|
||||
hi def link whyParErr whyErr
|
||||
hi def link whyBraceErr whyErr
|
||||
Loading…
Add table
Add a link
Reference in a new issue