This commit is contained in:
Andrew Haynes
2026-03-30 00:25:15 -04:00
parent 8653df28bc
commit a31c0de871
1727 changed files with 1174181 additions and 94 deletions
+48 -46
View File
@@ -1,26 +1,32 @@
vim.opt.termguicolors = true
vim.pack.add({
{ src = "https://github.com/rose-pine/neovim", name = "rose-pine" },
{ src = "https://github.com/norcalli/nvim-colorizer.lua" },
{ src = "https://github.com/rose-pine/neovim", name = "rose-pine" },
{ src = "https://github.com/brenoprata10/nvim-highlight-colors" },
{ src = "https://github.com/mbbill/undotree" },
{ src = "https://github.com/nvim-mini/mini.pairs", version = vim.version.range('*') },
{ src = "https://github.com/nvim-mini/mini.pairs", version = vim.version.range('*') },
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
{ src = "https://github.com/ibhagwan/fzf-lua" },
{ src = "https://github.com/saghen/blink.cmp", version = vim.version.range('*'), },
{ src = "git@moo:dmm/polydev.git", version = "main" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
{ src = "https://github.com/saghen/blink.cmp", version = vim.version.range('*'), },
{ src = "git@moo:dmm/polydev.git", version = "main" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
{ src = "https://github.com/alexghergh/nvim-tmux-navigation" },
{ src = "https://github.com/mason-org/mason.nvim" },
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/stevearc/conform.nvim" },
})
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "ts_ls", "lua_ls", "denols" },
automatic_enable = true,
})
require 'nvim-tmux-navigation'.setup {
disable_when_zoomed = true -- defaults to false
}
require('nvim-treesitter').install { 'rust', 'c', 'cpp', 'lua', 'nix' }
require('nvim-treesitter').install { 'rust', 'c', 'cpp', 'lua', 'javascript' }
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'c', 'cpp', 'rust', 'lua' },
pattern = { 'c', 'cpp', 'rust', 'lua', 'javascript' },
callback = function()
vim.treesitter.start()
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
@@ -28,15 +34,9 @@ vim.api.nvim_create_autocmd('FileType', {
})
require("conform").setup({
formatters_by_ft = {
nix = { "alejandra" },
-- Conform will run multiple formatters sequentially
-- You can customize some of the format options for the filetype (:help conform.format)
rust = { "rustfmt", lsp_format = "fallback" },
-- Conform will run the first available formatter
-- javascript = { "prettierd", "prettier", stop_after_first = true },
-- -- Use a "*" to run formatters on all filetypes
["*"] = { "codespell" },
-- Use "_" to run formatters on filetypes that don't have other formatters
lua = { "emmylua-codeformat", lsp_format = "fallback" },
javascript = { "denols", stop_after_first = true },
["_"] = { "trim_whitespace" },
},
format_on_save = {
@@ -45,7 +45,7 @@ require("conform").setup({
},
})
require('colorizer').setup()
require('nvim-highlight-colors').turnOn()
require("Polydev").setup({
terminal = {
mode = "split",
@@ -92,6 +92,25 @@ require("fzf-lua").setup({
},
})
local capabilities = require('blink.cmp').get_lsp_capabilities()
vim.lsp.config("lua_ls", {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
},
},
})
vim.lsp.enable({ "lua_ls", "clangd", "rust-analyzer", "denols" })
--- Options
vim.g.mapleader = " "
vim.opt.number = true
vim.opt.relativenumber = true
@@ -118,48 +137,30 @@ vim.opt.cursorlineopt = { "screenline", "number" } -- cursorline look
vim.opt.foldmethod = "indent"
vim.opt.foldcolumn = "1"
vim.opt.foldenable = false
vim.opt.shortmess = 'aF' -- abbreviates messages and prevents file name being echoed when opened
vim.opt.ignorecase = true -- ignore cases when searching
vim.opt.smartcase = true -- However if we use a capital in search string we then consider case-sensitivity, ignorecase is disabled
vim.opt.smartindent = true -- smarter indentation
vim.opt.smarttab = true -- make tab behaviour smarter
vim.opt.shortmess = 'aF' -- abbreviates messages and prevents file name being echoed when opened
vim.opt.ignorecase = true -- ignore cases when searching
vim.opt.smartcase = true -- However if we use a capital in search string we then consider case-sensitivity, ignorecase is disabled
vim.opt.smartindent = false -- smarter indentation
vim.opt.smarttab = true -- make tab behaviour smarter
vim.opt.laststatus = 3
-- vim.opt.list = true
-- vim.opt.lcs = "tab:| "
-- vim.opt.colorcolumn= "80"
--- COLORS
vim.cmd.colorscheme("rose-pine")
-- vim.cmd.colorscheme("tokyonight-moon")
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- 2. Customize the built-in lua_ls config
vim.lsp.config("lua_ls", {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
},
},
})
vim.lsp.enable({ "lua_ls", "clangd", "rust-analyzer", "nil_ls" })
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { link = 'Normal' })
vim.api.nvim_set_hl(0, "StatusLine", { link = 'Normal' })
vim.api.nvim_set_hl(0, "StatusLineTerm", { link = 'Normal' })
vim.api.nvim_set_hl(0, "StatusLineNC", { link = 'Normal' })
vim.api.nvim_set_hl(0, "SignColumn", { link = 'Normal' })
-- vim.api.nvim_set_hl(0, 'LineNrAbove', { link = 'Conceal', bold = true })
-- vim.api.nvim_set_hl(0, 'LineNrBelow', { link = 'Conceal', bold = true })
vim.api.nvim_set_hl(0, 'LineNrAbove', { link = 'NonText', bold = true })
vim.api.nvim_set_hl(0, 'LineNrBelow', { link = 'NonText', bold = true })
vim.api.nvim_set_hl(0, "LineNr", { link = 'Normal' })
vim.api.nvim_set_hl(0, "FoldColumn", { link = 'Normal' })
vim.api.nvim_set_hl(0, "CursorLineNr", { bg = "none", link = 'MatchParen', bold = true })
--- KEYMAPS
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "<leader>ff", vim.lsp.buf.format)
@@ -168,12 +169,14 @@ vim.keymap.set("n", "<leader>ss", ":split<CR>")
vim.keymap.set("n", "<leader>E", ":Ex<CR>")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set("x", "<leader>p", [["_dP]])
vim.keymap.set('n', '<leader><leader>', ":FzfLua files<CR>")
vim.keymap.set('n', '<leader>fh', ":FzfLua helptags<CR>")
vim.keymap.set('n', '<leader>fg', ":FzfLua live_grep<CR>")
vim.keymap.set('n', '<leader>fm', ":FzfLua manpages<CR>")
vim.keymap.set('n', '<leader>xx', ":FzfLua diagnostics_workspace<CR>")
vim.keymap.set('n', '<leader>xx', vim.diagnostic.setqflist)
vim.keymap.set('n', '<leader>fs', vim.lsp.buf.document_symbol)
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition)
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references)
@@ -190,4 +193,3 @@ vim.keymap.set("n", "<C-h>", ":NvimTmuxNavigateLeft<CR>", { silent = true })
vim.keymap.set("n", "<C-j>", ":NvimTmuxNavigateDown<CR>", { silent = true })
vim.keymap.set("n", "<C-k>", ":NvimTmuxNavigateUp<CR>", { silent = true })
vim.keymap.set("n", "<C-l>", ":NvimTmuxNavigateRight<CR>", { silent = true })
+162
View File
@@ -0,0 +1,162 @@
---@brief
---
--- https://github.com/denoland/deno
---
--- Deno's built-in language server
---
--- To appropriately highlight codefences returned from denols, you will need to augment vim.g.markdown_fenced languages
--- in your init.lua. Example:
---
--- ```lua
--- vim.g.markdown_fenced_languages = {
--- "ts=typescript"
--- }
--- ```
---
--- Some care must be taken here to correctly infer whether a file is part of a Deno program, or a TS program that
--- expects to run in Node or Web Browsers. This supports having a Deno module that is a part of a mostly-not-Deno
--- monorepo. We do this by finding the nearest package manager lock file, and the nearest deno.json or deno.jsonc.
--- Note that this means that without a deno.json, deno.jsonc, or deno.lock file, this LSP client will not attach.
---
--- Example:
---
--- ```
--- project-root
--- +-- node_modules/...
--- +-- package-lock.json
--- +-- package.json
--- +-- packages
--- +-- deno-module
--- | +-- deno.json
--- | +-- package.json <-- It's normal for Deno projects to have package.json files!
--- | +-- src
--- | +-- index.ts <-- this is a Deno file
--- +-- node-module
--- +-- package.json
--- +-- src
--- +-- index.ts <-- a non-Deno file (ie, should use ts_ls or tsgo)
--- ```
---
--- From the file being edited, we walk up to find the nearest package manager lockfile. This is PROJECT ROOT.
--- From the file being edited, find the nearest deno.json or deno.jsonc. This is DENO ROOT.
--- From the file being edited, find the nearest deno.lock. This is DENO LOCK ROOT
--- If DENO LOCK ROOT is found, and PROJECT ROOT is missing or shorter, then this is a deno file, and we attach.
--- If DENO ROOT is found, and it's longer than or equal to PROJECT ROOT, then this is a Deno file, and we attach.
--- Otherwise, we abort, because this is a non-Deno TS file.
local lsp = vim.lsp
local function virtual_text_document_handler(uri, res, client)
if not res then
return nil
end
local lines = vim.split(res.result, '\n')
local bufnr = vim.uri_to_bufnr(uri)
local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
if #current_buf ~= 0 then
return nil
end
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
vim.api.nvim_set_option_value('readonly', true, { buf = bufnr })
vim.api.nvim_set_option_value('modified', false, { buf = bufnr })
vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr })
lsp.buf_attach_client(bufnr, client.id)
end
local function virtual_text_document(uri, client)
local params = {
textDocument = {
uri = uri,
},
}
local result = client:request_sync('deno/virtualTextDocument', params)
virtual_text_document_handler(uri, result, client)
end
local function denols_handler(err, result, ctx, config)
if not result or vim.tbl_isempty(result) then
return nil
end
local client = vim.lsp.get_client_by_id(ctx.client_id)
for _, res in pairs(result) do
local uri = res.uri or res.targetUri
if uri:match '^deno:' then
virtual_text_document(uri, client)
res['uri'] = uri
res['targetUri'] = uri
end
end
lsp.handlers[ctx.method](err, result, ctx, config)
end
---@type vim.lsp.Config
return {
cmd = { 'deno', 'lsp' },
cmd_env = { NO_COLOR = true },
filetypes = {
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
},
root_dir = function(bufnr, on_dir)
-- The project root is where the LSP can be started from
local root_markers = { 'deno.lock', 'deno.json', 'deno.jsonc' }
-- Give the root markers equal priority by wrapping them in a table
root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
or vim.list_extend(root_markers, { '.git' })
-- only include deno projects
local deno_root = vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc' })
local deno_lock_root = vim.fs.root(bufnr, { 'deno.lock' })
local project_root = vim.fs.root(bufnr, root_markers)
if
(deno_lock_root and (not project_root or #deno_lock_root > #project_root))
or (deno_root and (not project_root or #deno_root >= #project_root))
then
-- deno config is closer than or equal to package manager lock,
-- or deno lock is closer than package manager lock. Attach at the project root,
-- or deno lock or deno config path. At least one of these is always set at this point.
on_dir(project_root or deno_lock_root or deno_root)
end
end,
---@type lspconfig.settings.denols
settings = {
deno = {
enable = true,
suggest = {
imports = {
hosts = {
['https://deno.land'] = true,
},
},
},
},
},
handlers = {
['textDocument/definition'] = denols_handler,
['textDocument/typeDefinition'] = denols_handler,
['textDocument/references'] = denols_handler,
},
on_attach = function(client, bufnr)
vim.api.nvim_buf_create_user_command(bufnr, 'LspDenolsCache', function()
client:exec_cmd({
title = 'DenolsCache',
command = 'deno.cache',
arguments = { {}, vim.uri_from_bufnr(bufnr) },
}, { bufnr = bufnr }, function(err, _, ctx)
if err then
local uri = ctx.params.arguments[2]
vim.notify('cache command failed for' .. vim.uri_to_fname(uri),
vim.log.levels.ERROR)
end
end)
end, {
desc = 'Cache a module and all of its dependencies.',
})
end,
}
+15 -3
View File
@@ -14,9 +14,13 @@
"src": "https://github.com/stevearc/conform.nvim"
},
"fzf-lua": {
"rev": "8a79ee54d6216d10b2f153921a12b152be0c1a20",
"rev": "bde73a6886b607246095aa59f396de5e0d036890",
"src": "https://github.com/ibhagwan/fzf-lua"
},
"mason-lspconfig.nvim": {
"rev": "38499e0bda64bc0f3ec6e7f03f8e13dd11c0fa00",
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
},
"mason.nvim": {
"rev": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65",
"src": "https://github.com/mason-org/mason.nvim"
@@ -30,12 +34,20 @@
"rev": "a065833f35a3a7cc3ef137ac88b5381da2ba302e",
"src": "https://github.com/norcalli/nvim-colorizer.lua"
},
"nvim-highlight-colors": {
"rev": "e2cb22089cc2358b2b995c09578224f142de6039",
"src": "https://github.com/brenoprata10/nvim-highlight-colors"
},
"nvim-lspconfig": {
"rev": "16812abf0e8d8175155f26143a8504e8253e92b0",
"src": "https://github.com/neovim/nvim-lspconfig"
},
"nvim-tmux-navigation": {
"rev": "4898c98702954439233fdaf764c39636681e2861",
"src": "https://github.com/alexghergh/nvim-tmux-navigation"
},
"nvim-treesitter": {
"rev": "2b50ab5ccbcd9e5708deb351308edd738adbf84c",
"rev": "7caec274fd19c12b55902a5b795100d21531391f",
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
},
"nvim-web-devicons": {
@@ -43,7 +55,7 @@
"src": "https://github.com/nvim-tree/nvim-web-devicons"
},
"polydev": {
"rev": "62015919ddfe04c94aecc1977e6a44c08142ded3",
"rev": "919d141c6a4212d176050ba13fc81d2fa25216a4",
"src": "git@moo:dmm/polydev.git",
"version": "'main'"
},