This commit is contained in:
arc
2026-08-16 16:40:02 -06:00
parent ae7c60dd13
commit 27b3cf3b8a
8 changed files with 530 additions and 126 deletions
+153 -81
View File
@@ -78,10 +78,10 @@ vim.opt.listchars = 'tab:^ ,nbsp:¬,extends:»,precedes:«,trail:•'
-- Arc, March 20, 2025
-- Setting the filetype for Verilog
vim.api.nvim_create_autocmd(
{"BufNewFile", "BufRead"}, {
pattern = {"*.v"},
command = "set filetype=verilog",
}
{ "BufNewFile", "BufRead" }, {
pattern = { "*.v" },
command = "set filetype=verilog",
}
)
-------------------------------------------------------------------------------
@@ -92,7 +92,7 @@ vim.api.nvim_create_autocmd(
-- quick-open
-- Replaced with FZF instead of Files because files pulls up empty for some reason - 2024-10-2
vim.keymap.set('', '<C-p>', '<cmd>FZF<cr>')
-- vim.keymap.set('', '<C-p>', '<cmd>Files<cr>')
-- vim.keymap.set('', '<C-p>', '<cmd>Files<cr>')
-- search buffers
vim.keymap.set('n', '<leader>;', '<cmd>Buffers<cr>')
-- quick-save
@@ -166,8 +166,14 @@ vim.keymap.set('n', '<leader>m', 'ct_')
vim.keymap.set('', '<F1>', '<Esc>')
vim.keymap.set('i', '<F1>', '<Esc>')
-- Allow virtual text
vim.diagnostic.config({
virtual_text = true,
virtual_lines = false
})
-- Use f2 to rename symbol (arc) - 2024-10-02
vim.keymap.set('n', '<F2>', function () vim.lsp.buf.rename() end)
vim.keymap.set('n', '<F2>', function() vim.lsp.buf.rename() end)
------------------------------------------------------------------------------
--
-- autocommands
@@ -214,13 +220,13 @@ vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
-- also, produce "flowed text" wrapping
-- https://brianbuccola.com/line-breaks-in-mutt-and-vim/
vim.api.nvim_create_autocmd('Filetype', {
pattern = 'mail',
group = email,
command = 'setlocal formatoptions+=w',
pattern = 'mail',
group = email,
command = 'setlocal formatoptions+=w',
})
-- shorter columns in text because it reads better that way
local text = vim.api.nvim_create_augroup('text', { clear = true })
for _, pat in ipairs({'text', 'markdown', 'mail', 'gitcommit'}) do
for _, pat in ipairs({ 'text', 'markdown', 'mail', 'gitcommit' }) do
vim.api.nvim_create_autocmd('Filetype', {
pattern = pat,
group = text,
@@ -257,29 +263,6 @@ vim.opt.rtp:prepend(lazypath)
-- then, setup!
require("lazy").setup({
-- main color scheme
-- Switched to https://github.com/projekt0n/github-nvim-theme
--
-- {
-- "projekt0n/github-nvim-theme",
-- lazy = false, -- load at start
-- priority = 1000, -- load first
-- config = function()
-- vim.cmd([[colorscheme github_dark]])
-- vim.o.background = 'dark'
-- -- XXX: hi Normal ctermbg=NONE
-- -- Make comments more prominent -- they are important.
-- local bools = vim.api.nvim_get_hl(0, { name = 'Boolean' })
-- vim.api.nvim_set_hl(0, 'Comment', bools)
-- -- Make it clearly visible which argument we're at.
-- local marked = vim.api.nvim_get_hl(0, { name = 'PMenu' })
-- vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', { fg = marked.fg, bg = marked.bg, ctermfg = marked.ctermfg, ctermbg = marked.ctermbg, bold = true })
-- -- XXX
-- -- Would be nice to customize the highlighting of warnings and the like to make
-- -- them less glaring. But alas
-- -- https://github.com/nvim-lua/lsp_extensions.nvim/issues/21
-- -- call Base16hi("CocHintSign", g:base16_gui03, "", g:base16_cterm03, "", "", "")
-- end
-- },
-- nice bar at the bottom
{
"wincent/base16-nvim",
@@ -288,13 +271,15 @@ require("lazy").setup({
config = function()
vim.cmd([[colorscheme gruvbox-dark-hard]])
vim.o.background = 'dark'
-- XXX: hi Normal ctermbg=NONE
vim.cmd([[hi Normal ctermbg=NONE]])
vim.api.nvim_set_hl(0, "WinSeparator", { fg = 1250067 })
-- Make comments more prominent -- they are important.
local bools = vim.api.nvim_get_hl(0, { name = 'Boolean' })
vim.api.nvim_set_hl(0, 'Comment', bools)
-- Make it clearly visible which argument we're at.
local marked = vim.api.nvim_get_hl(0, { name = 'PMenu' })
vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', { fg = marked.fg, bg = marked.bg, ctermfg = marked.ctermfg, ctermbg = marked.ctermbg, bold = true })
vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter',
{ fg = marked.fg, bg = marked.bg, ctermfg = marked.ctermfg, ctermbg = marked.ctermbg, bold = true })
-- XXX
-- Would be nice to customize the highlighting of warnings and the like to make
-- them less glaring. But alas
@@ -312,7 +297,7 @@ require("lazy").setup({
vim.g.lightline = {
active = {
left = {
{ 'mode', 'paste' },
{ 'mode', 'paste' },
{ 'readonly', 'filename', 'modified' }
},
right = {
@@ -332,6 +317,7 @@ require("lazy").setup({
return vim.fn.getreg('%')
end
end
-- https://github.com/itchyny/lightline.vim/issues/657
vim.api.nvim_exec(
[[
@@ -345,10 +331,10 @@ require("lazy").setup({
},
-- quick navigation
{
'ggandor/leap.nvim',
"https://codeberg.org/andyg/leap.nvim",
config = function()
vim.keymap.set({'n', 'x', 'o'}, 's', '<Plug>(leap)')
vim.keymap.set('n', 'S', '<Plug>(leap-from-window)')
vim.keymap.set({ 'n', 'x', 'o' }, 's', '<Plug>(leap)')
vim.keymap.set('n', 'S', '<Plug>(leap-from-window)')
end
},
-- better %
@@ -369,60 +355,92 @@ require("lazy").setup({
-- },
-- hopefully fix random crashes?
{
'hrsh7th/vim-vsnip'
'hrsh7th/vim-vsnip'
},
-- fzf support for ^p
{
'junegunn/fzf.vim',
-- dependencies = {
-- { 'junegunn/fzf', dir = '~/.fzf', build = './install --all' },
-- },
'ibhagwan/fzf-lua',
config = function()
-- stop putting a giant window over my editor
vim.g.fzf_layout = { down = '~20%' }
-- when using :Files, pass the file list through
require 'fzf-lua'.setup {
winopts = {
-- stop putting a giant window over my editor
split = "belowright 10new",
preview = {
hidden = true,
}
},
files = {
-- file icons are distracting
file_icons = false,
-- git icons are nice
git_icons = true,
-- don't touch anchored search
_fzf_nth_devicons = true
},
buffers = {
file_icons = false,
git_icons = true
},
fzf_opts = {
-- no reverse view
["--layout"] = "default"
}
}
-- when using C-p for quick file open, pass the file list through
--
-- https://github.com/jonhoo/proximity-sort
--
-- to prefer files closer to the current file.
function list_cmd()
vim.keymap.set('', '<C-p>', function()
opts = {}
opts.cmd = 'fd --color=never --hidden --type f --type l --exclude .git'
local base = vim.fn.fnamemodify(vim.fn.expand('%'), ':h:.:S')
if base == '.' then
if base ~= '.' then
-- if there is no current file,
-- proximity-sort can't do its thing
return 'fd --type file --follow'
else
return vim.fn.printf('fd --type file --follow | proximity-sort %s', vim.fn.shellescape(vim.fn.expand('%')))
opts.cmd = opts.cmd .. (" | proximity-sort %s"):format(vim.fn.shellescape(vim.fn.expand('%')))
end
end
vim.api.nvim_create_user_command('Files', function(arg)
vim.fn['fzf#vim#files'](arg.qargs, { source = list_cmd(), options = '--tiebreak=index' }, arg.bang)
end, { bang = true, nargs = '?', complete = "dir" })
opts.fzf_opts = {
['--scheme'] = 'path',
['--tiebreak'] = 'index',
["--layout"] = "default",
}
require 'fzf-lua'.files(opts)
end)
-- use fzf to search buffers as well
vim.keymap.set('n', '<leader>;', function()
require 'fzf-lua'.buffers({
-- just include the paths in the fzf bits, and nothing else
-- https://github.com/ibhagwan/fzf-lua/issues/2230#issuecomment-3164258823
fzf_opts = {
["--with-nth"] = "{-3..-2}",
["--nth"] = "-1",
["--delimiter"] = "[:\u{2002}]",
["--header-lines"] = "false",
},
header = false,
})
end)
end
},
{
'junegunn/fzf'
},
-- LSP
{
'neovim/nvim-lspconfig',
config = function()
-- Setup language servers.
local lspconfig = require('lspconfig')
-- Server-specific settings. See `:help lspconfig-setup`
-- Server-specific settings. See `:help lspconfig-setup`
vim.lsp.config('rust_analyzer', {
settings = {
["rust-analyzer"] = {
["rust_analyzer"] = {
cargo = {
features = "all"
},
checkOnSave = {
enable = true,
features = "all",
command = "clippy"
enable = true,
},
check = {
command = "clippy"
command = "clippy"
},
imports = {
group = {
@@ -431,25 +449,37 @@ require("lazy").setup({
},
completion = {
postfix = {
-- Commened out to see if I like it more (arc) - 2024-10-03
-- enable = false,
-- Commened out to see if I like it more (arc) - 2024-10-03
-- enable = false,
},
},
},
},
})
-- Rust
vim.lsp.enable('rust_analyzer')
-- C/C++
if vim.fn.executable('clangd') == 1 then
vim.lsp.enable('clangd')
vim.lsp.enable('clangd')
end
-- Dafny
vim.lsp.enable('dafny')
-- Javascript
vim.lsp.enable("ts_ls")
if vim.fn.executable('ts_ls') then
vim.lsp.enable("ts_ls")
end
-- Python
if vim.fn.executable('ruff') == 1 then
vim.lsp.enable('ruff')
end
-- Svelte
vim.lsp.enable("svelte")
-- Lua
vim.lsp.enable('lua_ls')
@@ -491,15 +521,25 @@ require("lazy").setup({
local client = vim.lsp.get_client_by_id(ev.data.client_id)
-- When https://neovim.io/doc/user/lsp.html#lsp-inlay_hint stabilizes
-- *and* there's some way to make it only apply to the current line.
-- if client.server_capabilities.inlayHintProvider then
-- vim.lsp.inlay_hint(ev.buf, true)
-- end
-- TODO: find some way to make it only apply to the current line.
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(false, { bufnr = bufnr })
end
-- None of this semantics tokens business.
-- https://www.reddit.com/r/neovim/comments/143efmd/is_it_possible_to_disable_treesitter_completely/
client.server_capabilities.semanticTokensProvider = nil
-- format on save for Rust
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("RustFormat", { clear = true }),
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end
})
end
end,
})
end
@@ -518,12 +558,12 @@ require("lazy").setup({
"hrsh7th/cmp-path",
},
config = function()
local cmp = require'cmp'
local cmp = require 'cmp'
cmp.setup({
snippet = {
-- REQUIRED by nvim-cmp. get rid of it once we can
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
vim.snippet.expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
@@ -569,6 +609,19 @@ require("lazy").setup({
end
},
-- language support
-- treesitter
{
'nvim-treesitter/nvim-treesitter',
lazy = false,
build = ':TSUpdate',
-- config = function()
-- require('nvim-treesitter.configs').setup({
-- highlight = {
-- enable = true
-- }
-- })
-- end
},
-- terraform
{
'hashivim/vim-terraform',
@@ -578,7 +631,7 @@ require("lazy").setup({
'cespare/vim-toml',
-- yaml
{
"cuducos/yaml.nvim",
"https://tangled.org/cuducos.me/yaml.nvim",
ft = { "yaml" },
dependencies = {
"nvim-treesitter/nvim-treesitter",
@@ -618,6 +671,25 @@ require("lazy").setup({
},
})
-- Manually inject support for Dafny into tree-sitter
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'dafny' },
callback = function() vim.treesitter.start() end,
})
vim.api.nvim_create_autocmd('User', {
pattern = 'TSUpdate',
callback = function()
require('nvim-treesitter.parsers').dafny = {
install_info = {
url = 'https://github.com/oscar-bender-stone/tree-sitter-dafny',
revision = "4a78fb62bbafcaac23fd2cb07ac8063e92c2af51", -- commit hash for revision to check out; HEAD if missing
-- optional entries:
queries = 'queries/neovim', -- also install queries from given directory
},
}
end
})
-- Hypothetically makes hover work on hover - arc, aug 6, 2025
-- Commented out because it prevents me from looking at errors, aug 7:
-- vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
+12 -13
View File
@@ -1,24 +1,23 @@
{
"base16-nvim": { "branch": "main", "commit": "6e503dc07bf22317c7e755dc0569a2bad6cfd9ce" },
"base16-nvim": { "branch": "main", "commit": "9339f82d6ff6e6ba423a2a0a6a1c42a2a696f5f5" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"fzf": { "branch": "master", "commit": "535b610a6b0858364cfb12cee8b5ae7132883ea0" },
"fzf.vim": { "branch": "master", "commit": "879db51d0965515cdaef9b7f6bdeb91c65d2829e" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"leap.nvim": { "branch": "main", "commit": "614481baedb1c11df1d88338005b3e8c15349dcf" },
"lightline.vim": { "branch": "master", "commit": "e358557e1a9f9fc860416c8eb2e34c0404078155" },
"lsp_signature.nvim": { "branch": "master", "commit": "15bb33cdb47e85278e168cad11acb1b6fa9c6488" },
"nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" },
"nvim-lspconfig": { "branch": "master", "commit": "b34fbdffdcb6295c7a25df6ba375452a2e73c32e" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"fzf-lua": { "branch": "main", "commit": "b9f947aa15f7f050b0032a8e03f210005aedb897" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"leap.nvim": { "branch": "main", "commit": "b960d5038c5c505c52e56a54490f9bbb1f0e6ef6" },
"lightline.vim": { "branch": "master", "commit": "6c283f8df85aa7219fa4096a6ed4ff45d48aa9e1" },
"lsp_signature.nvim": { "branch": "master", "commit": "a65b38f260cc3470a05b4afb84c8d868617d476d" },
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
"nvim-lspconfig": { "branch": "master", "commit": "d10ce09e42bb0ca8600fd610c3bb58676e61208d" },
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
"vim-fish-syntax": { "branch": "master", "commit": "e229becbf4bbee21cc78cd2cf24f57112e33c02a" },
"vim-markdown": { "branch": "master", "commit": "1bc9d0cd8e1cc3e901b0a49c2b50a843f1c89397" },
"vim-matchup": { "branch": "master", "commit": "1c276e12b49a83c1bdca74351187b8adea5da4b9" },
"vim-matchup": { "branch": "master", "commit": "dccb2d12ef2a703d2f076b3cda36a3339449d1eb" },
"vim-terraform": { "branch": "master", "commit": "520498fab16a3a11f2ae1b8cb65e0a1684bc317a" },
"vim-toml": { "branch": "main", "commit": "1b63257680eeb65677eb1ca5077809a982756d58" },
"vim-toml": { "branch": "main", "commit": "da051b7c23bad3c52d18886203c594739780ec09" },
"vim-vsnip": { "branch": "master", "commit": "9bcfabea653abdcdac584283b5097c3f8760abaa" },
"yaml.nvim": { "branch": "main", "commit": "e70ee49f7aefc79dce020d3ffc3c9447b0c52236" }
"yaml.nvim": { "branch": "main", "commit": "b6eaf919fb0a2a254ce20ae657787d67e6b9300e" }
}
+53
View File
@@ -0,0 +1,53 @@
; https://github.com/nvim-treesitter/nvim-treesitter/blob/main/CONTRIBUTING.md
; https://tree-sitter.github.io/tree-sitter/using-parsers/queries/1-syntax.html
(comment) @comment
(string) @string
; Modules
(module_definition ["module"] @module)
(module_definition (identifier) @variable)
; Methods/Functions
(method_definition ["method"] @function.method)
(function_definition ["function"] @function)
(verification_clause [
"decreases"
"ensures"
"invariant"
"modifies"
"provides"
"reads"
"requires"
] @attribute)
(returns_clause ["returns"] @keyword.return)
; Variables
(var_decl ["var"] @variable)
(primitive_type) @type
(number) @number
(import_declaration) @keyword.import
(attributes) @attribute
; Control flow
(if_statement ["if" "else"] @keyword.conditional)
(if_expression ["if" "then" "else"] @keyword.conditional)
; Looping constructs
(while_statement ["while"] @keyword.repeat)
(while_statement ["invariant"] @attribute)
; Debug
(assert_statement ["assert"] @keyword.debug)
(expect_statement ["expect"] @keyword.debug)
"(" @punctuation.bracket
")" @punctuation.bracket
"<" @punctuation.bracket
">" @punctuation.bracket
"[" @punctuation.bracket
"]" @punctuation.bracket
"{" @punctuation.bracket
"}" @punctuation.bracket
";" @punctuation.delimiter