nvim: config upgrade and add verilog support

This commit is contained in:
js0ny 2025-10-29 02:24:13 +00:00
parent 05c0b65b3b
commit 7540d37422
6 changed files with 77 additions and 11 deletions

View file

@ -0,0 +1,9 @@
-- SystemVerilog
--[[ Installation
cargo install svls
--]]
return {
cmd = { "svls" },
filetypes = { "systemverilog", "verilog" },
root_markers = { ".svls.toml" }
}

View file

@ -3,5 +3,6 @@ local signs = require("config.icons").diagnostics
-- This provides the diagnostics signs near the line numbers -- This provides the diagnostics signs near the line numbers
for type, icon in pairs(signs) do for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
vim.diagnostic.config(hl, { text = icon, texthl = hl, numhl = "" })
end end

View file

@ -6,17 +6,8 @@ return {
{ import = "plugins.lang.beancount" }, { import = "plugins.lang.beancount" },
{ import = "plugins.lang.tex" }, { import = "plugins.lang.tex" },
{ import = "plugins.lang.lua" }, { import = "plugins.lang.lua" },
{ import = "plugins.lang.verilog" },
{ import = "plugins.lang.treesitter" }, { import = "plugins.lang.treesitter" },
{ import = "plugins.mod.trouble-nvim" }, { import = "plugins.mod.trouble-nvim" },
-- Remove mason and use system package manager
-- {
-- "williamboman/mason.nvim",
-- cmd = "Mason",
-- build = ":MasonUpdate",
-- -- opts_extend = { "ensure_installed" },
-- opts = {
-- -- ensure_installed = require("config.servers").servers,
-- },
-- },
{ import = "plugins.mod.conform-nvim" }, { import = "plugins.mod.conform-nvim" },
} }

View file

@ -0,0 +1,8 @@
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "*.v",
callback = function()
vim.bo.filetype = "verilog"
end,
})
return {}

View file

@ -4,6 +4,8 @@
iverilog # Simulator: Icarus Verilog iverilog # Simulator: Icarus Verilog
gtkwave # Waveform Viewer gtkwave # Waveform Viewer
picocom picocom
verible # LSP
svls # LSP
]; ];
programs.zed-editor.extensions = ["verilog"]; programs.zed-editor.extensions = ["verilog"];

View file

@ -0,0 +1,55 @@
{...}: let
editFzfPosix = ''
edit-fzf() {
# 1. Declare a variable that is local to the function.
local _file
if command -v fd >/dev/null 2>&1; then
_file=$(fd --type f | fzf --height 40% --reverse)
else
# Fallback to 'find'
_file=$(find . -type f | fzf --height 40% --reverse)
fi
# In POSIX shell, if fzf is cancelled (Esc/Ctrl-C),
# the command substitution simply returns an empty string.
# So, we check if the variable '_file' is non-empty ('-n').
if [ -n "$_file" ]; then
"$EDITOR" "$_file"
else
echo "No file selected."
fi
}
alias ef="edit-fzf"
'';
in {
programs.fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
enableFishIntegration = true;
};
programs.fish.interactiveShellInit = ''
function edit-fzf --description "Find and edit a file using fzf and $EDITOR"
set -l file
if command -q fd
set file (fd --type f | fzf --height 40% --reverse)
else
set file (find . -type f | fzf --height 40% --reverse)
end
set -l fzf_status $status
if test $fzf_status -eq 0; and test -n "$file"
$EDITOR $file
else
echo "No file selected."
end
end
abbr --add ef edit-fzf
'';
# TODO: Add integraiton for bash, zsh
programs.bash.bashrcExtra = editFzfPosix;
programs.zsh.initContent = editFzfPosix;
}