updates
This commit is contained in:
+153
-81
@@ -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"}, {
|
||||
|
||||
Reference in New Issue
Block a user