Further migration of expressive functionality to fennel

This commit is contained in:
2026-07-14 13:18:18 +01:00
parent 1b314768f1
commit 7a7221ff0d
4 changed files with 56 additions and 57 deletions
+1 -34
View File
@@ -20,31 +20,7 @@ if (vim.fn.executable("nu") == 1) and shell_path:find("nu") then
vim.opt.shellpipe =
"| complete | update stderr { ansi strip } | tee { get stderr | save --force --raw %s } | into record"
end
-- Check if we're inside a git repo, and if we are make the project root the CWD
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
local current_file = vim.fn.expand("%:p")
if current_file == "" then
return
end
local root_dir = vim.fs.dirname(
vim.fs.find({ ".git" }, { upward = true, path = vim.fs.dirname(current_file) })[1]
)
if root_dir then
vim.cmd.cd(root_dir)
print("Root changed to: " .. root_dir)
end
end,
})
-- Add custom commentstring definitions
vim.api.nvim_create_autocmd("FileType", {
pattern = "nix,flake",
command = "setlocal commentstring=#\\ %s",
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "scallop",
command = "setlocal commentstring=//%s",
})
-- Add custom file types
vim.filetype.add({
extension = {
@@ -85,15 +61,6 @@ vim.opt.scrolloff = 4 -- Minimal number of screen lines to keep above and below
-- Set highlight on search, but clear on pressing <Esc> in normal mode
vim.opt.hlsearch = true
-- Highlight when yanking (copying) text
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- Diagnostics config
vim.diagnostic.config({
float = {
+22
View File
@@ -0,0 +1,22 @@
local M = {}
-- Helper function to ensure core bootstrapping plugins are installed
function M.ensure_plugin(name, repo, branch)
local path = vim.fn.stdpath("data") .. "/lazy/" .. name
if not (vim.uv or vim.loop).fs_stat(path) then
local cmd = {
"git",
"clone",
"--filter=blob:none",
"https://github.com/" .. repo .. ".git",
}
if branch then
table.insert(cmd, "--branch=" .. branch)
end
table.insert(cmd, path)
vim.fn.system(cmd)
end
return path
end
return M